Comparing version
@@ -46,3 +46,3 @@ /** | ||
if (Object.hasOwnProperty(bound, key)) { | ||
if (Object.prototype.hasOwnProperty.call(bound, key)) { | ||
continue; | ||
@@ -49,0 +49,0 @@ } |
{ | ||
"name": "bind-deep", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Lightweight module for binding a function or object deeply.", | ||
@@ -16,4 +16,8 @@ "keywords": [ | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/evelynhathaway/bind-deep.git" | ||
}, | ||
"license": "MIT", | ||
"author": "Evelyn Hathaway <npm@evelynhathaway.com> (https://evelynhathaway.com)", | ||
"author": "Evelyn Hathaway <npm@evelyn.dev> (https://evelyn.dev)", | ||
"files": [ | ||
@@ -27,6 +31,2 @@ "/lib" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/evelynhathaway/bind-deep.git" | ||
}, | ||
"scripts": { | ||
@@ -39,10 +39,11 @@ "build": "babel src -d lib", | ||
"devDependencies": { | ||
"@babel/cli": "^7.1.2", | ||
"@babel/core": "^7.1.2", | ||
"@babel/preset-env": "^7.1.0", | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.4.0", | ||
"@babel/preset-env": "^7.4.2", | ||
"chai": "^4.2.0", | ||
"eslint": "^5.8.0", | ||
"eslint-plugin-mocha": "^5.2.0", | ||
"eslint-plugin-node": "^8.0.0", | ||
"mocha": "^5.2.0" | ||
"eslint": "^5.15.3", | ||
"eslint-plugin-evelyn": "0.0.0", | ||
"eslint-plugin-mocha": "^5.3.0", | ||
"eslint-plugin-node": "^8.0.1", | ||
"mocha": "^6.0.2" | ||
}, | ||
@@ -49,0 +50,0 @@ "engines": { |
# bind-deep | ||
[](https://www.npmjs.com/package/bind-deep) | ||
[](https://travis-ci.org/evelynhathaway/bind-deep) | ||
[](/LICENSE) | ||
[](https://www.npmjs.com/package/bind-deep) | ||
[](https://travis-ci.com/evelynhathaway/bind-deep) | ||
[](https://bundlephobia.com/result?p=bind-deep) | ||
[](/LICENSE) | ||
## Description | ||
Bind an object to `this` in all methods in a function or object. Simple, dependency-free alternative to [deep-bind](https://github.com/jonschlinkert/deep-bind). | ||
Bind an object to `this` in all methods in a function, object, or array. A simple, dependency-free alternative to [deep-bind](https://github.com/jonschlinkert/deep-bind). | ||
## Features | ||
- Works with functions, arrays, and other objects | ||
- Works with most custom classes, array-like objects, etc. | ||
- Binds root function and all own, enumerable property functions | ||
- Works with most custom classes, and array-like objects | ||
- Binds root function (if passed a function) and all own, enumerable property functions | ||
- Includes binding accessors — getters and setters | ||
@@ -19,34 +22,18 @@ - Copies objects and enumerable properties deeply | ||
## Installation | ||
###### From npm | ||
```bash | ||
$ npm install bind-deep | ||
``` | ||
###### As a dependency | ||
```bash | ||
# Create package.json for your own module if you haven't already | ||
$ npm init | ||
# Install bind-deep and add to dependencies | ||
$ npm install bind-deep --save | ||
``` | ||
###### From source | ||
```bash | ||
$ git clone https://github.com/evelynhathaway/bind-deep | ||
$ cd bind-deep/ | ||
$ npm install | ||
npm install bind-deep --save | ||
``` | ||
--- | ||
## API | ||
```js | ||
bindDeep(object [Function, Object, Array], thisArg [Object], ...args) | ||
// => bound [Function, Object, Array] | ||
bindDeep(object: Function | Object | Array, thisArg: Object, ...args:) | ||
// => bound: Function | Object | Array | ||
``` | ||
## Example | ||
## Example | ||
```js | ||
@@ -82,4 +69,6 @@ // Require bind-deep | ||
--- | ||
## License | ||
Copyright Evelyn Hathaway, [MIT License](https://github.com/evelynhathaway/bind-deep/blob/master/LICENSE) | ||
Copyright Evelyn Hathaway, [MIT License](/LICENSE) |
5623
-2.98%9
12.5%73
-13.1%