Comparing version 0.16.1 to 0.17.0
{ | ||
"name": "101", | ||
"version": "0.16.1", | ||
"version": "0.17.0", | ||
"description": "common javascript utils that can be required selectively that assume es5+", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "lab -c -t 100 test", | ||
"test": "lab -c -t 100 -a code test", | ||
"test-watch": "nodemon --exec lab -c test" | ||
@@ -9,0 +9,0 @@ }, |
@@ -73,2 +73,32 @@ ![101](http://i.imgur.com/MFrmMt6.png) | ||
## bindAll | ||
Bind methods in an object. | ||
You can pass an array containing the name of the methods to bind as second | ||
argument or leave it empty to bind all the available methods. | ||
```js | ||
var bindAll = require('101/bindAll'); | ||
var obj = { | ||
init: function() { | ||
this.on(this.handler); | ||
}, | ||
on: function(handler) { | ||
return handler(); | ||
}, | ||
handler: function() { | ||
console.log(this.msg); | ||
}, | ||
msg: 'Hello World' | ||
} | ||
obj.init(); // undefined | ||
bindAll(obj); | ||
obj.init(); // "Hello World" | ||
bindAll(obj, ['handler']); | ||
obj.init(); // "Hello World" | ||
``` | ||
## clone | ||
@@ -428,2 +458,18 @@ | ||
## keysIn | ||
Return an array containing all the keys of an object. | ||
It differs from the native `Object.keys` by including also the `prototype` keys. | ||
```js | ||
var keysIn = require('101/keys-in'); | ||
var User = function() { | ||
this.msg = 'Hello World'; | ||
} | ||
User.prototype.isLoggedIn = function() { /* example function */ } | ||
var user = new User(); | ||
keysIn(user); // ['msg', 'isLoggedIn'] | ||
``` | ||
## last | ||
@@ -442,3 +488,3 @@ | ||
Create a lens to access a datastructur. | ||
Create a lens to access a data structure. | ||
@@ -445,0 +491,0 @@ ```js |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
49970
47
1053
715
0