-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Keyan Zhang
committed
May 29, 2016
1 parent
fa20a15
commit d0b993e
Showing
11 changed files
with
61 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,9 @@ | ||
{ | ||
"extends": "airbnb", | ||
"extends": "airbnb-base/legacy", | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"es6": true, | ||
"mocha": true, | ||
}, | ||
"ecmaFeatures": { | ||
"generators": true, | ||
}, | ||
"globals": { | ||
"__DEV__": true, | ||
}, | ||
"parser": "babel-eslint", | ||
"rules": { | ||
"babel/generator-star-spacing": 1, | ||
"babel/new-cap": 1, | ||
"babel/object-shorthand": 1, | ||
"babel/arrow-parens": 1, | ||
"babel/no-await-in-loop": 1, | ||
"array-bracket-spacing": [1, "always", { | ||
"singleValue": true, | ||
"objectsInArrays": false, | ||
"arraysInArrays": true, | ||
}], | ||
}, | ||
"plugins": [ | ||
"babel", | ||
"react", | ||
], | ||
"jest": true, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,3 @@ build/Release | |
node_modules | ||
|
||
.DS_Store | ||
build |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-disable space-before-function-paren, func-names */ | ||
var idObj = require('..'); | ||
|
||
describe('idObj', function() { | ||
it('should return the key as a string', function() { | ||
expect(idObj.foo).toBe('foo'); | ||
}); | ||
it('should support dot notation', function() { | ||
expect(idObj.bar).toBe('bar'); | ||
}); | ||
it('should support bracket notation', function() { | ||
expect(idObj[1]).toBe('1'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
const Reflect = require('harmony-reflect'); // eslint-disable-line no-unused-vars | ||
var Reflect; // eslint-disable-line no-unused-vars | ||
var idObj; | ||
|
||
const idObjHandler = { | ||
get: (target, key) => key, | ||
}; | ||
function checkIsNodeV6OrAbove() { | ||
if (typeof process === 'undefined') { | ||
return false; | ||
} | ||
|
||
const idObj = new Proxy({}, idObjHandler); | ||
return parseInt(process.versions.node.split('.')[0], 10) >= 6; | ||
} | ||
|
||
export default idObj; | ||
if (!checkIsNodeV6OrAbove()) { | ||
Reflect = require('harmony-reflect'); // eslint-disable-line global-require | ||
} | ||
|
||
idObj = new Proxy({}, { | ||
get: function getter(target, key) { | ||
return key; | ||
} | ||
}); | ||
|
||
module.exports = idObj; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.