summaryrefslogtreecommitdiff
path: root/node_modules/setprototypeof
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/setprototypeof')
-rw-r--r--node_modules/setprototypeof/LICENSE13
-rw-r--r--node_modules/setprototypeof/README.md31
-rw-r--r--node_modules/setprototypeof/index.d.ts2
-rw-r--r--node_modules/setprototypeof/index.js17
-rw-r--r--node_modules/setprototypeof/package.json38
-rw-r--r--node_modules/setprototypeof/test/index.js24
6 files changed, 125 insertions, 0 deletions
diff --git a/node_modules/setprototypeof/LICENSE b/node_modules/setprototypeof/LICENSE
new file mode 100644
index 0000000..61afa2f
--- /dev/null
+++ b/node_modules/setprototypeof/LICENSE
@@ -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.
diff --git a/node_modules/setprototypeof/README.md b/node_modules/setprototypeof/README.md
new file mode 100644
index 0000000..791eeff
--- /dev/null
+++ b/node_modules/setprototypeof/README.md
@@ -0,0 +1,31 @@
+# Polyfill for `Object.setPrototypeOf`
+
+[![NPM Version](https://img.shields.io/npm/v/setprototypeof.svg)](https://npmjs.org/package/setprototypeof)
+[![NPM Downloads](https://img.shields.io/npm/dm/setprototypeof.svg)](https://npmjs.org/package/setprototypeof)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](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'
+```
diff --git a/node_modules/setprototypeof/index.d.ts b/node_modules/setprototypeof/index.d.ts
new file mode 100644
index 0000000..f108ecd
--- /dev/null
+++ b/node_modules/setprototypeof/index.d.ts
@@ -0,0 +1,2 @@
+declare function setPrototypeOf(o: any, proto: object | null): any;
+export = setPrototypeOf;
diff --git a/node_modules/setprototypeof/index.js b/node_modules/setprototypeof/index.js
new file mode 100644
index 0000000..c527055
--- /dev/null
+++ b/node_modules/setprototypeof/index.js
@@ -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
+}
diff --git a/node_modules/setprototypeof/package.json b/node_modules/setprototypeof/package.json
new file mode 100644
index 0000000..f20915b
--- /dev/null
+++ b/node_modules/setprototypeof/package.json
@@ -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"
+ }
+}
diff --git a/node_modules/setprototypeof/test/index.js b/node_modules/setprototypeof/test/index.js
new file mode 100644
index 0000000..afeb4dd
--- /dev/null
+++ b/node_modules/setprototypeof/test/index.js
@@ -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)
+ })
+})