inital
This commit is contained in:
		
							
								
								
									
										13
									
								
								node_modules/setprototypeof/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								node_modules/setprototypeof/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
Copyright (c) 2015, Wes Todd
 | 
			
		||||
 | 
			
		||||
Permission to use, copy, modify, and/or distribute this software for any
 | 
			
		||||
purpose with or without fee is hereby granted, provided that the above
 | 
			
		||||
copyright notice and this permission notice appear in all copies.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
			
		||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
			
		||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
 | 
			
		||||
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
			
		||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
 | 
			
		||||
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 | 
			
		||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
							
								
								
									
										31
									
								
								node_modules/setprototypeof/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								node_modules/setprototypeof/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
# Polyfill for `Object.setPrototypeOf`
 | 
			
		||||
 | 
			
		||||
[](https://npmjs.org/package/setprototypeof)
 | 
			
		||||
[](https://npmjs.org/package/setprototypeof)
 | 
			
		||||
[](https://github.com/standard/standard)
 | 
			
		||||
 | 
			
		||||
A simple cross platform implementation to set the prototype of an instianted object.  Supports all modern browsers and at least back to IE8.
 | 
			
		||||
 | 
			
		||||
## Usage:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$ npm install --save setprototypeof
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
var setPrototypeOf = require('setprototypeof')
 | 
			
		||||
 | 
			
		||||
var obj = {}
 | 
			
		||||
setPrototypeOf(obj, {
 | 
			
		||||
  foo: function () {
 | 
			
		||||
    return 'bar'
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
obj.foo() // bar
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
TypeScript is also supported:
 | 
			
		||||
 | 
			
		||||
```typescript
 | 
			
		||||
import setPrototypeOf from 'setprototypeof'
 | 
			
		||||
```
 | 
			
		||||
							
								
								
									
										2
									
								
								node_modules/setprototypeof/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								node_modules/setprototypeof/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
declare function setPrototypeOf(o: any, proto: object | null): any;
 | 
			
		||||
export = setPrototypeOf;
 | 
			
		||||
							
								
								
									
										17
									
								
								node_modules/setprototypeof/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								node_modules/setprototypeof/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
/* eslint no-proto: 0 */
 | 
			
		||||
module.exports = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties)
 | 
			
		||||
 | 
			
		||||
function setProtoOf (obj, proto) {
 | 
			
		||||
  obj.__proto__ = proto
 | 
			
		||||
  return obj
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function mixinProperties (obj, proto) {
 | 
			
		||||
  for (var prop in proto) {
 | 
			
		||||
    if (!Object.prototype.hasOwnProperty.call(obj, prop)) {
 | 
			
		||||
      obj[prop] = proto[prop]
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return obj
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										38
									
								
								node_modules/setprototypeof/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								node_modules/setprototypeof/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "setprototypeof",
 | 
			
		||||
  "version": "1.2.0",
 | 
			
		||||
  "description": "A small polyfill for Object.setprototypeof",
 | 
			
		||||
  "main": "index.js",
 | 
			
		||||
  "typings": "index.d.ts",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "standard && mocha",
 | 
			
		||||
    "testallversions": "npm run node010 && npm run node4 && npm run node6 && npm run node9 && npm run node11",
 | 
			
		||||
    "testversion": "docker run -it --rm -v $(PWD):/usr/src/app -w /usr/src/app node:${NODE_VER} npm install mocha@${MOCHA_VER:-latest} && npm t",
 | 
			
		||||
    "node010": "NODE_VER=0.10 MOCHA_VER=3 npm run testversion",
 | 
			
		||||
    "node4": "NODE_VER=4 npm run testversion",
 | 
			
		||||
    "node6": "NODE_VER=6 npm run testversion",
 | 
			
		||||
    "node9": "NODE_VER=9 npm run testversion",
 | 
			
		||||
    "node11": "NODE_VER=11 npm run testversion",
 | 
			
		||||
    "prepublishOnly": "npm t",
 | 
			
		||||
    "postpublish": "git push origin && git push origin --tags"
 | 
			
		||||
  },
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "https://github.com/wesleytodd/setprototypeof.git"
 | 
			
		||||
  },
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "polyfill",
 | 
			
		||||
    "object",
 | 
			
		||||
    "setprototypeof"
 | 
			
		||||
  ],
 | 
			
		||||
  "author": "Wes Todd",
 | 
			
		||||
  "license": "ISC",
 | 
			
		||||
  "bugs": {
 | 
			
		||||
    "url": "https://github.com/wesleytodd/setprototypeof/issues"
 | 
			
		||||
  },
 | 
			
		||||
  "homepage": "https://github.com/wesleytodd/setprototypeof",
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "mocha": "^6.1.4",
 | 
			
		||||
    "standard": "^13.0.2"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										24
									
								
								node_modules/setprototypeof/test/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								node_modules/setprototypeof/test/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
'use strict'
 | 
			
		||||
/* eslint-env mocha */
 | 
			
		||||
/* eslint no-proto: 0 */
 | 
			
		||||
var assert = require('assert')
 | 
			
		||||
var setPrototypeOf = require('..')
 | 
			
		||||
 | 
			
		||||
describe('setProtoOf(obj, proto)', function () {
 | 
			
		||||
  it('should merge objects', function () {
 | 
			
		||||
    var obj = { a: 1, b: 2 }
 | 
			
		||||
    var proto = { b: 3, c: 4 }
 | 
			
		||||
    var mergeObj = setPrototypeOf(obj, proto)
 | 
			
		||||
 | 
			
		||||
    if (Object.getPrototypeOf) {
 | 
			
		||||
      assert.strictEqual(Object.getPrototypeOf(obj), proto)
 | 
			
		||||
    } else if ({ __proto__: [] } instanceof Array) {
 | 
			
		||||
      assert.strictEqual(obj.__proto__, proto)
 | 
			
		||||
    } else {
 | 
			
		||||
      assert.strictEqual(obj.a, 1)
 | 
			
		||||
      assert.strictEqual(obj.b, 2)
 | 
			
		||||
      assert.strictEqual(obj.c, 4)
 | 
			
		||||
    }
 | 
			
		||||
    assert.strictEqual(mergeObj, obj)
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
		Reference in New Issue
	
	Block a user