You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

101

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

101 - npm Package Compare versions

Comparing version

to
0.17.0

bind-all.js

4

package.json
{
"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