-
Notifications
You must be signed in to change notification settings - Fork 57
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
Tomek Wiszniewski
committed
May 11, 2015
1 parent
db4a3ea
commit 9ccb6c4
Showing
3 changed files
with
16 additions
and
16 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
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,20 +1,20 @@ | ||
/** | ||
* @module 1-liners/method | ||
* | ||
* | ||
* @description | ||
* | ||
* Same as `object.method(...args)` | ||
* | ||
* Same as `object[method](...args)` | ||
* | ||
* @example | ||
* | ||
* | ||
* const method = require('1-liners/method'); | ||
* | ||
* | ||
* const object = { | ||
* base: 1, | ||
* add(number) { return this.base + number; }, | ||
* }; | ||
* | ||
* | ||
* method('add', object)(5); // => 6 | ||
* | ||
* | ||
*/ | ||
export default (method, object) => (...args) => object[method](...args); |
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,17 +1,17 @@ | ||
/** | ||
* @module 1-liners/property | ||
* | ||
* | ||
* @description | ||
* | ||
* Same as `object.property` | ||
* | ||
* Same as `object[property]` | ||
* | ||
* @example | ||
* | ||
* | ||
* const property = require('1-liners/property'); | ||
* | ||
* | ||
* const object = {foo: 1}; | ||
* | ||
* | ||
* property('foo', object); // => 1 | ||
* | ||
* | ||
*/ | ||
export default (property, object) => object[property]; |