From bbff7403fbf46f9ad92240ac213df8d30ef31b64 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Sep 2018 02:56:13 +0200 Subject: update packages --- node_modules/object-keys/.npmignore | 1 - node_modules/object-keys/.travis.yml | 222 ++++++++++++++++++++++++++- node_modules/object-keys/README.md | 69 +++++++-- node_modules/object-keys/foreach.js | 40 ----- node_modules/object-keys/index.js | 141 ++++++++++++++++- node_modules/object-keys/isArguments.js | 25 +-- node_modules/object-keys/package.json | 64 ++++++-- node_modules/object-keys/shim.js | 62 -------- node_modules/object-keys/test/foreach.js | 156 ------------------- node_modules/object-keys/test/index.js | 3 +- node_modules/object-keys/test/isArguments.js | 10 -- node_modules/object-keys/test/shim.js | 134 ---------------- 12 files changed, 481 insertions(+), 446 deletions(-) delete mode 100644 node_modules/object-keys/.npmignore delete mode 100644 node_modules/object-keys/foreach.js delete mode 100644 node_modules/object-keys/shim.js delete mode 100644 node_modules/object-keys/test/foreach.js delete mode 100644 node_modules/object-keys/test/isArguments.js delete mode 100644 node_modules/object-keys/test/shim.js (limited to 'node_modules/object-keys') diff --git a/node_modules/object-keys/.npmignore b/node_modules/object-keys/.npmignore deleted file mode 100644 index 3c3629e64..000000000 --- a/node_modules/object-keys/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/object-keys/.travis.yml b/node_modules/object-keys/.travis.yml index 60d00ce14..767256c8d 100644 --- a/node_modules/object-keys/.travis.yml +++ b/node_modules/object-keys/.travis.yml @@ -1,5 +1,225 @@ language: node_js +os: + - linux node_js: + - "10.4" + - "9.11" + - "8.11" + - "7.10" + - "6.14" + - "5.12" + - "4.9" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" - "0.10" - "0.8" - - "0.6" +before_install: + - 'case "${TRAVIS_NODE_VERSION}" in 0.*) export NPM_CONFIG_STRICT_SSL=false ;; esac' + - 'nvm install-latest-npm' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.9" ]; then nvm install --latest-npm 0.8 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "lts/*" + env: PRETEST=true + - node_js: "lts/*" + env: POSTTEST=true + - node_js: "4" + env: COVERAGE=true + - node_js: "10.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "10.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "9.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.13" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.12" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true + - env: COVERAGE=true diff --git a/node_modules/object-keys/README.md b/node_modules/object-keys/README.md index ab32d0ad0..ed4c27702 100644 --- a/node_modules/object-keys/README.md +++ b/node_modules/object-keys/README.md @@ -1,10 +1,21 @@ -#object-keys [![Version Badge][2]][1] +#object-keys [![Version Badge][npm-version-svg]][package-url] -[![Build Status][3]][4] [![dependency status][5]][6] +[![Build Status][travis-svg]][travis-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] -[![browser support][7]][8] +[![npm badge][npm-badge-png]][package-url] -An Object.keys shim. Uses Object.keys if available. +[![browser support][testling-svg]][testling-url] + +An Object.keys shim. Invoke its "shim" method to shim Object.keys if it is unavailable. + +Most common usage: +```js +var keys = Object.keys || require('object-keys'); +``` ## Example @@ -17,23 +28,49 @@ var obj = { c: true }; -assert.equal(keys(obj), ['a', 'b', 'c']); +assert.deepEqual(keys(obj), ['a', 'b', 'c']); +``` + +```js +var keys = require('object-keys'); +var assert = require('assert'); +/* when Object.keys is not present */ +delete Object.keys; +var shimmedKeys = keys.shim(); +assert.equal(shimmedKeys, keys); +assert.deepEqual(Object.keys(obj), keys(obj)); +``` + +```js +var keys = require('object-keys'); +var assert = require('assert'); +/* when Object.keys is present */ +var shimmedKeys = keys.shim(); +assert.equal(shimmedKeys, Object.keys); +assert.deepEqual(Object.keys(obj), keys(obj)); ``` ## Source -Implementation taken directly from [es5-shim]([9]), with modifications, including from [lodash]([10]). +Implementation taken directly from [es5-shim][es5-shim-url], with modifications, including from [lodash][lodash-url]. ## Tests Simply clone the repo, `npm install`, and run `npm test` -[1]: https://npmjs.org/package/object-keys -[2]: http://vb.teelaun.ch/ljharb/object-keys.svg -[3]: https://travis-ci.org/ljharb/object-keys.png -[4]: https://travis-ci.org/ljharb/object-keys -[5]: https://david-dm.org/ljharb/object-keys.png -[6]: https://david-dm.org/ljharb/object-keys -[7]: https://ci.testling.com/ljharb/object-keys.png -[8]: https://ci.testling.com/ljharb/object-keys -[9]: https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js#L542-589 -[10]: https://github.com/bestiejs/lodash +[package-url]: https://npmjs.org/package/object-keys +[npm-version-svg]: http://versionbadg.es/ljharb/object-keys.svg +[travis-svg]: https://travis-ci.org/ljharb/object-keys.svg +[travis-url]: https://travis-ci.org/ljharb/object-keys +[deps-svg]: https://david-dm.org/ljharb/object-keys.svg +[deps-url]: https://david-dm.org/ljharb/object-keys +[dev-deps-svg]: https://david-dm.org/ljharb/object-keys/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/object-keys#info=devDependencies +[testling-svg]: https://ci.testling.com/ljharb/object-keys.png +[testling-url]: https://ci.testling.com/ljharb/object-keys +[es5-shim-url]: https://github.com/es-shims/es5-shim/blob/master/es5-shim.js#L542-589 +[lodash-url]: https://github.com/lodash/lodash +[npm-badge-png]: https://nodei.co/npm/object-keys.png?downloads=true&stars=true +[license-image]: http://img.shields.io/npm/l/object-keys.svg +[license-url]: LICENSE +[downloads-image]: http://img.shields.io/npm/dm/object-keys.svg +[downloads-url]: http://npm-stat.com/charts.html?package=object-keys diff --git a/node_modules/object-keys/foreach.js b/node_modules/object-keys/foreach.js deleted file mode 100644 index db32d4582..000000000 --- a/node_modules/object-keys/foreach.js +++ /dev/null @@ -1,40 +0,0 @@ -var hasOwn = Object.prototype.hasOwnProperty; -var toString = Object.prototype.toString; - -var isFunction = function (fn) { - var isFunc = (typeof fn === 'function' && !(fn instanceof RegExp)) || toString.call(fn) === '[object Function]'; - if (!isFunc && typeof window !== 'undefined') { - isFunc = fn === window.setTimeout || fn === window.alert || fn === window.confirm || fn === window.prompt; - } - return isFunc; -}; - -module.exports = function forEach(obj, fn) { - if (!isFunction(fn)) { - throw new TypeError('iterator must be a function'); - } - var i, k, - isString = typeof obj === 'string', - l = obj.length, - context = arguments.length > 2 ? arguments[2] : null; - if (l === +l) { - for (i = 0; i < l; i++) { - if (context === null) { - fn(isString ? obj.charAt(i) : obj[i], i, obj); - } else { - fn.call(context, isString ? obj.charAt(i) : obj[i], i, obj); - } - } - } else { - for (k in obj) { - if (hasOwn.call(obj, k)) { - if (context === null) { - fn(obj[k], k, obj); - } else { - fn.call(context, obj[k], k, obj); - } - } - } - } -}; - diff --git a/node_modules/object-keys/index.js b/node_modules/object-keys/index.js index f5b24b6d7..3f2463eb8 100644 --- a/node_modules/object-keys/index.js +++ b/node_modules/object-keys/index.js @@ -1,2 +1,141 @@ -module.exports = Object.keys || require('./shim'); +'use strict'; +// modified from https://github.com/es-shims/es5-shim +var has = Object.prototype.hasOwnProperty; +var toStr = Object.prototype.toString; +var slice = Array.prototype.slice; +var isArgs = require('./isArguments'); +var isEnumerable = Object.prototype.propertyIsEnumerable; +var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString'); +var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); +var dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' +]; +var equalsConstructorPrototype = function (o) { + var ctor = o.constructor; + return ctor && ctor.prototype === o; +}; +var excludedKeys = { + $applicationCache: true, + $console: true, + $external: true, + $frame: true, + $frameElement: true, + $frames: true, + $innerHeight: true, + $innerWidth: true, + $outerHeight: true, + $outerWidth: true, + $pageXOffset: true, + $pageYOffset: true, + $parent: true, + $scrollLeft: true, + $scrollTop: true, + $scrollX: true, + $scrollY: true, + $self: true, + $webkitIndexedDB: true, + $webkitStorageInfo: true, + $window: true +}; +var hasAutomationEqualityBug = (function () { + /* global window */ + if (typeof window === 'undefined') { return false; } + for (var k in window) { + try { + if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { + try { + equalsConstructorPrototype(window[k]); + } catch (e) { + return true; + } + } + } catch (e) { + return true; + } + } + return false; +}()); +var equalsConstructorPrototypeIfNotBuggy = function (o) { + /* global window */ + if (typeof window === 'undefined' || !hasAutomationEqualityBug) { + return equalsConstructorPrototype(o); + } + try { + return equalsConstructorPrototype(o); + } catch (e) { + return false; + } +}; + +var keysShim = function keys(object) { + var isObject = object !== null && typeof object === 'object'; + var isFunction = toStr.call(object) === '[object Function]'; + var isArguments = isArgs(object); + var isString = isObject && toStr.call(object) === '[object String]'; + var theKeys = []; + + if (!isObject && !isFunction && !isArguments) { + throw new TypeError('Object.keys called on a non-object'); + } + + var skipProto = hasProtoEnumBug && isFunction; + if (isString && object.length > 0 && !has.call(object, 0)) { + for (var i = 0; i < object.length; ++i) { + theKeys.push(String(i)); + } + } + + if (isArguments && object.length > 0) { + for (var j = 0; j < object.length; ++j) { + theKeys.push(String(j)); + } + } else { + for (var name in object) { + if (!(skipProto && name === 'prototype') && has.call(object, name)) { + theKeys.push(String(name)); + } + } + } + + if (hasDontEnumBug) { + var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); + + for (var k = 0; k < dontEnums.length; ++k) { + if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { + theKeys.push(dontEnums[k]); + } + } + } + return theKeys; +}; + +keysShim.shim = function shimObjectKeys() { + if (Object.keys) { + var keysWorksWithArguments = (function () { + // Safari 5.0 bug + return (Object.keys(arguments) || '').length === 2; + }(1, 2)); + if (!keysWorksWithArguments) { + var originalKeys = Object.keys; + Object.keys = function keys(object) { // eslint-disable-line func-name-matching + if (isArgs(object)) { + return originalKeys(slice.call(object)); + } else { + return originalKeys(object); + } + }; + } + } else { + Object.keys = keysShim; + } + return Object.keys || keysShim; +}; + +module.exports = keysShim; diff --git a/node_modules/object-keys/isArguments.js b/node_modules/object-keys/isArguments.js index 74a098978..f2a2a9014 100644 --- a/node_modules/object-keys/isArguments.js +++ b/node_modules/object-keys/isArguments.js @@ -1,16 +1,17 @@ -var toString = Object.prototype.toString; +'use strict'; + +var toStr = Object.prototype.toString; module.exports = function isArguments(value) { - var str = toString.call(value); - var isArguments = str === '[object Arguments]'; - if (!isArguments) { - isArguments = str !== '[object Array]' - && value !== null - && typeof value === 'object' - && typeof value.length === 'number' - && value.length >= 0 - && toString.call(value.callee) === '[object Function]'; + var str = toStr.call(value); + var isArgs = str === '[object Arguments]'; + if (!isArgs) { + isArgs = str !== '[object Array]' && + value !== null && + typeof value === 'object' && + typeof value.length === 'number' && + value.length >= 0 && + toStr.call(value.callee) === '[object Function]'; } - return isArguments; + return isArgs; }; - diff --git a/node_modules/object-keys/package.json b/node_modules/object-keys/package.json index da429a16a..f4d925d6f 100644 --- a/node_modules/object-keys/package.json +++ b/node_modules/object-keys/package.json @@ -1,12 +1,48 @@ { "name": "object-keys", - "version": "0.4.0", - "author": "Jordan Harband", - "description": "An Object.keys replacement, in case Object.keys is not available. From https://github.com/kriskowal/es5-shim", + "version": "1.0.12", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + { + "name": "Raynos", + "email": "raynos2@gmail.com" + }, + { + "name": "Nathan Rajlich", + "email": "nathan@tootallnate.net" + }, + { + "name": "Ivan Starkov", + "email": "istarkov@gmail.com" + }, + { + "name": "Gary Katsevman", + "email": "git@gkatsev.com" + } + ], + "description": "An Object.keys replacement, in case Object.keys is not available. From https://github.com/es-shims/es5-shim", "license": "MIT", "main": "index.js", "scripts": { - "test": "node test/index.js" + "pretest": "npm run --silent lint", + "test": "npm run --silent tests-only", + "posttest": "npm run --silent security", + "tests-only": "node test/index.js", + "coverage": "covert test/*.js", + "coverage-quiet": "covert test/*.js --quiet", + "lint": "npm run --silent jscs && npm run --silent eslint", + "jscs": "jscs test/*.js *.js", + "eslint": "eslint test/*.js *.js", + "security": "nsp check" }, "repository": { "type": "git", @@ -18,13 +54,17 @@ "ES5", "shim" ], - "dependencies": { - }, + "dependencies": {}, "devDependencies": { - "foreach": "~2.0.3", - "is": "~0.2.6", - "tape": "~1.0.4", - "indexof": "~0.0.1" + "@ljharb/eslint-config": "^12.2.1", + "covert": "^1.1.0", + "eslint": "^4.19.1", + "foreach": "^2.0.5", + "indexof": "^0.0.1", + "is": "^3.2.1", + "jscs": "^3.0.7", + "nsp": "^3.2.1", + "tape": "^4.9.1" }, "testling": { "files": "test/index.js", @@ -43,6 +83,8 @@ "iphone/6.0..latest", "android-browser/4.2" ] + }, + "engines": { + "node": ">= 0.4" } } - diff --git a/node_modules/object-keys/shim.js b/node_modules/object-keys/shim.js deleted file mode 100644 index b88421bed..000000000 --- a/node_modules/object-keys/shim.js +++ /dev/null @@ -1,62 +0,0 @@ -(function () { - "use strict"; - - // modified from https://github.com/kriskowal/es5-shim - var has = Object.prototype.hasOwnProperty, - toString = Object.prototype.toString, - forEach = require('./foreach'), - isArgs = require('./isArguments'), - hasDontEnumBug = !({'toString': null}).propertyIsEnumerable('toString'), - hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'), - dontEnums = [ - "toString", - "toLocaleString", - "valueOf", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "constructor" - ], - keysShim; - - keysShim = function keys(object) { - var isObject = object !== null && typeof object === 'object', - isFunction = toString.call(object) === '[object Function]', - isArguments = isArgs(object), - theKeys = []; - - if (!isObject && !isFunction && !isArguments) { - throw new TypeError("Object.keys called on a non-object"); - } - - if (isArguments) { - forEach(object, function (value) { - theKeys.push(value); - }); - } else { - var name, - skipProto = hasProtoEnumBug && isFunction; - - for (name in object) { - if (!(skipProto && name === 'prototype') && has.call(object, name)) { - theKeys.push(name); - } - } - } - - if (hasDontEnumBug) { - var ctor = object.constructor, - skipConstructor = ctor && ctor.prototype === object; - - forEach(dontEnums, function (dontEnum) { - if (!(skipConstructor && dontEnum === 'constructor') && has.call(object, dontEnum)) { - theKeys.push(dontEnum); - } - }); - } - return theKeys; - }; - - module.exports = keysShim; -}()); - diff --git a/node_modules/object-keys/test/foreach.js b/node_modules/object-keys/test/foreach.js deleted file mode 100644 index f29f065a3..000000000 --- a/node_modules/object-keys/test/foreach.js +++ /dev/null @@ -1,156 +0,0 @@ -var test = require('tape'); -var forEach = require('../foreach.js'); - -test('second argument: iterator', function (t) { - var arr = []; - t.throws(function () { forEach(arr); }, TypeError, 'undefined is not a function'); - t.throws(function () { forEach(arr, null); }, TypeError, 'null is not a function'); - t.throws(function () { forEach(arr, ''); }, TypeError, 'string is not a function'); - t.throws(function () { forEach(arr, /a/); }, TypeError, 'regex is not a function'); - t.throws(function () { forEach(arr, true); }, TypeError, 'true is not a function'); - t.throws(function () { forEach(arr, false); }, TypeError, 'false is not a function'); - t.throws(function () { forEach(arr, NaN); }, TypeError, 'NaN is not a function'); - t.throws(function () { forEach(arr, 42); }, TypeError, '42 is not a function'); - t.doesNotThrow(function () { forEach(arr, function () {}); }, 'function is a function'); - t.doesNotThrow(function () { forEach(arr, setTimeout); }, 'setTimeout is a function'); - if (typeof window !== 'undefined') { - t.doesNotThrow(function () { forEach(arr, window.alert); }, 'alert is a function'); - } - t.end(); -}); - -test('array', function (t) { - var arr = [1, 2, 3]; - - t.test('iterates over every item', function (st) { - var index = 0; - forEach(arr, function () { index += 1; }); - st.equal(index, arr.length, 'iterates ' + arr.length + ' times'); - st.end(); - }); - - t.test('first iterator argument', function (st) { - var index = 0; - st.plan(arr.length); - forEach(arr, function (item) { - st.equal(arr[index], item, 'item ' + index + ' is passed as first argument'); - index += 1; - }); - st.end(); - }); - - t.test('second iterator argument', function (st) { - var counter = 0; - st.plan(arr.length); - forEach(arr, function (item, index) { - st.equal(counter, index, 'index ' + index + ' is passed as second argument'); - counter += 1; - }); - st.end(); - }); - - t.test('third iterator argument', function (st) { - st.plan(arr.length); - forEach(arr, function (item, index, array) { - st.deepEqual(arr, array, 'array is passed as third argument'); - }); - st.end(); - }); - - t.test('context argument', function (st) { - var context = {}; - st.plan(arr.length); - forEach(arr, function () { - st.equal(this, context, '"this" is the passed context'); - }, context); - st.end(); - }); - - t.end(); -}); - -test('object', function (t) { - var obj = { - a: 1, - b: 2, - c: 3 - }; - var keys = ['a', 'b', 'c']; - - var F = function () { - this.a = 1; - this.b = 2; - }; - F.prototype.c = 3; - var fKeys = ['a', 'b']; - - t.test('iterates over every object literal key', function (st) { - var counter = 0; - forEach(obj, function () { counter += 1; }); - st.equal(counter, keys.length, 'iterated ' + counter + ' times'); - st.end(); - }); - - t.test('iterates only over own keys', function (st) { - var counter = 0; - forEach(new F(), function () { counter += 1; }); - st.equal(counter, fKeys.length, 'iterated ' + fKeys.length + ' times'); - st.end(); - }); - - t.test('first iterator argument', function (st) { - var index = 0; - st.plan(keys.length); - forEach(obj, function (item) { - st.equal(obj[keys[index]], item, 'item at key ' + keys[index] + ' is passed as first argument'); - index += 1; - }); - st.end(); - }); - - t.test('second iterator argument', function (st) { - var counter = 0; - st.plan(keys.length); - forEach(obj, function (item, key) { - st.equal(keys[counter], key, 'key ' + key + ' is passed as second argument'); - counter += 1; - }); - st.end(); - }); - - t.test('third iterator argument', function (st) { - st.plan(keys.length); - forEach(obj, function (item, key, object) { - st.deepEqual(obj, object, 'object is passed as third argument'); - }); - st.end(); - }); - - t.test('context argument', function (st) { - var context = {}; - st.plan(1); - forEach({foo: 'bar'}, function () { - st.equal(this, context, '"this" is the passed context'); - }, context); - st.end(); - }); - - t.end(); -}); - - -test('string', function (t) { - var str = 'str'; - t.test('second iterator argument', function (st) { - var counter = 0; - st.plan(str.length * 2 + 1); - forEach(str, function (item, index) { - st.equal(counter, index, 'index ' + index + ' is passed as second argument'); - st.equal(str.charAt(index), item); - counter += 1; - }); - st.equal(counter, str.length, 'iterates ' + str.length + ' times'); - }); - t.end(); -}); - diff --git a/node_modules/object-keys/test/index.js b/node_modules/object-keys/test/index.js index 8b77b1fce..5402465a1 100644 --- a/node_modules/object-keys/test/index.js +++ b/node_modules/object-keys/test/index.js @@ -1,6 +1,5 @@ +'use strict'; -require('./foreach'); require('./isArguments'); require('./shim'); - diff --git a/node_modules/object-keys/test/isArguments.js b/node_modules/object-keys/test/isArguments.js deleted file mode 100644 index 62a07c2d8..000000000 --- a/node_modules/object-keys/test/isArguments.js +++ /dev/null @@ -1,10 +0,0 @@ -var test = require('tape'); -var isArguments = require('../isArguments'); - -test('is.arguments', function (t) { - t.notOk(isArguments([]), 'array is not arguments'); - (function () { t.ok(isArguments(arguments), 'arguments is arguments'); }()); - (function () { t.notOk(isArguments(Array.prototype.slice.call(arguments)), 'sliced arguments is not arguments'); }()); - t.end(); -}); - diff --git a/node_modules/object-keys/test/shim.js b/node_modules/object-keys/test/shim.js deleted file mode 100644 index 9d9327127..000000000 --- a/node_modules/object-keys/test/shim.js +++ /dev/null @@ -1,134 +0,0 @@ -var test = require('tape'); -var shimmedKeys = require('../index.js'); -var is = require('is'); -var keys = require('../shim.js'); -var forEach = require('foreach'); -var indexOf = require('indexof'); - -var obj = { - "str": "boz", - "obj": {}, - "arr": [], - "bool": true, - "num": 42, - "aNull": null, - "undef": undefined -}; -var objKeys = ['str', 'obj', 'arr', 'bool', 'num', 'aNull', 'undef']; - -test('exports a function', function (t) { - if (Object.keys) { - t.equal(Object.keys, shimmedKeys, 'Object.keys is supported and exported'); - } else { - t.equal(keys, shimmedKeys, 'Object.keys is not supported; shim is exported'); - } - t.end(); -}); - -test('working with actual shim', function (t) { - t.notEqual(Object.keys, keys, 'keys shim is not native Object.keys'); - t.end(); -}); - -test('works with an object literal', function (t) { - var theKeys = keys(obj); - t.equal(is.array(theKeys), true, 'returns an array'); - t.deepEqual(theKeys, objKeys, 'Object has expected keys'); - t.end(); -}); - -test('works with an array', function (t) { - var arr = [1, 2, 3]; - var theKeys = keys(arr); - t.equal(is.array(theKeys), true, 'returns an array'); - t.deepEqual(theKeys, ['0', '1', '2'], 'Array has expected keys'); - t.end(); -}); - -test('works with a function', function (t) { - var foo = function () {}; - foo.a = true; - - t.doesNotThrow(function () { return keys(foo); }, 'does not throw an error'); - t.deepEqual(keys(foo), ['a'], 'returns expected keys'); - t.end(); -}); - -test('returns names which are own properties', function (t) { - forEach(keys(obj), function (name) { - t.equal(obj.hasOwnProperty(name), true, name + ' should be returned'); - }); - t.end(); -}); - -test('returns names which are enumerable', function (t) { - var k, loopedValues = []; - for (k in obj) { - loopedValues.push(k); - } - forEach(keys(obj), function (name) { - t.notEqual(indexOf(loopedValues, name), -1, name + ' is not enumerable'); - }); - t.end(); -}); - -test('throws an error for a non-object', function (t) { - t.throws( - function () { return keys(42); }, - new TypeError('Object.keys called on a non-object'), - 'throws on a non-object' - ); - t.end(); -}); - -test('works with an object instance', function (t) { - var Prototype = function () {}; - Prototype.prototype.foo = true; - var obj = new Prototype(); - obj.bar = true; - var theKeys = keys(obj); - t.equal(is.array(theKeys), true, 'returns an array'); - t.deepEqual(theKeys, ['bar'], 'Instance has expected keys'); - t.end(); -}); - -test('works in iOS 5 mobile Safari', function (t) { - var Foo = function () {}; - Foo.a = function () {}; - - // the bug is keys(Foo) => ['a', 'prototype'] instead of ['a'] - t.deepEqual(keys(Foo), ['a'], 'has expected keys'); - t.end(); -}); - -test('works in environments with the dontEnum bug (IE < 9)', function (t) { - var Foo = function () {}; - Foo.prototype.a = function () {}; - - // the bug is keys(Foo.prototype) => ['a', 'constructor'] instead of ['a'] - t.deepEqual(keys(Foo.prototype), ['a'], 'has expected keys'); - t.end(); -}); - -test('shadowed properties', function (t) { - var shadowedProps = [ - 'dummyControlProp', /* just to be sure */ - 'constructor', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'toLocaleString', - 'toString', - 'valueOf' - ]; - shadowedProps.sort(); - var shadowedObject = {}; - forEach(shadowedProps, function (value, index) { - shadowedObject[value] = index; - }); - var shadowedObjectKeys = keys(shadowedObject); - shadowedObjectKeys.sort(); - t.deepEqual(shadowedObjectKeys, shadowedProps, 'troublesome shadowed properties are keys of object literals'); - t.end(); -}); - -- cgit v1.2.3