tools: update ESLint to 5.4.0

Update ESLint from 5.3.0 to 5.4.0.

PR-URL: https://github.com/nodejs/node/pull/22454
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
This commit is contained in:
Rich Trott 2018-08-21 20:20:52 -07:00
parent 85c356c10e
commit adaaba0094
135 changed files with 247 additions and 4882 deletions

View File

@ -30,7 +30,6 @@ const fs = require("fs"),
pkg = require("../package.json");
const debug = require("debug")("eslint:cli-engine");
const resolver = new ModuleResolver();
//------------------------------------------------------------------------------
@ -469,7 +468,7 @@ class CLIEngine {
* @returns {void}
*/
static outputFixes(report) {
report.results.filter(result => result.hasOwnProperty("output")).forEach(result => {
report.results.filter(result => Object.prototype.hasOwnProperty.call(result, "output")).forEach(result => {
fs.writeFileSync(result.filePath, result.output);
});
}

View File

@ -1,4 +0,0 @@
rules:
rulesdir/no-invalid-meta: "error"
rulesdir/consistent-docs-description: "error"
rulesdir/consistent-docs-url: "error"

View File

@ -58,7 +58,7 @@ module.exports = {
NewExpression: true
};
if (context.options.length === 2 && context.options[1].hasOwnProperty("exceptions")) {
if (context.options.length === 2 && Object.prototype.hasOwnProperty.call(context.options[1], "exceptions")) {
const keys = Object.keys(context.options[1].exceptions);
for (let i = 0; i < keys.length; i++) {

View File

@ -61,10 +61,10 @@ module.exports = {
const option = context.options[0];
let THRESHOLD = 20;
if (typeof option === "object" && option.hasOwnProperty("maximum") && typeof option.maximum === "number") {
if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "maximum") && typeof option.maximum === "number") {
THRESHOLD = option.maximum;
}
if (typeof option === "object" && option.hasOwnProperty("max") && typeof option.max === "number") {
if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "max") && typeof option.max === "number") {
THRESHOLD = option.max;
}
if (typeof option === "number") {

View File

@ -1333,7 +1333,9 @@ module.exports = {
node.expressions.forEach((expression, index) => {
const previousQuasi = node.quasis[index];
const nextQuasi = node.quasis[index + 1];
const tokenToAlignFrom = previousQuasi.loc.start.line === previousQuasi.loc.end.line ? sourceCode.getFirstToken(previousQuasi) : null;
const tokenToAlignFrom = previousQuasi.loc.start.line === previousQuasi.loc.end.line
? sourceCode.getFirstToken(previousQuasi)
: null;
offsets.setDesiredOffsets([previousQuasi.range[1], nextQuasi.range[0]], tokenToAlignFrom, 1);
offsets.setDesiredOffset(sourceCode.getFirstToken(nextQuasi), tokenToAlignFrom, 0);
@ -1341,7 +1343,9 @@ module.exports = {
},
VariableDeclaration(node) {
const variableIndent = options.VariableDeclarator.hasOwnProperty(node.kind) ? options.VariableDeclarator[node.kind] : DEFAULT_VARIABLE_INDENT;
const variableIndent = Object.prototype.hasOwnProperty.call(options.VariableDeclarator, node.kind)
? options.VariableDeclarator[node.kind]
: DEFAULT_VARIABLE_INDENT;
if (node.declarations[node.declarations.length - 1].loc.start.line > node.loc.start.line) {

View File

@ -62,7 +62,7 @@ module.exports = {
above = !options.position || options.position === "above";
ignorePattern = options.ignorePattern;
if (options.hasOwnProperty("applyDefaultIgnorePatterns")) {
if (Object.prototype.hasOwnProperty.call(options, "applyDefaultIgnorePatterns")) {
applyDefaultIgnorePatterns = options.applyDefaultIgnorePatterns !== false;
} else {
applyDefaultIgnorePatterns = options.applyDefaultPatterns !== false;

View File

@ -54,10 +54,10 @@ module.exports = {
option = context.options[0];
let maxDepth = 4;
if (typeof option === "object" && option.hasOwnProperty("maximum") && typeof option.maximum === "number") {
if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "maximum") && typeof option.maximum === "number") {
maxDepth = option.maximum;
}
if (typeof option === "object" && option.hasOwnProperty("max") && typeof option.max === "number") {
if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "max") && typeof option.max === "number") {
maxDepth = option.max;
}
if (typeof option === "number") {

View File

@ -56,7 +56,7 @@ module.exports = {
const option = context.options[0];
let max = 300;
if (typeof option === "object" && option.hasOwnProperty("max") && typeof option.max === "number") {
if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "max") && typeof option.max === "number") {
max = option.max;
}

View File

@ -52,10 +52,10 @@ module.exports = {
const option = context.options[0];
let THRESHOLD = 10;
if (typeof option === "object" && option.hasOwnProperty("maximum") && typeof option.maximum === "number") {
if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "maximum") && typeof option.maximum === "number") {
THRESHOLD = option.maximum;
}
if (typeof option === "object" && option.hasOwnProperty("max") && typeof option.max === "number") {
if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "max") && typeof option.max === "number") {
THRESHOLD = option.max;
}
if (typeof option === "number") {

View File

@ -57,10 +57,10 @@ module.exports = {
const option = context.options[0];
let numParams = 3;
if (typeof option === "object" && option.hasOwnProperty("maximum") && typeof option.maximum === "number") {
if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "maximum") && typeof option.maximum === "number") {
numParams = option.maximum;
}
if (typeof option === "object" && option.hasOwnProperty("max") && typeof option.max === "number") {
if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "max") && typeof option.max === "number") {
numParams = option.max;
}
if (typeof option === "number") {

View File

@ -73,10 +73,10 @@ module.exports = {
topLevelFunctions = [];
let maxStatements = 10;
if (typeof option === "object" && option.hasOwnProperty("maximum") && typeof option.maximum === "number") {
if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "maximum") && typeof option.maximum === "number") {
maxStatements = option.maximum;
}
if (typeof option === "object" && option.hasOwnProperty("max") && typeof option.max === "number") {
if (typeof option === "object" && Object.prototype.hasOwnProperty.call(option, "max") && typeof option.max === "number") {
maxStatements = option.max;
}
if (typeof option === "number") {

View File

@ -58,7 +58,7 @@ module.exports = {
},
messages: {
unexpected: "Gratuitous parentheses around expression."
unexpected: "Unnecessary parentheses around expression."
}
},

View File

@ -94,7 +94,7 @@ module.exports = {
* @private
*/
function isRestricted(name) {
return restrictedGlobalMessages.hasOwnProperty(name);
return Object.prototype.hasOwnProperty.call(restrictedGlobalMessages, name);
}
return {

View File

@ -83,7 +83,7 @@ module.exports = {
const options = Array.isArray(context.options) ? context.options : [];
const isPathAndPatternsObject =
typeof options[0] === "object" &&
(options[0].hasOwnProperty("paths") || options[0].hasOwnProperty("patterns"));
(Object.prototype.hasOwnProperty.call(options[0], "paths") || Object.prototype.hasOwnProperty.call(options[0], "patterns"));
const restrictedPaths = (isPathAndPatternsObject ? options[0].paths : context.options) || [];
const restrictedPatterns = (isPathAndPatternsObject ? options[0].patterns : []) || [];

View File

@ -77,7 +77,7 @@ module.exports = {
const options = Array.isArray(context.options) ? context.options : [];
const isPathAndPatternsObject =
typeof options[0] === "object" &&
(options[0].hasOwnProperty("paths") || options[0].hasOwnProperty("patterns"));
(Object.prototype.hasOwnProperty.call(options[0], "paths") || Object.prototype.hasOwnProperty.call(options[0], "patterns"));
const restrictedPaths = (isPathAndPatternsObject ? options[0].paths : context.options) || [];
const restrictedPatterns = (isPathAndPatternsObject ? options[0].patterns : []) || [];

View File

@ -74,19 +74,19 @@ module.exports = {
options.let = { uninitialized: mode, initialized: mode };
options.const = { uninitialized: mode, initialized: mode };
} else if (typeof mode === "object") { // options configuration is an object
if (mode.hasOwnProperty("separateRequires")) {
if (Object.prototype.hasOwnProperty.call(mode, "separateRequires")) {
options.separateRequires = !!mode.separateRequires;
}
if (mode.hasOwnProperty("var")) {
if (Object.prototype.hasOwnProperty.call(mode, "var")) {
options.var = { uninitialized: mode.var, initialized: mode.var };
}
if (mode.hasOwnProperty("let")) {
if (Object.prototype.hasOwnProperty.call(mode, "let")) {
options.let = { uninitialized: mode.let, initialized: mode.let };
}
if (mode.hasOwnProperty("const")) {
if (Object.prototype.hasOwnProperty.call(mode, "const")) {
options.const = { uninitialized: mode.const, initialized: mode.const };
}
if (mode.hasOwnProperty("uninitialized")) {
if (Object.prototype.hasOwnProperty.call(mode, "uninitialized")) {
if (!options.var) {
options.var = {};
}
@ -100,7 +100,7 @@ module.exports = {
options.let.uninitialized = mode.uninitialized;
options.const.uninitialized = mode.uninitialized;
}
if (mode.hasOwnProperty("initialized")) {
if (Object.prototype.hasOwnProperty.call(mode, "initialized")) {
if (!options.var) {
options.var = {};
}

View File

@ -58,13 +58,13 @@ module.exports = {
options.switches = shouldHavePadding;
options.classes = shouldHavePadding;
} else {
if (config.hasOwnProperty("blocks")) {
if (Object.prototype.hasOwnProperty.call(config, "blocks")) {
options.blocks = config.blocks === "always";
}
if (config.hasOwnProperty("switches")) {
if (Object.prototype.hasOwnProperty.call(config, "switches")) {
options.switches = config.switches === "always";
}
if (config.hasOwnProperty("classes")) {
if (Object.prototype.hasOwnProperty.call(config, "classes")) {
options.classes = config.classes === "always";
}
}
@ -225,7 +225,7 @@ module.exports = {
const rule = {};
if (options.hasOwnProperty("switches")) {
if (Object.prototype.hasOwnProperty.call(options, "switches")) {
rule.SwitchStatement = function(node) {
if (node.cases.length === 0) {
return;
@ -234,7 +234,7 @@ module.exports = {
};
}
if (options.hasOwnProperty("blocks")) {
if (Object.prototype.hasOwnProperty.call(options, "blocks")) {
rule.BlockStatement = function(node) {
if (node.body.length === 0) {
return;
@ -243,7 +243,7 @@ module.exports = {
};
}
if (options.hasOwnProperty("classes")) {
if (Object.prototype.hasOwnProperty.call(options, "classes")) {
rule.ClassBody = function(node) {
if (node.body.length === 0) {
return;

View File

@ -98,7 +98,7 @@ module.exports = {
CallExpression(node) {
const methodName = (node.callee.property || {}).name;
const isReflectCall = (node.callee.object || {}).name === "Reflect";
const hasReflectSubsitute = reflectSubsitutes.hasOwnProperty(methodName);
const hasReflectSubsitute = Object.prototype.hasOwnProperty.call(reflectSubsitutes, methodName);
const userConfiguredException = exceptions.indexOf(methodName) !== -1;
if (hasReflectSubsitute && !isReflectCall && !userConfiguredException) {

View File

@ -46,10 +46,10 @@ module.exports = {
requireSpaceAfter = true;
if (typeof config === "object") {
if (config.hasOwnProperty("before")) {
if (Object.prototype.hasOwnProperty.call(config, "before")) {
requireSpaceBefore = config.before;
}
if (config.hasOwnProperty("after")) {
if (Object.prototype.hasOwnProperty.call(config, "after")) {
requireSpaceAfter = config.after;
}
}

View File

@ -72,7 +72,7 @@ module.exports = {
* @returns {boolean} Whether or not an override has been provided for the operator
*/
function overrideExistsForOperator(operator) {
return options.overrides && options.overrides.hasOwnProperty(operator);
return options.overrides && Object.prototype.hasOwnProperty.call(options.overrides, operator);
}
/**

View File

@ -322,7 +322,7 @@ module.exports = {
}
// check tag preferences
if (prefer.hasOwnProperty(tag.title) && tag.title !== prefer[tag.title]) {
if (Object.prototype.hasOwnProperty.call(prefer, tag.title) && tag.title !== prefer[tag.title]) {
const entireTagRange = getAbsoluteRange(jsdocNode, tag);
context.report({

View File

@ -533,19 +533,19 @@ class RuleTester {
assert.strictEqual(message.nodeType, error.type, `Error type should be ${error.type}, found ${message.nodeType}`);
}
if (error.hasOwnProperty("line")) {
if (Object.prototype.hasOwnProperty.call(error, "line")) {
assert.strictEqual(message.line, error.line, `Error line should be ${error.line}`);
}
if (error.hasOwnProperty("column")) {
if (Object.prototype.hasOwnProperty.call(error, "column")) {
assert.strictEqual(message.column, error.column, `Error column should be ${error.column}`);
}
if (error.hasOwnProperty("endLine")) {
if (Object.prototype.hasOwnProperty.call(error, "endLine")) {
assert.strictEqual(message.endLine, error.endLine, `Error endLine should be ${error.endLine}`);
}
if (error.hasOwnProperty("endColumn")) {
if (Object.prototype.hasOwnProperty.call(error, "endColumn")) {
assert.strictEqual(message.endColumn, error.endColumn, `Error endColumn should be ${error.endColumn}`);
}
} else {
@ -556,7 +556,7 @@ class RuleTester {
}
}
if (item.hasOwnProperty("output")) {
if (Object.prototype.hasOwnProperty.call(item, "output")) {
if (item.output === null) {
assert.strictEqual(
messages.filter(message => message.fix).length,

View File

@ -89,7 +89,7 @@ class FileFinder {
? path.resolve(this.cwd, relativeDirectory)
: this.cwd;
if (cache.hasOwnProperty(initialDirectory)) {
if (Object.prototype.hasOwnProperty.call(cache, initialDirectory)) {
yield* cache[initialDirectory];
return; // to avoid doing the normal loop afterwards
}
@ -130,7 +130,7 @@ class FileFinder {
return;
}
} while (!cache.hasOwnProperty(directory));
} while (!Object.prototype.hasOwnProperty.call(cache, directory));
// Add what has been cached previously to the cache of each directory searched.
for (let i = 0; i < searched; i++) {

View File

@ -109,7 +109,7 @@ class LintResultCache {
* @returns {void}
*/
setCachedLintResults(filePath, result) {
if (result && result.hasOwnProperty("output")) {
if (result && Object.prototype.hasOwnProperty.call(result, "output")) {
return;
}
@ -125,7 +125,7 @@ class LintResultCache {
* In `getCachedLintResults`, if source is explicitly null, we will
* read the file from the filesystem to set the value again.
*/
if (resultToSerialize.hasOwnProperty("source")) {
if (Object.prototype.hasOwnProperty.call(resultToSerialize, "source")) {
resultToSerialize.source = null;
}

View File

@ -107,7 +107,7 @@ SourceCodeFixer.applyFixes = function(sourceText, messages, shouldFix) {
}
messages.forEach(problem => {
if (problem.hasOwnProperty("fix")) {
if (Object.prototype.hasOwnProperty.call(problem, "fix")) {
fixes.push(problem);
} else {
remainingMessages.push(problem);

View File

@ -1221,6 +1221,7 @@ If you have published a useful plugin please submit a PR to add it to the next s
## Related packages
- [ajv-async](https://github.com/epoberezkin/ajv-async) - plugin to configure async validation mode
- [ajv-bsontype](https://github.com/BoLaMN/ajv-bsontype) - plugin to validate mongodb's bsonType formats
- [ajv-cli](https://github.com/jessedc/ajv-cli) - command line interface
- [ajv-errors](https://github.com/epoberezkin/ajv-errors) - plugin for custom error messages
- [ajv-i18n](https://github.com/epoberezkin/ajv-i18n) - internationalised error messages

File diff suppressed because one or more lines are too long

View File

@ -103,7 +103,7 @@ declare namespace ajv {
* @param {object} options optional options with properties `separator` and `dataVar`.
* @return {string} human readable string with all errors descriptions
*/
errorsText(errors?: Array<ErrorObject>, options?: ErrorsTextOptions): string;
errorsText(errors?: Array<ErrorObject> | null, options?: ErrorsTextOptions): string;
errors?: Array<ErrorObject>;
}

View File

@ -10,7 +10,7 @@
"fast-deep-equal": "^2.0.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.1"
"uri-js": "^4.2.2"
},
"deprecated": false,
"description": "Another JSON Schema Validator",
@ -30,7 +30,7 @@
"js-beautify": "^1.7.3",
"jshint": "^2.9.4",
"json-schema-test": "^2.0.0",
"karma": "^2.0.2",
"karma": "^3.0.0",
"karma-chrome-launcher": "^2.0.0",
"karma-mocha": "^1.1.1",
"karma-phantomjs-launcher": "^1.0.0",
@ -98,5 +98,5 @@
},
"tonicExampleFilename": ".tonic_example.js",
"typings": "lib/ajv.d.ts",
"version": "6.5.2"
"version": "6.5.3"
}

View File

@ -104,7 +104,7 @@ function supportsColor(stream) {
return 2;
}
if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
return 1;
}

View File

@ -15,9 +15,9 @@
"deprecated": false,
"description": "Detect whether a terminal supports color",
"devDependencies": {
"ava": "*",
"ava": "^0.25.0",
"import-fresh": "^2.0.0",
"xo": "*"
"xo": "^0.20.0"
},
"engines": {
"node": ">=4"
@ -58,5 +58,5 @@
"scripts": {
"test": "xo && ava"
},
"version": "5.4.0"
"version": "5.5.0"
}

View File

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (C) 2015 Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,86 +0,0 @@
#define-properties <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![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]
[![npm badge][npm-badge-png]][package-url]
[![browser support][testling-svg]][testling-url]
Define multiple non-enumerable properties at once. Uses `Object.defineProperty` when available; falls back to standard assignment in older engines.
Existing properties are not overridden. Accepts a map of property names to a predicate that, when true, force-overrides.
## Example
```js
var define = require('define-properties');
var assert = require('assert');
var obj = define({ a: 1, b: 2 }, {
a: 10,
b: 20,
c: 30
});
assert(obj.a === 1);
assert(obj.b === 2);
assert(obj.c === 30);
if (define.supportsDescriptors) {
assert.deepEqual(Object.keys(obj), ['a', 'b']);
assert.deepEqual(Object.getOwnPropertyDescriptor(obj, 'c'), {
configurable: true,
enumerable: false,
value: 30,
writable: false
});
}
```
Then, with predicates:
```js
var define = require('define-properties');
var assert = require('assert');
var obj = define({ a: 1, b: 2, c: 3 }, {
a: 10,
b: 20,
c: 30
}, {
a: function () { return false; },
b: function () { return true; }
});
assert(obj.a === 1);
assert(obj.b === 20);
assert(obj.c === 3);
if (define.supportsDescriptors) {
assert.deepEqual(Object.keys(obj), ['a', 'c']);
assert.deepEqual(Object.getOwnPropertyDescriptor(obj, 'b'), {
configurable: true,
enumerable: false,
value: 20,
writable: false
});
}
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/define-properties
[npm-version-svg]: http://versionbadg.es/ljharb/define-properties.svg
[travis-svg]: https://travis-ci.org/ljharb/define-properties.svg
[travis-url]: https://travis-ci.org/ljharb/define-properties
[deps-svg]: https://david-dm.org/ljharb/define-properties.svg
[deps-url]: https://david-dm.org/ljharb/define-properties
[dev-deps-svg]: https://david-dm.org/ljharb/define-properties/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/define-properties#info=devDependencies
[testling-svg]: https://ci.testling.com/ljharb/define-properties.png
[testling-url]: https://ci.testling.com/ljharb/define-properties
[npm-badge-png]: https://nodei.co/npm/define-properties.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/define-properties.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/define-properties.svg
[downloads-url]: http://npm-stat.com/charts.html?package=define-properties

View File

@ -1,56 +0,0 @@
'use strict';
var keys = require('object-keys');
var foreach = require('foreach');
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
var toStr = Object.prototype.toString;
var isFunction = function (fn) {
return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
};
var arePropertyDescriptorsSupported = function () {
var obj = {};
try {
Object.defineProperty(obj, 'x', { enumerable: false, value: obj });
/* eslint-disable no-unused-vars, no-restricted-syntax */
for (var _ in obj) { return false; }
/* eslint-enable no-unused-vars, no-restricted-syntax */
return obj.x === obj;
} catch (e) { /* this is IE 8. */
return false;
}
};
var supportsDescriptors = Object.defineProperty && arePropertyDescriptorsSupported();
var defineProperty = function (object, name, value, predicate) {
if (name in object && (!isFunction(predicate) || !predicate())) {
return;
}
if (supportsDescriptors) {
Object.defineProperty(object, name, {
configurable: true,
enumerable: false,
value: value,
writable: true
});
} else {
object[name] = value;
}
};
var defineProperties = function (object, map) {
var predicates = arguments.length > 2 ? arguments[2] : {};
var props = keys(map);
if (hasSymbols) {
props = props.concat(Object.getOwnPropertySymbols(map));
}
foreach(props, function (name) {
defineProperty(object, name, map[name], predicates[name]);
});
};
defineProperties.supportsDescriptors = !!supportsDescriptors;
module.exports = defineProperties;

View File

@ -1,73 +0,0 @@
{
"author": {
"name": "Jordan Harband"
},
"bugs": {
"url": "https://github.com/ljharb/define-properties/issues"
},
"bundleDependencies": false,
"dependencies": {
"foreach": "^2.0.5",
"object-keys": "^1.0.8"
},
"deprecated": false,
"description": "Define multiple non-enumerable properties at once. Uses `Object.defineProperty` when available; falls back to standard assignment in older engines.",
"devDependencies": {
"@ljharb/eslint-config": "^1.3.0",
"covert": "^1.1.0",
"editorconfig-tools": "^0.1.1",
"eslint": "^1.6.0",
"jscs": "^2.3.1",
"nsp": "^1.1.0",
"tape": "^4.2.1"
},
"engines": {
"node": ">= 0.4"
},
"homepage": "https://github.com/ljharb/define-properties#readme",
"keywords": [
"Object.defineProperty",
"Object.defineProperties",
"object",
"property descriptor",
"descriptor",
"define",
"ES5"
],
"license": "MIT",
"main": "index.js",
"name": "define-properties",
"repository": {
"type": "git",
"url": "git://github.com/ljharb/define-properties.git"
},
"scripts": {
"coverage": "covert test/*.js",
"coverage-quiet": "covert test/*.js --quiet",
"eccheck": "editorconfig-tools check *.js **/*.js > /dev/null",
"eslint": "eslint test/*.js *.js",
"jscs": "jscs test/*.js *.js",
"lint": "npm run jscs && npm run eslint",
"security": "nsp package",
"test": "npm run lint && node test/index.js && npm run security"
},
"testling": {
"files": "test/index.js",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/10.0..latest",
"opera/next",
"safari/4.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"version": "1.1.2"
}

View File

@ -1,14 +0,0 @@
{
"all": true,
"check-coverage": true,
"reporter": ["text-summary", "text", "html", "json"],
"lines": 87.03,
"statements": 86.87,
"functions": 82.43,
"branches": 76.06,
"exclude": [
"coverage",
"operations",
"test"
]
}

View File

@ -1,177 +0,0 @@
'use strict';
/* globals
Set,
Map,
WeakSet,
WeakMap,
Promise,
Symbol,
Proxy,
Atomics,
SharedArrayBuffer,
ArrayBuffer,
DataView,
Uint8Array,
Float32Array,
Float64Array,
Int8Array,
Int16Array,
Int32Array,
Uint8ClampedArray,
Uint16Array,
Uint32Array,
*/
var undefined; // eslint-disable-line no-shadow-restricted-names
var ThrowTypeError = Object.getOwnPropertyDescriptor
? (function () { return Object.getOwnPropertyDescriptor(arguments, 'callee').get; }())
: function () { throw new TypeError(); };
var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';
var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
var generator; // = function * () {};
var generatorFunction = generator ? getProto(generator) : undefined;
var asyncFn; // async function() {};
var asyncFunction = asyncFn ? asyncFn.constructor : undefined;
var asyncGen; // async function * () {};
var asyncGenFunction = asyncGen ? getProto(asyncGen) : undefined;
var asyncGenIterator = asyncGen ? asyncGen() : undefined;
var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
var INTRINSICS = {
'$ %Array%': Array,
'$ %ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
'$ %ArrayBufferPrototype%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer.prototype,
'$ %ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
'$ %ArrayPrototype%': Array.prototype,
'$ %ArrayProto_entries%': Array.prototype.entries,
'$ %ArrayProto_forEach%': Array.prototype.forEach,
'$ %ArrayProto_keys%': Array.prototype.keys,
'$ %ArrayProto_values%': Array.prototype.values,
'$ %AsyncFromSyncIteratorPrototype%': undefined,
'$ %AsyncFunction%': asyncFunction,
'$ %AsyncFunctionPrototype%': asyncFunction ? asyncFunction.prototype : undefined,
'$ %AsyncGenerator%': asyncGen ? getProto(asyncGenIterator) : undefined,
'$ %AsyncGeneratorFunction%': asyncGenFunction,
'$ %AsyncGeneratorPrototype%': asyncGenFunction ? asyncGenFunction.prototype : undefined,
'$ %AsyncIteratorPrototype%': asyncGenIterator && hasSymbols && Symbol.asyncIterator ? asyncGenIterator[Symbol.asyncIterator]() : undefined,
'$ %Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
'$ %Boolean%': Boolean,
'$ %BooleanPrototype%': Boolean.prototype,
'$ %DataView%': typeof DataView === 'undefined' ? undefined : DataView,
'$ %DataViewPrototype%': typeof DataView === 'undefined' ? undefined : DataView.prototype,
'$ %Date%': Date,
'$ %DatePrototype%': Date.prototype,
'$ %decodeURI%': decodeURI,
'$ %decodeURIComponent%': decodeURIComponent,
'$ %encodeURI%': encodeURI,
'$ %encodeURIComponent%': encodeURIComponent,
'$ %Error%': Error,
'$ %ErrorPrototype%': Error.prototype,
'$ %eval%': eval, // eslint-disable-line no-eval
'$ %EvalError%': EvalError,
'$ %EvalErrorPrototype%': EvalError.prototype,
'$ %Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
'$ %Float32ArrayPrototype%': typeof Float32Array === 'undefined' ? undefined : Float32Array.prototype,
'$ %Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
'$ %Float64ArrayPrototype%': typeof Float64Array === 'undefined' ? undefined : Float64Array.prototype,
'$ %Function%': Function,
'$ %FunctionPrototype%': Function.prototype,
'$ %Generator%': generator ? getProto(generator()) : undefined,
'$ %GeneratorFunction%': generatorFunction,
'$ %GeneratorPrototype%': generatorFunction ? generatorFunction.prototype : undefined,
'$ %Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
'$ %Int8ArrayPrototype%': typeof Int8Array === 'undefined' ? undefined : Int8Array.prototype,
'$ %Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
'$ %Int16ArrayPrototype%': typeof Int16Array === 'undefined' ? undefined : Int8Array.prototype,
'$ %Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
'$ %Int32ArrayPrototype%': typeof Int32Array === 'undefined' ? undefined : Int32Array.prototype,
'$ %isFinite%': isFinite,
'$ %isNaN%': isNaN,
'$ %IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
'$ %JSON%': JSON,
'$ %JSONParse%': JSON.parse,
'$ %Map%': typeof Map === 'undefined' ? undefined : Map,
'$ %MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
'$ %MapPrototype%': typeof Map === 'undefined' ? undefined : Map.prototype,
'$ %Math%': Math,
'$ %Number%': Number,
'$ %NumberPrototype%': Number.prototype,
'$ %Object%': Object,
'$ %ObjectPrototype%': Object.prototype,
'$ %ObjProto_toString%': Object.prototype.toString,
'$ %ObjProto_valueOf%': Object.prototype.valueOf,
'$ %parseFloat%': parseFloat,
'$ %parseInt%': parseInt,
'$ %Promise%': typeof Promise === 'undefined' ? undefined : Promise,
'$ %PromisePrototype%': typeof Promise === 'undefined' ? undefined : Promise.prototype,
'$ %PromiseProto_then%': typeof Promise === 'undefined' ? undefined : Promise.prototype.then,
'$ %Promise_all%': typeof Promise === 'undefined' ? undefined : Promise.all,
'$ %Promise_reject%': typeof Promise === 'undefined' ? undefined : Promise.reject,
'$ %Promise_resolve%': typeof Promise === 'undefined' ? undefined : Promise.resolve,
'$ %Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
'$ %RangeError%': RangeError,
'$ %RangeErrorPrototype%': RangeError.prototype,
'$ %ReferenceError%': ReferenceError,
'$ %ReferenceErrorPrototype%': ReferenceError.prototype,
'$ %Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
'$ %RegExp%': RegExp,
'$ %RegExpPrototype%': RegExp.prototype,
'$ %Set%': typeof Set === 'undefined' ? undefined : Set,
'$ %SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
'$ %SetPrototype%': typeof Set === 'undefined' ? undefined : Set.prototype,
'$ %SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
'$ %SharedArrayBufferPrototype%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer.prototype,
'$ %String%': String,
'$ %StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
'$ %StringPrototype%': String.prototype,
'$ %Symbol%': hasSymbols ? Symbol : undefined,
'$ %SymbolPrototype%': hasSymbols ? Symbol.prototype : undefined,
'$ %SyntaxError%': SyntaxError,
'$ %SyntaxErrorPrototype%': SyntaxError.prototype,
'$ %ThrowTypeError%': ThrowTypeError,
'$ %TypedArray%': TypedArray,
'$ %TypedArrayPrototype%': TypedArray ? TypedArray.prototype : undefined,
'$ %TypeError%': TypeError,
'$ %TypeErrorPrototype%': TypeError.prototype,
'$ %Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
'$ %Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array.prototype,
'$ %Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
'$ %Uint8ClampedArrayPrototype%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray.prototype,
'$ %Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
'$ %Uint16ArrayPrototype%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array.prototype,
'$ %Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
'$ %Uint32ArrayPrototype%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array.prototype,
'$ %URIError%': URIError,
'$ %URIErrorPrototype%': URIError.prototype,
'$ %WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
'$ %WeakMapPrototype%': typeof WeakMap === 'undefined' ? undefined : WeakMap.prototype,
'$ %WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet,
'$ %WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined : WeakSet.prototype
};
module.exports = function GetIntrinsic(name, allowMissing) {
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
throw new TypeError('"allowMissing" argument must be a boolean');
}
var key = '$ ' + name;
if (!(key in INTRINSICS)) {
throw new SyntaxError('intrinsic ' + name + ' does not exist!');
}
// istanbul ignore if // hopefully this is impossible to test :-)
if (typeof INTRINSICS[key] === 'undefined' && !allowMissing) {
throw new TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
}
return INTRINSICS[key];
};

View File

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (C) 2015 Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,61 +0,0 @@
# Since we rely on paths relative to the makefile location, abort if make isn't being run from there.
$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in))
# The files that need updating when incrementing the version number.
VERSIONED_FILES := *.js */*.js *.json README*
# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly.
# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment
# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests.
export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH")
UTILS := semver
# Make sure that all required utilities can be located.
UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS)))
# Default target (by virtue of being the first non '.'-prefixed in the file).
.PHONY: _no-target-specified
_no-target-specified:
$(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests)
# Lists all targets defined in this makefile.
.PHONY: list
list:
@$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort
# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS).
.PHONY: test
test:
@npm test
.PHONY: _ensure-tag
_ensure-tag:
ifndef TAG
$(error Please invoke with `make TAG=<new-version> release`, where <new-version> is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number)
endif
CHANGELOG_ERROR = $(error No CHANGELOG specified)
.PHONY: _ensure-changelog
_ensure-changelog:
@ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2)
# Ensures that the git workspace is clean.
.PHONY: _ensure-clean
_ensure-clean:
@[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; }
# Makes a release; invoke with `make TAG=<versionOrIncrementSpec> release`.
.PHONY: release
release: _ensure-tag _ensure-changelog _ensure-clean
@old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \
new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \
if printf "$$new_ver" | command grep -q '^[0-9]'; then \
semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \
semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \
else \
new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \
fi; \
printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \
replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \
git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \
git tag -a -m "v$$new_ver" "v$$new_ver"

View File

@ -1,44 +0,0 @@
# es-abstract <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![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]
[![npm badge][npm-badge-png]][package-url]
[![browser support][testling-svg]][testling-url]
ECMAScript spec abstract operations.
When different versions of the spec conflict, the default export will be the latest version of the abstract operation.
All abstract operations will also be available under an `es5`/`es2015`/`es2016` entry point, and exported property, if you require a specific version.
## Example
```js
var ES = require('es-abstract');
var assert = require('assert');
assert(ES.isCallable(function () {}));
assert(!ES.isCallable(/a/g));
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/es-abstract
[npm-version-svg]: http://versionbadg.es/ljharb/es-abstract.svg
[travis-svg]: https://travis-ci.org/ljharb/es-abstract.svg
[travis-url]: https://travis-ci.org/ljharb/es-abstract
[deps-svg]: https://david-dm.org/ljharb/es-abstract.svg
[deps-url]: https://david-dm.org/ljharb/es-abstract
[dev-deps-svg]: https://david-dm.org/ljharb/es-abstract/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/es-abstract#info=devDependencies
[testling-svg]: https://ci.testling.com/ljharb/es-abstract.png
[testling-url]: https://ci.testling.com/ljharb/es-abstract
[npm-badge-png]: https://nodei.co/npm/es-abstract.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/es-abstract.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/es-abstract.svg
[downloads-url]: https://npm-stat.com/charts.html?package=es-abstract

View File

@ -1,693 +0,0 @@
'use strict';
var has = require('has');
var toPrimitive = require('es-to-primitive/es6');
var GetIntrinsic = require('./GetIntrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $Array = GetIntrinsic('%Array%');
var $String = GetIntrinsic('%String%');
var $Object = GetIntrinsic('%Object%');
var $Number = GetIntrinsic('%Number%');
var $Symbol = GetIntrinsic('%Symbol%', true);
var $RegExp = GetIntrinsic('%RegExp%');
var hasSymbols = !!$Symbol;
var $isNaN = require('./helpers/isNaN');
var $isFinite = require('./helpers/isFinite');
var MAX_SAFE_INTEGER = $Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1;
var assign = require('./helpers/assign');
var sign = require('./helpers/sign');
var mod = require('./helpers/mod');
var isPrimitive = require('./helpers/isPrimitive');
var parseInteger = parseInt;
var bind = require('function-bind');
var arraySlice = bind.call(Function.call, $Array.prototype.slice);
var strSlice = bind.call(Function.call, $String.prototype.slice);
var isBinary = bind.call(Function.call, $RegExp.prototype.test, /^0b[01]+$/i);
var isOctal = bind.call(Function.call, $RegExp.prototype.test, /^0o[0-7]+$/i);
var regexExec = bind.call(Function.call, $RegExp.prototype.exec);
var nonWS = ['\u0085', '\u200b', '\ufffe'].join('');
var nonWSregex = new $RegExp('[' + nonWS + ']', 'g');
var hasNonWS = bind.call(Function.call, $RegExp.prototype.test, nonWSregex);
var invalidHexLiteral = /^[-+]0x[0-9a-f]+$/i;
var isInvalidHexLiteral = bind.call(Function.call, $RegExp.prototype.test, invalidHexLiteral);
var $charCodeAt = bind.call(Function.call, $String.prototype.charCodeAt);
var toStr = bind.call(Function.call, Object.prototype.toString);
var $floor = Math.floor;
var $abs = Math.abs;
var $ObjectCreate = Object.create;
var $gOPD = $Object.getOwnPropertyDescriptor;
var $isExtensible = $Object.isExtensible;
// whitespace from: http://es5.github.io/#x15.5.4.20
// implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324
var ws = [
'\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003',
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028',
'\u2029\uFEFF'
].join('');
var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g');
var replace = bind.call(Function.call, $String.prototype.replace);
var trim = function (value) {
return replace(value, trimRegex, '');
};
var ES5 = require('./es5');
var hasRegExpMatcher = require('is-regex');
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations
var ES6 = assign(assign({}, ES5), {
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-call-f-v-args
Call: function Call(F, V) {
var args = arguments.length > 2 ? arguments[2] : [];
if (!this.IsCallable(F)) {
throw new $TypeError(F + ' is not a function');
}
return F.apply(V, args);
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive
ToPrimitive: toPrimitive,
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean
// ToBoolean: ES5.ToBoolean,
// https://ecma-international.org/ecma-262/6.0/#sec-tonumber
ToNumber: function ToNumber(argument) {
var value = isPrimitive(argument) ? argument : toPrimitive(argument, $Number);
if (typeof value === 'symbol') {
throw new $TypeError('Cannot convert a Symbol value to a number');
}
if (typeof value === 'string') {
if (isBinary(value)) {
return this.ToNumber(parseInteger(strSlice(value, 2), 2));
} else if (isOctal(value)) {
return this.ToNumber(parseInteger(strSlice(value, 2), 8));
} else if (hasNonWS(value) || isInvalidHexLiteral(value)) {
return NaN;
} else {
var trimmed = trim(value);
if (trimmed !== value) {
return this.ToNumber(trimmed);
}
}
}
return $Number(value);
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger
// ToInteger: ES5.ToNumber,
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32
// ToInt32: ES5.ToInt32,
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32
// ToUint32: ES5.ToUint32,
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint16
ToInt16: function ToInt16(argument) {
var int16bit = this.ToUint16(argument);
return int16bit >= 0x8000 ? int16bit - 0x10000 : int16bit;
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint16
// ToUint16: ES5.ToUint16,
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint8
ToInt8: function ToInt8(argument) {
var int8bit = this.ToUint8(argument);
return int8bit >= 0x80 ? int8bit - 0x100 : int8bit;
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint8
ToUint8: function ToUint8(argument) {
var number = this.ToNumber(argument);
if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; }
var posInt = sign(number) * $floor($abs(number));
return mod(posInt, 0x100);
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint8clamp
ToUint8Clamp: function ToUint8Clamp(argument) {
var number = this.ToNumber(argument);
if ($isNaN(number) || number <= 0) { return 0; }
if (number >= 0xFF) { return 0xFF; }
var f = $floor(argument);
if (f + 0.5 < number) { return f + 1; }
if (number < f + 0.5) { return f; }
if (f % 2 !== 0) { return f + 1; }
return f;
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring
ToString: function ToString(argument) {
if (typeof argument === 'symbol') {
throw new $TypeError('Cannot convert a Symbol value to a string');
}
return $String(argument);
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject
ToObject: function ToObject(value) {
this.RequireObjectCoercible(value);
return $Object(value);
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey
ToPropertyKey: function ToPropertyKey(argument) {
var key = this.ToPrimitive(argument, $String);
return typeof key === 'symbol' ? key : this.ToString(key);
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
ToLength: function ToLength(argument) {
var len = this.ToInteger(argument);
if (len <= 0) { return 0; } // includes converting -0 to +0
if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; }
return len;
},
// https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring
CanonicalNumericIndexString: function CanonicalNumericIndexString(argument) {
if (toStr(argument) !== '[object String]') {
throw new $TypeError('must be a string');
}
if (argument === '-0') { return -0; }
var n = this.ToNumber(argument);
if (this.SameValue(this.ToString(n), argument)) { return n; }
return void 0;
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-requireobjectcoercible
RequireObjectCoercible: ES5.CheckObjectCoercible,
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray
IsArray: $Array.isArray || function IsArray(argument) {
return toStr(argument) === '[object Array]';
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable
// IsCallable: ES5.IsCallable,
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor
IsConstructor: function IsConstructor(argument) {
return typeof argument === 'function' && !!argument.prototype; // unfortunately there's no way to truly check this without try/catch `new argument`
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o
IsExtensible: Object.preventExtensions
? function IsExtensible(obj) {
if (isPrimitive(obj)) {
return false;
}
return $isExtensible(obj);
}
: function isExtensible(obj) { return true; }, // eslint-disable-line no-unused-vars
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isinteger
IsInteger: function IsInteger(argument) {
if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) {
return false;
}
var abs = $abs(argument);
return $floor(abs) === abs;
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey
IsPropertyKey: function IsPropertyKey(argument) {
return typeof argument === 'string' || typeof argument === 'symbol';
},
// https://ecma-international.org/ecma-262/6.0/#sec-isregexp
IsRegExp: function IsRegExp(argument) {
if (!argument || typeof argument !== 'object') {
return false;
}
if (hasSymbols) {
var isRegExp = argument[$Symbol.match];
if (typeof isRegExp !== 'undefined') {
return ES5.ToBoolean(isRegExp);
}
}
return hasRegExpMatcher(argument);
},
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue
// SameValue: ES5.SameValue,
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero
SameValueZero: function SameValueZero(x, y) {
return (x === y) || ($isNaN(x) && $isNaN(y));
},
/**
* 7.3.2 GetV (V, P)
* 1. Assert: IsPropertyKey(P) is true.
* 2. Let O be ToObject(V).
* 3. ReturnIfAbrupt(O).
* 4. Return O.[[Get]](P, V).
*/
GetV: function GetV(V, P) {
// 7.3.2.1
if (!this.IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
}
// 7.3.2.2-3
var O = this.ToObject(V);
// 7.3.2.4
return O[P];
},
/**
* 7.3.9 - https://ecma-international.org/ecma-262/6.0/#sec-getmethod
* 1. Assert: IsPropertyKey(P) is true.
* 2. Let func be GetV(O, P).
* 3. ReturnIfAbrupt(func).
* 4. If func is either undefined or null, return undefined.
* 5. If IsCallable(func) is false, throw a TypeError exception.
* 6. Return func.
*/
GetMethod: function GetMethod(O, P) {
// 7.3.9.1
if (!this.IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
}
// 7.3.9.2
var func = this.GetV(O, P);
// 7.3.9.4
if (func == null) {
return void 0;
}
// 7.3.9.5
if (!this.IsCallable(func)) {
throw new $TypeError(P + 'is not a function');
}
// 7.3.9.6
return func;
},
/**
* 7.3.1 Get (O, P) - https://ecma-international.org/ecma-262/6.0/#sec-get-o-p
* 1. Assert: Type(O) is Object.
* 2. Assert: IsPropertyKey(P) is true.
* 3. Return O.[[Get]](P, O).
*/
Get: function Get(O, P) {
// 7.3.1.1
if (this.Type(O) !== 'Object') {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
// 7.3.1.2
if (!this.IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
}
// 7.3.1.3
return O[P];
},
Type: function Type(x) {
if (typeof x === 'symbol') {
return 'Symbol';
}
return ES5.Type(x);
},
// https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor
SpeciesConstructor: function SpeciesConstructor(O, defaultConstructor) {
if (this.Type(O) !== 'Object') {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
var C = O.constructor;
if (typeof C === 'undefined') {
return defaultConstructor;
}
if (this.Type(C) !== 'Object') {
throw new $TypeError('O.constructor is not an Object');
}
var S = hasSymbols && $Symbol.species ? C[$Symbol.species] : void 0;
if (S == null) {
return defaultConstructor;
}
if (this.IsConstructor(S)) {
return S;
}
throw new $TypeError('no constructor found');
},
// https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor
CompletePropertyDescriptor: function CompletePropertyDescriptor(Desc) {
if (!this.IsPropertyDescriptor(Desc)) {
throw new $TypeError('Desc must be a Property Descriptor');
}
if (this.IsGenericDescriptor(Desc) || this.IsDataDescriptor(Desc)) {
if (!has(Desc, '[[Value]]')) {
Desc['[[Value]]'] = void 0;
}
if (!has(Desc, '[[Writable]]')) {
Desc['[[Writable]]'] = false;
}
} else {
if (!has(Desc, '[[Get]]')) {
Desc['[[Get]]'] = void 0;
}
if (!has(Desc, '[[Set]]')) {
Desc['[[Set]]'] = void 0;
}
}
if (!has(Desc, '[[Enumerable]]')) {
Desc['[[Enumerable]]'] = false;
}
if (!has(Desc, '[[Configurable]]')) {
Desc['[[Configurable]]'] = false;
}
return Desc;
},
// https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw
Set: function Set(O, P, V, Throw) {
if (this.Type(O) !== 'Object') {
throw new $TypeError('O must be an Object');
}
if (!this.IsPropertyKey(P)) {
throw new $TypeError('P must be a Property Key');
}
if (this.Type(Throw) !== 'Boolean') {
throw new $TypeError('Throw must be a Boolean');
}
if (Throw) {
O[P] = V;
return true;
} else {
try {
O[P] = V;
} catch (e) {
return false;
}
}
},
// https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty
HasOwnProperty: function HasOwnProperty(O, P) {
if (this.Type(O) !== 'Object') {
throw new $TypeError('O must be an Object');
}
if (!this.IsPropertyKey(P)) {
throw new $TypeError('P must be a Property Key');
}
return has(O, P);
},
// https://ecma-international.org/ecma-262/6.0/#sec-hasproperty
HasProperty: function HasProperty(O, P) {
if (this.Type(O) !== 'Object') {
throw new $TypeError('O must be an Object');
}
if (!this.IsPropertyKey(P)) {
throw new $TypeError('P must be a Property Key');
}
return P in O;
},
// https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable
IsConcatSpreadable: function IsConcatSpreadable(O) {
if (this.Type(O) !== 'Object') {
return false;
}
if (hasSymbols && typeof $Symbol.isConcatSpreadable === 'symbol') {
var spreadable = this.Get(O, Symbol.isConcatSpreadable);
if (typeof spreadable !== 'undefined') {
return this.ToBoolean(spreadable);
}
}
return this.IsArray(O);
},
// https://ecma-international.org/ecma-262/6.0/#sec-invoke
Invoke: function Invoke(O, P) {
if (!this.IsPropertyKey(P)) {
throw new $TypeError('P must be a Property Key');
}
var argumentsList = arraySlice(arguments, 2);
var func = this.GetV(O, P);
return this.Call(func, O, argumentsList);
},
// https://ecma-international.org/ecma-262/6.0/#sec-getiterator
GetIterator: function GetIterator(obj, method) {
if (!hasSymbols) {
throw new SyntaxError('ES.GetIterator depends on native iterator support.');
}
var actualMethod = method;
if (arguments.length < 2) {
actualMethod = this.GetMethod(obj, $Symbol.iterator);
}
var iterator = this.Call(actualMethod, obj);
if (this.Type(iterator) !== 'Object') {
throw new $TypeError('iterator must return an object');
}
return iterator;
},
// https://ecma-international.org/ecma-262/6.0/#sec-iteratornext
IteratorNext: function IteratorNext(iterator, value) {
var result = this.Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]);
if (this.Type(result) !== 'Object') {
throw new $TypeError('iterator next must return an object');
}
return result;
},
// https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete
IteratorComplete: function IteratorComplete(iterResult) {
if (this.Type(iterResult) !== 'Object') {
throw new $TypeError('Assertion failed: Type(iterResult) is not Object');
}
return this.ToBoolean(this.Get(iterResult, 'done'));
},
// https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue
IteratorValue: function IteratorValue(iterResult) {
if (this.Type(iterResult) !== 'Object') {
throw new $TypeError('Assertion failed: Type(iterResult) is not Object');
}
return this.Get(iterResult, 'value');
},
// https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep
IteratorStep: function IteratorStep(iterator) {
var result = this.IteratorNext(iterator);
var done = this.IteratorComplete(result);
return done === true ? false : result;
},
// https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose
IteratorClose: function IteratorClose(iterator, completion) {
if (this.Type(iterator) !== 'Object') {
throw new $TypeError('Assertion failed: Type(iterator) is not Object');
}
if (!this.IsCallable(completion)) {
throw new $TypeError('Assertion failed: completion is not a thunk for a Completion Record');
}
var completionThunk = completion;
var iteratorReturn = this.GetMethod(iterator, 'return');
if (typeof iteratorReturn === 'undefined') {
return completionThunk();
}
var completionRecord;
try {
var innerResult = this.Call(iteratorReturn, iterator, []);
} catch (e) {
// if we hit here, then "e" is the innerResult completion that needs re-throwing
// if the completion is of type "throw", this will throw.
completionRecord = completionThunk();
completionThunk = null; // ensure it's not called twice.
// if not, then return the innerResult completion
throw e;
}
completionRecord = completionThunk(); // if innerResult worked, then throw if the completion does
completionThunk = null; // ensure it's not called twice.
if (this.Type(innerResult) !== 'Object') {
throw new $TypeError('iterator .return must return an object');
}
return completionRecord;
},
// https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject
CreateIterResultObject: function CreateIterResultObject(value, done) {
if (this.Type(done) !== 'Boolean') {
throw new $TypeError('Assertion failed: Type(done) is not Boolean');
}
return {
value: value,
done: done
};
},
// https://ecma-international.org/ecma-262/6.0/#sec-regexpexec
RegExpExec: function RegExpExec(R, S) {
if (this.Type(R) !== 'Object') {
throw new $TypeError('R must be an Object');
}
if (this.Type(S) !== 'String') {
throw new $TypeError('S must be a String');
}
var exec = this.Get(R, 'exec');
if (this.IsCallable(exec)) {
var result = this.Call(exec, R, [S]);
if (result === null || this.Type(result) === 'Object') {
return result;
}
throw new $TypeError('"exec" method must return `null` or an Object');
}
return regexExec(R, S);
},
// https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate
ArraySpeciesCreate: function ArraySpeciesCreate(originalArray, length) {
if (!this.IsInteger(length) || length < 0) {
throw new $TypeError('Assertion failed: length must be an integer >= 0');
}
var len = length === 0 ? 0 : length;
var C;
var isArray = this.IsArray(originalArray);
if (isArray) {
C = this.Get(originalArray, 'constructor');
// TODO: figure out how to make a cross-realm normal Array, a same-realm Array
// if (this.IsConstructor(C)) {
// if C is another realm's Array, C = undefined
// Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ?
// }
if (this.Type(C) === 'Object' && hasSymbols && $Symbol.species) {
C = this.Get(C, $Symbol.species);
if (C === null) {
C = void 0;
}
}
}
if (typeof C === 'undefined') {
return $Array(len);
}
if (!this.IsConstructor(C)) {
throw new $TypeError('C must be a constructor');
}
return new C(len); // this.Construct(C, len);
},
CreateDataProperty: function CreateDataProperty(O, P, V) {
if (this.Type(O) !== 'Object') {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
if (!this.IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
}
var oldDesc = $gOPD(O, P);
var extensible = oldDesc || (typeof $isExtensible !== 'function' || $isExtensible(O));
var immutable = oldDesc && (!oldDesc.writable || !oldDesc.configurable);
if (immutable || !extensible) {
return false;
}
var newDesc = {
configurable: true,
enumerable: true,
value: V,
writable: true
};
Object.defineProperty(O, P, newDesc);
return true;
},
// https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow
CreateDataPropertyOrThrow: function CreateDataPropertyOrThrow(O, P, V) {
if (this.Type(O) !== 'Object') {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
if (!this.IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
}
var success = this.CreateDataProperty(O, P, V);
if (!success) {
throw new $TypeError('unable to create data property');
}
return success;
},
// https://www.ecma-international.org/ecma-262/6.0/#sec-objectcreate
ObjectCreate: function ObjectCreate(proto, internalSlotsList) {
if (proto !== null && this.Type(proto) !== 'Object') {
throw new $TypeError('Assertion failed: proto must be null or an object');
}
var slots = arguments.length < 2 ? [] : internalSlotsList;
if (slots.length > 0) {
throw new $SyntaxError('es-abstract does not yet support internal slots');
}
if (proto === null && !$ObjectCreate) {
throw new $SyntaxError('native Object.create support is required to create null objects');
}
return $ObjectCreate(proto);
},
// https://ecma-international.org/ecma-262/6.0/#sec-advancestringindex
AdvanceStringIndex: function AdvanceStringIndex(S, index, unicode) {
if (this.Type(S) !== 'String') {
throw new $TypeError('S must be a String');
}
if (!this.IsInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) {
throw new $TypeError('Assertion failed: length must be an integer >= 0 and <= 2**53');
}
if (this.Type(unicode) !== 'Boolean') {
throw new $TypeError('Assertion failed: unicode must be a Boolean');
}
if (!unicode) {
return index + 1;
}
var length = S.length;
if ((index + 1) >= length) {
return index + 1;
}
var first = $charCodeAt(S, index);
if (first < 0xD800 || first > 0xDBFF) {
return index + 1;
}
var second = $charCodeAt(S, index + 1);
if (second < 0xDC00 || second > 0xDFFF) {
return index + 1;
}
return index + 2;
}
});
delete ES6.CheckObjectCoercible; // renamed in ES6 to RequireObjectCoercible
module.exports = ES6;

View File

@ -1,16 +0,0 @@
'use strict';
var ES2015 = require('./es2015');
var assign = require('./helpers/assign');
var ES2016 = assign(assign({}, ES2015), {
// https://github.com/tc39/ecma262/pull/60
SameValueNonNumber: function SameValueNonNumber(x, y) {
if (typeof x === 'number' || typeof x !== typeof y) {
throw new TypeError('SameValueNonNumber requires two non-number values of the same type.');
}
return this.SameValue(x, y);
}
});
module.exports = ES2016;

View File

@ -1,25 +0,0 @@
'use strict';
var ES2016 = require('./es2016');
var assign = require('./helpers/assign');
var ES2017 = assign(assign({}, ES2016), {
ToIndex: function ToIndex(value) {
if (typeof value === 'undefined') {
return 0;
}
var integerIndex = this.ToInteger(value);
if (integerIndex < 0) {
throw new RangeError('index must be >= 0');
}
var index = this.ToLength(integerIndex);
if (!this.SameValueZero(integerIndex, index)) {
throw new RangeError('index must be >= 0 and < 2 ** 53 - 1');
}
return index;
}
});
delete ES2017.EnumerableOwnNames; // replaced with EnumerableOwnProperties
module.exports = ES2017;

View File

@ -1,242 +0,0 @@
'use strict';
var GetIntrinsic = require('./GetIntrinsic');
var $Object = GetIntrinsic('%Object%');
var $TypeError = GetIntrinsic('%TypeError%');
var $String = GetIntrinsic('%String%');
var $isNaN = require('./helpers/isNaN');
var $isFinite = require('./helpers/isFinite');
var sign = require('./helpers/sign');
var mod = require('./helpers/mod');
var IsCallable = require('is-callable');
var toPrimitive = require('es-to-primitive/es5');
var has = require('has');
// https://es5.github.io/#x9
var ES5 = {
ToPrimitive: toPrimitive,
ToBoolean: function ToBoolean(value) {
return !!value;
},
ToNumber: function ToNumber(value) {
return +value; // eslint-disable-line no-implicit-coercion
},
ToInteger: function ToInteger(value) {
var number = this.ToNumber(value);
if ($isNaN(number)) { return 0; }
if (number === 0 || !$isFinite(number)) { return number; }
return sign(number) * Math.floor(Math.abs(number));
},
ToInt32: function ToInt32(x) {
return this.ToNumber(x) >> 0;
},
ToUint32: function ToUint32(x) {
return this.ToNumber(x) >>> 0;
},
ToUint16: function ToUint16(value) {
var number = this.ToNumber(value);
if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; }
var posInt = sign(number) * Math.floor(Math.abs(number));
return mod(posInt, 0x10000);
},
ToString: function ToString(value) {
return $String(value);
},
ToObject: function ToObject(value) {
this.CheckObjectCoercible(value);
return $Object(value);
},
CheckObjectCoercible: function CheckObjectCoercible(value, optMessage) {
/* jshint eqnull:true */
if (value == null) {
throw new $TypeError(optMessage || 'Cannot call method on ' + value);
}
return value;
},
IsCallable: IsCallable,
SameValue: function SameValue(x, y) {
if (x === y) { // 0 === -0, but they are not identical.
if (x === 0) { return 1 / x === 1 / y; }
return true;
}
return $isNaN(x) && $isNaN(y);
},
// https://www.ecma-international.org/ecma-262/5.1/#sec-8
Type: function Type(x) {
if (x === null) {
return 'Null';
}
if (typeof x === 'undefined') {
return 'Undefined';
}
if (typeof x === 'function' || typeof x === 'object') {
return 'Object';
}
if (typeof x === 'number') {
return 'Number';
}
if (typeof x === 'boolean') {
return 'Boolean';
}
if (typeof x === 'string') {
return 'String';
}
},
// https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type
IsPropertyDescriptor: function IsPropertyDescriptor(Desc) {
if (this.Type(Desc) !== 'Object') {
return false;
}
var allowed = {
'[[Configurable]]': true,
'[[Enumerable]]': true,
'[[Get]]': true,
'[[Set]]': true,
'[[Value]]': true,
'[[Writable]]': true
};
// jscs:disable
for (var key in Desc) { // eslint-disable-line
if (has(Desc, key) && !allowed[key]) {
return false;
}
}
// jscs:enable
var isData = has(Desc, '[[Value]]');
var IsAccessor = has(Desc, '[[Get]]') || has(Desc, '[[Set]]');
if (isData && IsAccessor) {
throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
}
return true;
},
// https://ecma-international.org/ecma-262/5.1/#sec-8.10.1
IsAccessorDescriptor: function IsAccessorDescriptor(Desc) {
if (typeof Desc === 'undefined') {
return false;
}
if (!this.IsPropertyDescriptor(Desc)) {
throw new $TypeError('Desc must be a Property Descriptor');
}
if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) {
return false;
}
return true;
},
// https://ecma-international.org/ecma-262/5.1/#sec-8.10.2
IsDataDescriptor: function IsDataDescriptor(Desc) {
if (typeof Desc === 'undefined') {
return false;
}
if (!this.IsPropertyDescriptor(Desc)) {
throw new $TypeError('Desc must be a Property Descriptor');
}
if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) {
return false;
}
return true;
},
// https://ecma-international.org/ecma-262/5.1/#sec-8.10.3
IsGenericDescriptor: function IsGenericDescriptor(Desc) {
if (typeof Desc === 'undefined') {
return false;
}
if (!this.IsPropertyDescriptor(Desc)) {
throw new $TypeError('Desc must be a Property Descriptor');
}
if (!this.IsAccessorDescriptor(Desc) && !this.IsDataDescriptor(Desc)) {
return true;
}
return false;
},
// https://ecma-international.org/ecma-262/5.1/#sec-8.10.4
FromPropertyDescriptor: function FromPropertyDescriptor(Desc) {
if (typeof Desc === 'undefined') {
return Desc;
}
if (!this.IsPropertyDescriptor(Desc)) {
throw new $TypeError('Desc must be a Property Descriptor');
}
if (this.IsDataDescriptor(Desc)) {
return {
value: Desc['[[Value]]'],
writable: !!Desc['[[Writable]]'],
enumerable: !!Desc['[[Enumerable]]'],
configurable: !!Desc['[[Configurable]]']
};
} else if (this.IsAccessorDescriptor(Desc)) {
return {
get: Desc['[[Get]]'],
set: Desc['[[Set]]'],
enumerable: !!Desc['[[Enumerable]]'],
configurable: !!Desc['[[Configurable]]']
};
} else {
throw new $TypeError('FromPropertyDescriptor must be called with a fully populated Property Descriptor');
}
},
// https://ecma-international.org/ecma-262/5.1/#sec-8.10.5
ToPropertyDescriptor: function ToPropertyDescriptor(Obj) {
if (this.Type(Obj) !== 'Object') {
throw new $TypeError('ToPropertyDescriptor requires an object');
}
var desc = {};
if (has(Obj, 'enumerable')) {
desc['[[Enumerable]]'] = this.ToBoolean(Obj.enumerable);
}
if (has(Obj, 'configurable')) {
desc['[[Configurable]]'] = this.ToBoolean(Obj.configurable);
}
if (has(Obj, 'value')) {
desc['[[Value]]'] = Obj.value;
}
if (has(Obj, 'writable')) {
desc['[[Writable]]'] = this.ToBoolean(Obj.writable);
}
if (has(Obj, 'get')) {
var getter = Obj.get;
if (typeof getter !== 'undefined' && !this.IsCallable(getter)) {
throw new TypeError('getter must be a function');
}
desc['[[Get]]'] = getter;
}
if (has(Obj, 'set')) {
var setter = Obj.set;
if (typeof setter !== 'undefined' && !this.IsCallable(setter)) {
throw new $TypeError('setter must be a function');
}
desc['[[Set]]'] = setter;
}
if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) {
throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute');
}
return desc;
}
};
module.exports = ES5;

View File

@ -1,3 +0,0 @@
'use strict';
module.exports = require('./es2015');

View File

@ -1,3 +0,0 @@
'use strict';
module.exports = require('./es2016');

View File

@ -1,17 +0,0 @@
var bind = require('function-bind');
var has = bind.call(Function.call, Object.prototype.hasOwnProperty);
var $assign = Object.assign;
module.exports = function assign(target, source) {
if ($assign) {
return $assign(target, source);
}
for (var key in source) {
if (has(source, key)) {
target[key] = source[key];
}
}
return target;
};

View File

@ -1,3 +0,0 @@
var $isNaN = Number.isNaN || function (a) { return a !== a; };
module.exports = Number.isFinite || function (x) { return typeof x === 'number' && !$isNaN(x) && x !== Infinity && x !== -Infinity; };

View File

@ -1,3 +0,0 @@
module.exports = Number.isNaN || function isNaN(a) {
return a !== a;
};

View File

@ -1,3 +0,0 @@
module.exports = function isPrimitive(value) {
return value === null || (typeof value !== 'function' && typeof value !== 'object');
};

View File

@ -1,4 +0,0 @@
module.exports = function mod(number, modulo) {
var remain = number % modulo;
return Math.floor(remain >= 0 ? remain : remain + modulo);
};

View File

@ -1,3 +0,0 @@
module.exports = function sign(number) {
return number >= 0 ? 1 : -1;
};

View File

@ -1,22 +0,0 @@
'use strict';
var assign = require('./helpers/assign');
var ES5 = require('./es5');
var ES2015 = require('./es2015');
var ES2016 = require('./es2016');
var ES2017 = require('./es2017');
var ES = {
ES5: ES5,
ES6: ES2015,
ES2015: ES2015,
ES7: ES2016,
ES2016: ES2016,
ES2017: ES2017
};
assign(ES, ES5);
delete ES.CheckObjectCoercible; // renamed in ES6 to RequireObjectCoercible
assign(ES, ES2015);
module.exports = ES;

View File

@ -1,78 +0,0 @@
'use strict';
module.exports = {
IsPropertyDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type',
IsAccessorDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor',
IsDataDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor',
IsGenericDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-isgenericdescriptor',
FromPropertyDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor',
ToPropertyDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-topropertydescriptor',
CompletePropertyDescriptor: 'https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor',
ToPrimitive: 'https://ecma-international.org/ecma-262/6.0/#sec-toprimitive',
ToBoolean: 'https://ecma-international.org/ecma-262/6.0/#sec-toboolean',
ToNumber: 'https://ecma-international.org/ecma-262/6.0/#sec-tonumber',
ToInteger: 'https://ecma-international.org/ecma-262/6.0/#sec-tointeger',
ToInt32: 'https://ecma-international.org/ecma-262/6.0/#sec-toint32',
ToUint32: 'https://ecma-international.org/ecma-262/6.0/#sec-touint32',
ToInt16: 'https://ecma-international.org/ecma-262/6.0/#sec-toint16',
ToUint16: 'https://ecma-international.org/ecma-262/6.0/#sec-touint16',
ToInt8: 'https://ecma-international.org/ecma-262/6.0/#sec-toint8',
ToUint8: 'https://ecma-international.org/ecma-262/6.0/#sec-touint8',
ToUint8Clamp: 'https://ecma-international.org/ecma-262/6.0/#sec-touint8clamp',
ToString: 'https://ecma-international.org/ecma-262/6.0/#sec-tostring',
ToObject: 'https://ecma-international.org/ecma-262/6.0/#sec-toobject',
ToPropertyKey: 'https://ecma-international.org/ecma-262/6.0/#sec-topropertykey',
ToLength: 'https://ecma-international.org/ecma-262/6.0/#sec-tolength',
CanonicalNumericIndexString: 'https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring',
RequireObjectCoercible: 'https://ecma-international.org/ecma-262/6.0/#sec-requireobjectcoercible',
IsArray: 'https://ecma-international.org/ecma-262/6.0/#sec-isarray',
IsCallable: 'https://ecma-international.org/ecma-262/6.0/#sec-iscallable',
IsConstructor: 'https://ecma-international.org/ecma-262/6.0/#sec-isconstructor',
IsExtensible: 'https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o',
IsInteger: 'https://ecma-international.org/ecma-262/6.0/#sec-isinteger',
IsPropertyKey: 'https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey',
IsRegExp: 'https://ecma-international.org/ecma-262/6.0/#sec-isregexp',
SameValue: 'https://ecma-international.org/ecma-262/6.0/#sec-samevalue',
SameValueZero: 'https://ecma-international.org/ecma-262/6.0/#sec-samevaluezero',
Get: 'https://ecma-international.org/ecma-262/6.0/#sec-get-o-p',
GetV: 'https://ecma-international.org/ecma-262/6.0/#sec-getv',
Set: 'https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw',
CreateDataProperty: 'https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty',
CreateMethodProperty: 'https://ecma-international.org/ecma-262/6.0/#sec-createmethodproperty',
CreateDataPropertyOrThrow: 'https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow',
DefinePropertyOrThrow: 'https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow',
DeletePropertyOrThrow: 'https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow',
GetMethod: 'https://ecma-international.org/ecma-262/6.0/#sec-getmethod',
HasProperty: 'https://ecma-international.org/ecma-262/6.0/#sec-hasproperty',
HasOwnProperty: 'https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty',
Call: 'https://ecma-international.org/ecma-262/6.0/#sec-call',
Construct: 'https://ecma-international.org/ecma-262/6.0/#sec-construct',
SetIntegrityLevel: 'https://ecma-international.org/ecma-262/6.0/#sec-setintegritylevel',
TestIntegrityLevel: 'https://ecma-international.org/ecma-262/6.0/#sec-testintegritylevel',
CreateArrayFromList: 'https://ecma-international.org/ecma-262/6.0/#sec-createarrayfromlist',
CreateListFromArrayLike: 'https://ecma-international.org/ecma-262/6.0/#sec-createlistfromarraylike',
Invoke: 'https://ecma-international.org/ecma-262/6.0/#sec-invoke',
OrdinaryHasInstance: 'https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance',
SpeciesConstructor: 'https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor',
EnumerableOwnNames: 'https://ecma-international.org/ecma-262/6.0/#sec-enumerableownnames',
GetIterator: 'https://ecma-international.org/ecma-262/6.0/#sec-getiterator',
IteratorNext: 'https://ecma-international.org/ecma-262/6.0/#sec-iteratornext',
IteratorComplete: 'https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete',
IteratorValue: 'https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue',
IteratorStep: 'https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep',
IteratorClose: 'https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose',
CreateIterResultObject: 'https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject',
CreateListIterator: 'https://ecma-international.org/ecma-262/6.0/#sec-createlistiterator',
Type: 'https://ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types',
thisNumberValue: 'https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-number-prototype-object',
thisTimeValue: 'https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-date-prototype-object',
thisStringValue: 'https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-string-prototype-object',
RegExpExec: 'https://ecma-international.org/ecma-262/6.0/#sec-regexpexec',
RegExpBuiltinExec: 'https://ecma-international.org/ecma-262/6.0/#sec-regexpbuiltinexec',
IsConcatSpreadable: 'https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable',
IsPromise: 'https://ecma-international.org/ecma-262/6.0/#sec-ispromise',
ArraySpeciesCreate: 'https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate',
ObjectCreate: 'https://ecma-international.org/ecma-262/6.0/#sec-objectcreate',
AdvanceStringIndex: 'https://ecma-international.org/ecma-262/6.0/#sec-advancestringindex',
NormalCompletion: 'https://ecma-international.org/ecma-262/6.0/#sec-normalcompletion'
};

View File

@ -1,80 +0,0 @@
'use strict';
module.exports = {
IsPropertyDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-property-descriptor-specification-type',
IsAccessorDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-isaccessordescriptor',
IsDataDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-isdatadescriptor',
IsGenericDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-isgenericdescriptor',
FromPropertyDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-frompropertydescriptor',
ToPropertyDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-topropertydescriptor',
CompletePropertyDescriptor: 'https://ecma-international.org/ecma-262/7.0/#sec-completepropertydescriptor',
ToPrimitive: 'https://ecma-international.org/ecma-262/7.0/#sec-toprimitive',
ToBoolean: 'https://ecma-international.org/ecma-262/7.0/#sec-toboolean',
ToNumber: 'https://ecma-international.org/ecma-262/7.0/#sec-tonumber',
ToInteger: 'https://ecma-international.org/ecma-262/7.0/#sec-tointeger',
ToInt32: 'https://ecma-international.org/ecma-262/7.0/#sec-toint32',
ToUint32: 'https://ecma-international.org/ecma-262/7.0/#sec-touint32',
ToInt16: 'https://ecma-international.org/ecma-262/7.0/#sec-toint16',
ToUint16: 'https://ecma-international.org/ecma-262/7.0/#sec-touint16',
ToInt8: 'https://ecma-international.org/ecma-262/7.0/#sec-toint8',
ToUint8: 'https://ecma-international.org/ecma-262/7.0/#sec-touint8',
ToUint8Clamp: 'https://ecma-international.org/ecma-262/7.0/#sec-touint8clamp',
ToString: 'https://ecma-international.org/ecma-262/7.0/#sec-tostring',
ToObject: 'https://ecma-international.org/ecma-262/7.0/#sec-toobject',
ToPropertyKey: 'https://ecma-international.org/ecma-262/7.0/#sec-topropertykey',
ToLength: 'https://ecma-international.org/ecma-262/7.0/#sec-tolength',
CanonicalNumericIndexString: 'https://ecma-international.org/ecma-262/7.0/#sec-canonicalnumericindexstring',
RequireObjectCoercible: 'https://ecma-international.org/ecma-262/7.0/#sec-requireobjectcoercible',
IsArray: 'https://ecma-international.org/ecma-262/7.0/#sec-isarray',
IsCallable: 'https://ecma-international.org/ecma-262/7.0/#sec-iscallable',
IsConstructor: 'https://ecma-international.org/ecma-262/7.0/#sec-isconstructor',
IsExtensible: 'https://ecma-international.org/ecma-262/7.0/#sec-isextensible-o',
IsInteger: 'https://ecma-international.org/ecma-262/7.0/#sec-isinteger',
IsPropertyKey: 'https://ecma-international.org/ecma-262/7.0/#sec-ispropertykey',
IsRegExp: 'https://ecma-international.org/ecma-262/7.0/#sec-isregexp',
SameValue: 'https://ecma-international.org/ecma-262/7.0/#sec-samevalue',
SameValueZero: 'https://ecma-international.org/ecma-262/7.0/#sec-samevaluezero',
SameValueNonNumber: 'https://ecma-international.org/ecma-262/7.0/#sec-samevaluenonnumber',
Get: 'https://ecma-international.org/ecma-262/7.0/#sec-get-o-p',
GetV: 'https://ecma-international.org/ecma-262/7.0/#sec-getv',
Set: 'https://ecma-international.org/ecma-262/7.0/#sec-set-o-p-v-throw',
CreateDataProperty: 'https://ecma-international.org/ecma-262/7.0/#sec-createdataproperty',
CreateMethodProperty: 'https://ecma-international.org/ecma-262/7.0/#sec-createmethodproperty',
CreateDataPropertyOrThrow: 'https://ecma-international.org/ecma-262/7.0/#sec-createdatapropertyorthrow',
DefinePropertyOrThrow: 'https://ecma-international.org/ecma-262/7.0/#sec-definepropertyorthrow',
DeletePropertyOrThrow: 'https://ecma-international.org/ecma-262/7.0/#sec-deletepropertyorthrow',
GetMethod: 'https://ecma-international.org/ecma-262/7.0/#sec-getmethod',
HasProperty: 'https://ecma-international.org/ecma-262/7.0/#sec-hasproperty',
HasOwnProperty: 'https://ecma-international.org/ecma-262/7.0/#sec-hasownproperty',
Call: 'https://ecma-international.org/ecma-262/7.0/#sec-call',
Construct: 'https://ecma-international.org/ecma-262/7.0/#sec-construct',
SetIntegrityLevel: 'https://ecma-international.org/ecma-262/7.0/#sec-setintegritylevel',
TestIntegrityLevel: 'https://ecma-international.org/ecma-262/7.0/#sec-testintegritylevel',
CreateArrayFromList: 'https://ecma-international.org/ecma-262/7.0/#sec-createarrayfromlist',
CreateListFromArrayLike: 'https://ecma-international.org/ecma-262/7.0/#sec-createlistfromarraylike',
Invoke: 'https://ecma-international.org/ecma-262/7.0/#sec-invoke',
OrdinaryHasInstance: 'https://ecma-international.org/ecma-262/7.0/#sec-ordinaryhasinstance',
SpeciesConstructor: 'https://ecma-international.org/ecma-262/7.0/#sec-speciesconstructor',
EnumerableOwnNames: 'https://ecma-international.org/ecma-262/7.0/#sec-enumerableownnames',
GetIterator: 'https://ecma-international.org/ecma-262/7.0/#sec-getiterator',
IteratorNext: 'https://ecma-international.org/ecma-262/7.0/#sec-iteratornext',
IteratorComplete: 'https://ecma-international.org/ecma-262/7.0/#sec-iteratorcomplete',
IteratorValue: 'https://ecma-international.org/ecma-262/7.0/#sec-iteratorvalue',
IteratorStep: 'https://ecma-international.org/ecma-262/7.0/#sec-iteratorstep',
IteratorClose: 'https://ecma-international.org/ecma-262/7.0/#sec-iteratorclose',
CreateIterResultObject: 'https://ecma-international.org/ecma-262/7.0/#sec-createiterresultobject',
CreateListIterator: 'https://ecma-international.org/ecma-262/7.0/#sec-createlistiterator',
Type: 'https://ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types',
thisNumberValue: 'https://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-number-prototype-object',
thisTimeValue: 'https://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-date-prototype-object',
thisStringValue: 'https://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-string-prototype-object',
RegExpExec: 'https://ecma-international.org/ecma-262/7.0/#sec-regexpexec',
RegExpBuiltinExec: 'https://ecma-international.org/ecma-262/7.0/#sec-regexpbuiltinexec',
IsConcatSpreadable: 'https://ecma-international.org/ecma-262/7.0/#sec-isconcatspreadable',
IsPromise: 'https://ecma-international.org/ecma-262/7.0/#sec-ispromise',
ArraySpeciesCreate: 'https://ecma-international.org/ecma-262/7.0/#sec-arrayspeciescreate',
ObjectCreate: 'https://ecma-international.org/ecma-262/7.0/#sec-objectcreate',
AdvanceStringIndex: 'https://ecma-international.org/ecma-262/7.0/#sec-advancestringindex',
OrdinarySet: 'https://ecma-international.org/ecma-262/7.0/#sec-ordinaryset',
NormalCompletion: 'https://ecma-international.org/ecma-262/7.0/#sec-normalcompletion'
};

View File

@ -1,82 +0,0 @@
'use strict';
module.exports = {
IsPropertyDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-property-descriptor-specification-type',
IsAccessorDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-isaccessordescriptor',
IsDataDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-isdatadescriptor',
IsGenericDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-isgenericdescriptor',
FromPropertyDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-frompropertydescriptor',
ToPropertyDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-topropertydescriptor',
CompletePropertyDescriptor: 'https://ecma-international.org/ecma-262/8.0/#sec-completepropertydescriptor',
ToPrimitive: 'https://ecma-international.org/ecma-262/8.0/#sec-toprimitive',
ToBoolean: 'https://ecma-international.org/ecma-262/8.0/#sec-toboolean',
ToNumber: 'https://ecma-international.org/ecma-262/8.0/#sec-tonumber',
ToInteger: 'https://ecma-international.org/ecma-262/8.0/#sec-tointeger',
ToInt32: 'https://ecma-international.org/ecma-262/8.0/#sec-toint32',
ToUint32: 'https://ecma-international.org/ecma-262/8.0/#sec-touint32',
ToInt16: 'https://ecma-international.org/ecma-262/8.0/#sec-toint16',
ToUint16: 'https://ecma-international.org/ecma-262/8.0/#sec-touint16',
ToInt8: 'https://ecma-international.org/ecma-262/8.0/#sec-toint8',
ToUint8: 'https://ecma-international.org/ecma-262/8.0/#sec-touint8',
ToUint8Clamp: 'https://ecma-international.org/ecma-262/8.0/#sec-touint8clamp',
ToString: 'https://ecma-international.org/ecma-262/8.0/#sec-tostring',
ToObject: 'https://ecma-international.org/ecma-262/8.0/#sec-toobject',
ToPropertyKey: 'https://ecma-international.org/ecma-262/8.0/#sec-topropertykey',
ToLength: 'https://ecma-international.org/ecma-262/8.0/#sec-tolength',
CanonicalNumericIndexString: 'https://ecma-international.org/ecma-262/8.0/#sec-canonicalnumericindexstring',
ToIndex: 'https://ecma-international.org/ecma-262/8.0/#sec-toindex',
RequireObjectCoercible: 'https://ecma-international.org/ecma-262/8.0/#sec-requireobjectcoercible',
IsArray: 'https://ecma-international.org/ecma-262/8.0/#sec-isarray',
IsCallable: 'https://ecma-international.org/ecma-262/8.0/#sec-iscallable',
IsConstructor: 'https://ecma-international.org/ecma-262/8.0/#sec-isconstructor',
IsExtensible: 'https://ecma-international.org/ecma-262/8.0/#sec-isextensible-o',
IsInteger: 'https://ecma-international.org/ecma-262/8.0/#sec-isinteger',
IsPropertyKey: 'https://ecma-international.org/ecma-262/8.0/#sec-ispropertykey',
IsRegExp: 'https://ecma-international.org/ecma-262/8.0/#sec-isregexp',
SameValue: 'https://ecma-international.org/ecma-262/8.0/#sec-samevalue',
SameValueZero: 'https://ecma-international.org/ecma-262/8.0/#sec-samevaluezero',
SameValueNonNumber: 'https://ecma-international.org/ecma-262/8.0/#sec-samevaluenonnumber',
Get: 'https://ecma-international.org/ecma-262/8.0/#sec-get-o-p',
GetV: 'https://ecma-international.org/ecma-262/8.0/#sec-getv',
Set: 'https://ecma-international.org/ecma-262/8.0/#sec-set-o-p-v-throw',
CreateDataProperty: 'https://ecma-international.org/ecma-262/8.0/#sec-createdataproperty',
CreateMethodProperty: 'https://ecma-international.org/ecma-262/8.0/#sec-createmethodproperty',
CreateDataPropertyOrThrow: 'https://ecma-international.org/ecma-262/8.0/#sec-createdatapropertyorthrow',
DefinePropertyOrThrow: 'https://ecma-international.org/ecma-262/8.0/#sec-definepropertyorthrow',
DeletePropertyOrThrow: 'https://ecma-international.org/ecma-262/8.0/#sec-deletepropertyorthrow',
GetMethod: 'https://ecma-international.org/ecma-262/8.0/#sec-getmethod',
HasProperty: 'https://ecma-international.org/ecma-262/8.0/#sec-hasproperty',
HasOwnProperty: 'https://ecma-international.org/ecma-262/8.0/#sec-hasownproperty',
Call: 'https://ecma-international.org/ecma-262/8.0/#sec-call',
Construct: 'https://ecma-international.org/ecma-262/8.0/#sec-construct',
SetIntegrityLevel: 'https://ecma-international.org/ecma-262/8.0/#sec-setintegritylevel',
TestIntegrityLevel: 'https://ecma-international.org/ecma-262/8.0/#sec-testintegritylevel',
CreateArrayFromList: 'https://ecma-international.org/ecma-262/8.0/#sec-createarrayfromlist',
CreateListFromArrayLike: 'https://ecma-international.org/ecma-262/8.0/#sec-createlistfromarraylike',
Invoke: 'https://ecma-international.org/ecma-262/8.0/#sec-invoke',
OrdinaryHasInstance: 'https://ecma-international.org/ecma-262/8.0/#sec-ordinaryhasinstance',
SpeciesConstructor: 'https://ecma-international.org/ecma-262/8.0/#sec-speciesconstructor',
EnumerableOwnProperties: 'https://ecma-international.org/ecma-262/8.0/#sec-enumerableownproperties',
GetIterator: 'https://ecma-international.org/ecma-262/8.0/#sec-getiterator',
IteratorNext: 'https://ecma-international.org/ecma-262/8.0/#sec-iteratornext',
IteratorComplete: 'https://ecma-international.org/ecma-262/8.0/#sec-iteratorcomplete',
IteratorValue: 'https://ecma-international.org/ecma-262/8.0/#sec-iteratorvalue',
IteratorStep: 'https://ecma-international.org/ecma-262/8.0/#sec-iteratorstep',
IteratorClose: 'https://ecma-international.org/ecma-262/8.0/#sec-iteratorclose',
CreateIterResultObject: 'https://ecma-international.org/ecma-262/8.0/#sec-createiterresultobject',
CreateListIterator: 'https://ecma-international.org/ecma-262/8.0/#sec-createlistiterator',
Type: 'https://ecma-international.org/ecma-262/8.0/#sec-ecmascript-language-types',
thisNumberValue: 'https://ecma-international.org/ecma-262/8.0/#sec-properties-of-the-number-prototype-object',
thisTimeValue: 'https://ecma-international.org/ecma-262/8.0/#sec-properties-of-the-date-prototype-object',
thisStringValue: 'https://ecma-international.org/ecma-262/8.0/#sec-properties-of-the-string-prototype-object',
RegExpExec: 'https://ecma-international.org/ecma-262/8.0/#sec-regexpexec',
RegExpBuiltinExec: 'https://ecma-international.org/ecma-262/8.0/#sec-regexpbuiltinexec',
IsConcatSpreadable: 'https://ecma-international.org/ecma-262/8.0/#sec-isconcatspreadable',
IsPromise: 'https://ecma-international.org/ecma-262/8.0/#sec-ispromise',
ArraySpeciesCreate: 'https://ecma-international.org/ecma-262/8.0/#sec-arrayspeciescreate',
ObjectCreate: 'https://ecma-international.org/ecma-262/8.0/#sec-objectcreate',
AdvanceStringIndex: 'https://ecma-international.org/ecma-262/8.0/#sec-advancestringindex',
OrdinarySet: 'https://ecma-international.org/ecma-262/8.0/#sec-ordinaryset',
NormalCompletion: 'https://ecma-international.org/ecma-262/8.0/#sec-normalcompletion',
IsSharedArrayBuffer: 'https://ecma-international.org/ecma-262/8.0/#sec-issharedarraybuffer',
};

View File

@ -1,10 +0,0 @@
'use strict';
module.exports = {
IsPropertyDescriptor: 'https://ecma-international.org/ecma-262/5.1/#sec-8.10',
IsAccessorDescriptor: 'https://ecma-international.org/ecma-262/5.1/#sec-8.10.1',
IsDataDescriptor: 'https://ecma-international.org/ecma-262/5.1/#sec-8.10.2',
IsGenericDescriptor: 'https://ecma-international.org/ecma-262/5.1/#sec-8.10.3',
FromPropertyDescriptor: 'https://ecma-international.org/ecma-262/5.1/#sec-8.10.4',
ToPropertyDescriptor: 'https://ecma-international.org/ecma-262/5.1/#sec-8.10.5'
};

View File

@ -1,104 +0,0 @@
{
"author": {
"name": "Jordan Harband",
"email": "ljharb@gmail.com",
"url": "http://ljharb.codes"
},
"bugs": {
"url": "https://github.com/ljharb/es-abstract/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Jordan Harband",
"email": "ljharb@gmail.com",
"url": "http://ljharb.codes"
}
],
"dependencies": {
"es-to-primitive": "^1.1.1",
"function-bind": "^1.1.1",
"has": "^1.0.1",
"is-callable": "^1.1.3",
"is-regex": "^1.0.4"
},
"deprecated": false,
"description": "ECMAScript spec abstract operations.",
"devDependencies": {
"@ljharb/eslint-config": "^12.2.1",
"editorconfig-tools": "^0.1.1",
"eslint": "^4.19.1",
"foreach": "^2.0.5",
"jscs": "^3.0.7",
"nsp": "^3.2.1",
"nyc": "^10.3.2",
"object-inspect": "^1.6.0",
"object-is": "^1.0.1",
"object.assign": "^4.1.0",
"replace": "^1.0.0",
"safe-publish-latest": "^1.1.1",
"semver": "^5.5.0",
"tape": "^4.9.0"
},
"engines": {
"node": ">= 0.4"
},
"greenkeeper": {
"//": "nyc is ignored because it requires node 4+, and we support older than that",
"ignore": [
"nyc"
]
},
"homepage": "https://github.com/ljharb/es-abstract#readme",
"keywords": [
"ECMAScript",
"ES",
"abstract",
"operation",
"abstract operation",
"JavaScript",
"ES5",
"ES6",
"ES7"
],
"license": "MIT",
"main": "index.js",
"name": "es-abstract",
"repository": {
"type": "git",
"url": "git://github.com/ljharb/es-abstract.git"
},
"scripts": {
"coverage": "nyc npm run --silent tests-only >/dev/null",
"eccheck": "editorconfig-tools check *.js **/*.js > /dev/null",
"eslint": "eslint test/*.js *.js",
"jscs": "jscs test/*.js *.js",
"lint": "npm run --silent jscs && npm run --silent eslint",
"postcoverage": "nyc report",
"posttest": "npm run --silent security",
"prepublish": "safe-publish-latest",
"pretest": "npm run --silent lint",
"security": "nsp check",
"test": "npm run tests-only",
"tests-only": "node test"
},
"testling": {
"files": "test/index.js",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/10.0..latest",
"opera/next",
"safari/4.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"version": "1.12.0"
}

View File

@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015 Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,61 +0,0 @@
# Since we rely on paths relative to the makefile location, abort if make isn't being run from there.
$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in))
# The files that need updating when incrementing the version number.
VERSIONED_FILES := *.js *.json README*
# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly.
# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment
# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests.
export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH")
UTILS := semver
# Make sure that all required utilities can be located.
UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS)))
# Default target (by virtue of being the first non '.'-prefixed in the file).
.PHONY: _no-target-specified
_no-target-specified:
$(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests)
# Lists all targets defined in this makefile.
.PHONY: list
list:
@$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort
# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS).
.PHONY: test
test:
@npm test
.PHONY: _ensure-tag
_ensure-tag:
ifndef TAG
$(error Please invoke with `make TAG=<new-version> release`, where <new-version> is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number)
endif
CHANGELOG_ERROR = $(error No CHANGELOG specified)
.PHONY: _ensure-changelog
_ensure-changelog:
@ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2)
# Ensures that the git workspace is clean.
.PHONY: _ensure-clean
_ensure-clean:
@[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; }
# Makes a release; invoke with `make TAG=<versionOrIncrementSpec> release`.
.PHONY: release
release: _ensure-tag _ensure-changelog _ensure-clean
@old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \
new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \
if printf "$$new_ver" | command grep -q '^[0-9]'; then \
semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \
semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \
else \
new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \
fi; \
printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \
replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \
git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \
git tag -a -m "v$$new_ver" "v$$new_ver"

View File

@ -1,53 +0,0 @@
# es-to-primitive <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![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]
[![npm badge][npm-badge-png]][package-url]
[![browser support][testling-svg]][testling-url]
ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES6 versions.
When different versions of the spec conflict, the default export will be the latest version of the abstract operation.
Alternative versions will also be available under an `es5`/`es6`/`es7` exported property if you require a specific version.
## Example
```js
var toPrimitive = require('es-to-primitive');
var assert = require('assert');
assert(toPrimitive(function () {}) === String(function () {}));
var date = new Date();
assert(toPrimitive(date) === String(date));
assert(toPrimitive({ valueOf: function () { return 3; } }) === 3);
assert(toPrimitive(['a', 'b', 3]) === String(['a', 'b', 3]));
var sym = Symbol();
assert(toPrimitive(Object(sym)) === sym);
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/es-to-primitive
[npm-version-svg]: http://versionbadg.es/ljharb/es-to-primitive.svg
[travis-svg]: https://travis-ci.org/ljharb/es-to-primitive.svg
[travis-url]: https://travis-ci.org/ljharb/es-to-primitive
[deps-svg]: https://david-dm.org/ljharb/es-to-primitive.svg
[deps-url]: https://david-dm.org/ljharb/es-to-primitive
[dev-deps-svg]: https://david-dm.org/ljharb/es-to-primitive/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/es-to-primitive#info=devDependencies
[testling-svg]: https://ci.testling.com/ljharb/es-to-primitive.png
[testling-url]: https://ci.testling.com/ljharb/es-to-primitive
[npm-badge-png]: https://nodei.co/npm/es-to-primitive.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/es-to-primitive.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/es-to-primitive.svg
[downloads-url]: http://npm-stat.com/charts.html?package=es-to-primitive

View File

@ -1,37 +0,0 @@
'use strict';
var toStr = Object.prototype.toString;
var isPrimitive = require('./helpers/isPrimitive');
var isCallable = require('is-callable');
// https://es5.github.io/#x8.12
var ES5internalSlots = {
'[[DefaultValue]]': function (O, hint) {
var actualHint = hint || (toStr.call(O) === '[object Date]' ? String : Number);
if (actualHint === String || actualHint === Number) {
var methods = actualHint === String ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
var value, i;
for (i = 0; i < methods.length; ++i) {
if (isCallable(O[methods[i]])) {
value = O[methods[i]]();
if (isPrimitive(value)) {
return value;
}
}
}
throw new TypeError('No default value');
}
throw new TypeError('invalid [[DefaultValue]] hint supplied');
}
};
// https://es5.github.io/#x9
module.exports = function ToPrimitive(input, PreferredType) {
if (isPrimitive(input)) {
return input;
}
return ES5internalSlots['[[DefaultValue]]'](input, PreferredType);
};

View File

@ -1,74 +0,0 @@
'use strict';
var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';
var isPrimitive = require('./helpers/isPrimitive');
var isCallable = require('is-callable');
var isDate = require('is-date-object');
var isSymbol = require('is-symbol');
var ordinaryToPrimitive = function OrdinaryToPrimitive(O, hint) {
if (typeof O === 'undefined' || O === null) {
throw new TypeError('Cannot call method on ' + O);
}
if (typeof hint !== 'string' || (hint !== 'number' && hint !== 'string')) {
throw new TypeError('hint must be "string" or "number"');
}
var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
var method, result, i;
for (i = 0; i < methodNames.length; ++i) {
method = O[methodNames[i]];
if (isCallable(method)) {
result = method.call(O);
if (isPrimitive(result)) {
return result;
}
}
}
throw new TypeError('No default value');
};
var GetMethod = function GetMethod(O, P) {
var func = O[P];
if (func !== null && typeof func !== 'undefined') {
if (!isCallable(func)) {
throw new TypeError(func + ' returned for property ' + P + ' of object ' + O + ' is not a function');
}
return func;
}
};
// http://www.ecma-international.org/ecma-262/6.0/#sec-toprimitive
module.exports = function ToPrimitive(input, PreferredType) {
if (isPrimitive(input)) {
return input;
}
var hint = 'default';
if (arguments.length > 1) {
if (PreferredType === String) {
hint = 'string';
} else if (PreferredType === Number) {
hint = 'number';
}
}
var exoticToPrim;
if (hasSymbols) {
if (Symbol.toPrimitive) {
exoticToPrim = GetMethod(input, Symbol.toPrimitive);
} else if (isSymbol(input)) {
exoticToPrim = Symbol.prototype.valueOf;
}
}
if (typeof exoticToPrim !== 'undefined') {
var result = exoticToPrim.call(input, hint);
if (isPrimitive(result)) {
return result;
}
throw new TypeError('unable to convert exotic object to primitive');
}
if (hint === 'default' && (isDate(input) || isSymbol(input))) {
hint = 'string';
}
return ordinaryToPrimitive(input, hint === 'default' ? 'number' : hint);
};

View File

@ -1,3 +0,0 @@
module.exports = function isPrimitive(value) {
return value === null || (typeof value !== 'function' && typeof value !== 'object');
};

View File

@ -1,14 +0,0 @@
'use strict';
var ES5 = require('./es5');
var ES6 = require('./es6');
if (Object.defineProperty) {
Object.defineProperty(ES6, 'ES5', { enumerable: false, value: ES5 });
Object.defineProperty(ES6, 'ES6', { enumerable: false, value: ES6 });
} else {
ES6.ES5 = ES5;
ES6.ES6 = ES6;
}
module.exports = ES6;

View File

@ -1,79 +0,0 @@
{
"author": {
"name": "Jordan Harband"
},
"bugs": {
"url": "https://github.com/ljharb/es-to-primitive/issues"
},
"bundleDependencies": false,
"dependencies": {
"is-callable": "^1.1.1",
"is-date-object": "^1.0.1",
"is-symbol": "^1.0.1"
},
"deprecated": false,
"description": "ECMAScript “ToPrimitive” algorithm. Provides ES5 and ES6 versions.",
"devDependencies": {
"@ljharb/eslint-config": "^1.6.1",
"covert": "^1.1.0",
"eslint": "^1.10.3",
"foreach": "^2.0.5",
"jscs": "^2.7.0",
"nsp": "^2.2.0",
"object-is": "^1.0.1",
"replace": "^0.3.0",
"semver": "^5.1.0",
"tape": "^4.4.0"
},
"engines": {
"node": ">= 0.4"
},
"homepage": "https://github.com/ljharb/es-to-primitive#readme",
"keywords": [
"primitive",
"abstract",
"ecmascript",
"es5",
"es6",
"toPrimitive",
"coerce",
"type",
"object"
],
"license": "MIT",
"main": "index.js",
"name": "es-to-primitive",
"repository": {
"type": "git",
"url": "git://github.com/ljharb/es-to-primitive.git"
},
"scripts": {
"coverage": "covert test/*.js",
"coverage-quiet": "covert test/*.js --quiet",
"eslint": "eslint test/*.js *.js",
"jscs": "jscs test/*.js *.js",
"lint": "npm run jscs && npm run eslint",
"security": "nsp check",
"test": "npm run lint && npm run tests-only && npm run security",
"tests-only": "node --es-staging test"
},
"testling": {
"files": "test",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/10.0..latest",
"opera/next",
"safari/4.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"version": "1.1.1"
}

View File

@ -1,24 +0,0 @@
The MIT License
Copyright (c) 2013 Manuel Stofer
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,11 +0,0 @@
build: components
@component build
components: component.json
@component install --dev
clean:
rm -fr build components template.js
.PHONY: clean

View File

@ -1,30 +0,0 @@
# foreach
Iterate over the key value pairs of either an array-like object or a dictionary like object.
[![browser support][1]][2]
## API
### foreach(object, function, [context])
```js
var each = require('foreach');
each([1,2,3], function (value, key, array) {
// value === 1, 2, 3
// key === 0, 1, 2
// array === [1, 2, 3]
});
each({0:1,1:2,2:3}, function (value, key, object) {
// value === 1, 2, 3
// key === 0, 1, 2
// object === {0:1,1:2,2:3}
});
```
[1]: https://ci.testling.com/manuelstofer/foreach.png
[2]: https://ci.testling.com/manuelstofer/foreach

View File

@ -1,22 +0,0 @@
var hasOwn = Object.prototype.hasOwnProperty;
var toString = Object.prototype.toString;
module.exports = function forEach (obj, fn, ctx) {
if (toString.call(fn) !== '[object Function]') {
throw new TypeError('iterator must be a function');
}
var l = obj.length;
if (l === +l) {
for (var i = 0; i < l; i++) {
fn.call(ctx, obj[i], i, obj);
}
} else {
for (var k in obj) {
if (hasOwn.call(obj, k)) {
fn.call(ctx, obj[k], k, obj);
}
}
}
};

View File

@ -1,65 +0,0 @@
{
"author": {
"name": "Manuel Stofer",
"email": "manuel@takimata.ch"
},
"bugs": {
"url": "https://github.com/manuelstofer/foreach/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Manuel Stofer"
},
{
"name": "Jordan Harband",
"url": "https://github.com/ljharb"
}
],
"dependencies": {},
"deprecated": false,
"description": "foreach component + npm package",
"devDependencies": {
"covert": "*",
"tape": "*"
},
"homepage": "https://github.com/manuelstofer/foreach#readme",
"keywords": [
"shim",
"Array.prototype.forEach",
"forEach",
"Array#forEach",
"each"
],
"license": "MIT",
"main": "index.js",
"name": "foreach",
"repository": {
"type": "git",
"url": "git://github.com/manuelstofer/foreach.git"
},
"scripts": {
"coverage": "covert test.js",
"coverage-quiet": "covert --quiet test.js",
"test": "node test.js"
},
"testling": {
"files": "test.js",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0",
"chrome/22.0..latest",
"chrome/canary",
"opera/10.0..latest",
"opera/next",
"safari/5.0.5..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"version": "2.0.5"
}

View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2016 Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,45 +0,0 @@
# has-symbols <sup>[![Version Badge][2]][1]</sup>
[![Build Status][3]][4]
[![dependency status][5]][6]
[![dev dependency status][7]][8]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][11]][1]
Determine if the JS environment has Symbol support. Supports spec, or shams.
## Example
```js
var hasSymbols = require('has-symbols');
hasSymbols() === true; // if the environment has native Symbol support. Not polyfillable, not forgeable.
var hasSymbolsKinda = require('has-symbols/shams');
hasSymbolsKinda() === true; // if the environment has a Symbol sham that mostly follows the spec.
```
## Supported Symbol shams
- get-own-property-symbols [npm](https://www.npmjs.com/package/get-own-property-symbols) | [github](https://github.com/WebReflection/get-own-property-symbols)
- core-js [npm](https://www.npmjs.com/package/core-js) | [github](https://github.com/zloirock/core-js)
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[1]: https://npmjs.org/package/has-symbols
[2]: http://versionbadg.es/ljharb/has-symbols.svg
[3]: https://travis-ci.org/ljharb/has-symbols.svg
[4]: https://travis-ci.org/ljharb/has-symbols
[5]: https://david-dm.org/ljharb/has-symbols.svg
[6]: https://david-dm.org/ljharb/has-symbols
[7]: https://david-dm.org/ljharb/has-symbols/dev-status.svg
[8]: https://david-dm.org/ljharb/has-symbols#info=devDependencies
[9]: https://ci.testling.com/ljharb/has-symbols.png
[10]: https://ci.testling.com/ljharb/has-symbols
[11]: https://nodei.co/npm/has-symbols.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/has-symbols.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/has-symbols.svg
[downloads-url]: http://npm-stat.com/charts.html?package=has-symbols

View File

@ -1,13 +0,0 @@
'use strict';
var origSymbol = global.Symbol;
var hasSymbolSham = require('./shams');
module.exports = function hasNativeSymbols() {
if (typeof origSymbol !== 'function') { return false; }
if (typeof Symbol !== 'function') { return false; }
if (typeof origSymbol('foo') !== 'symbol') { return false; }
if (typeof Symbol('bar') !== 'symbol') { return false; }
return hasSymbolSham();
};

View File

@ -1,84 +0,0 @@
{
"author": {
"name": "Jordan Harband",
"email": "ljharb@gmail.com",
"url": "http://ljharb.codes"
},
"bugs": {
"url": "https://github.com/ljharb/has-symbols/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Jordan Harband",
"email": "ljharb@gmail.com",
"url": "http://ljharb.codes"
}
],
"dependencies": {},
"deprecated": false,
"description": "Determine if the JS environment has Symbol support. Supports spec, or shams.",
"devDependencies": {
"@ljharb/eslint-config": "^8.0.0",
"core-js": "^2.4.1",
"eslint": "^3.5.0",
"get-own-property-symbols": "^0.9.2",
"nsp": "^2.6.1",
"safe-publish-latest": "^1.0.1",
"tape": "^4.6.0"
},
"engines": {
"node": ">= 0.4"
},
"homepage": "https://github.com/ljharb/has-symbols#readme",
"keywords": [
"Symbol",
"symbols",
"typeof",
"sham",
"polyfill",
"native",
"core-js",
"ES6"
],
"license": "MIT",
"main": "index.js",
"name": "has-symbols",
"repository": {
"type": "git",
"url": "git://github.com/ljharb/has-symbols.git"
},
"scripts": {
"lint": "eslint *.js",
"posttest": "npm run --silent security",
"prepublish": "safe-publish-latest",
"pretest": "npm run --silent lint",
"security": "nsp check",
"test": "npm run --silent tests-only",
"test:shams": "npm run --silent test:shams:getownpropertysymbols && npm run --silent test:shams:corejs",
"test:shams:corejs": "node test/shams/core-js.js",
"test:shams:getownpropertysymbols": "node test/shams/get-own-property-symbols.js",
"test:staging": "node --harmony --es-staging test",
"test:stock": "node test",
"tests-only": "npm run --silent test:stock && npm run --silent test:staging && npm run --silent test:shams"
},
"testling": {
"files": "test/index.js",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/10.0..latest",
"opera/next",
"safari/4.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"version": "1.0.0"
}

View File

@ -1,42 +0,0 @@
'use strict';
/* eslint complexity: [2, 17], max-statements: [2, 33] */
module.exports = function hasSymbols() {
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
if (typeof Symbol.iterator === 'symbol') { return true; }
var obj = {};
var sym = Symbol('test');
var symObj = Object(sym);
if (typeof sym === 'string') { return false; }
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
// temp disabled per https://github.com/ljharb/object.assign/issues/17
// if (sym instanceof Symbol) { return false; }
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
// if (!(symObj instanceof Symbol)) { return false; }
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
var symVal = 42;
obj[sym] = symVal;
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
var syms = Object.getOwnPropertySymbols(obj);
if (syms.length !== 1 || syms[0] !== sym) { return false; }
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
if (typeof Object.getOwnPropertyDescriptor === 'function') {
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
}
return true;
};

View File

@ -51,9 +51,10 @@ Since `4.0.0`, ignore will no longer support `node < 6` by default, to use in no
## Table Of Main Contents
- [Usage](#usage)
- [`Pathname` Conventions](#pathname-conventions)
- [Guide for 2.x -> 3.x](#upgrade-2x---3x)
- [Guide for 3.x -> 4.x](#upgrade-3x---4x)
- Related Packages
- See Also:
- [`glob-gitignore`](https://www.npmjs.com/package/glob-gitignore) matches files using patterns and filters them according to gitignore rules.
## Usage
@ -106,13 +107,13 @@ ig.filter(['.abc\\a.js', '.abc\\d\\e.js'])
- `'a \ '` matches `'a '`
- All test cases are verified with the result of `git check-ignore`.
## Methods
# Methods
### .add(pattern)
### .add(patterns)
## .add(pattern: string | Ignore): this
## .add(patterns: Array<string | Ignore>): this
- **pattern** `String|Ignore` An ignore pattern string, or the `Ignore` instance
- **patterns** `Array.<pattern>` Array of ignore patterns.
- **pattern** `String | Ignore` An ignore pattern string, or the `Ignore` instance
- **patterns** `Array<String | Ignore>` Array of ignore patterns.
Adds a rule or several rules to the current manager.
@ -135,7 +136,7 @@ ignore()
`pattern` could also be an `ignore` instance, so that we could easily inherit the rules of another `Ignore` instance.
### <strike>.addIgnoreFile(path)</strike>
## <strike>.addIgnoreFile(path)</strike>
REMOVED in `3.x` for now.
@ -151,26 +152,21 @@ if (fs.existsSync(filename)) {
instead.
## .filter(paths: Array<Pathname>): Array<Pathname>
### .ignores(pathname)
> new in 3.2.0
Returns `Boolean` whether `pathname` should be ignored.
```js
ig.ignores('.abc/a.js') // true
```ts
type Pathname = string
```
### .filter(paths)
Filters the given array of pathnames, and returns the filtered array.
- **paths** `Array.<path>` The array of `pathname`s to be filtered.
- **paths** `Array.<Pathname>` The array of `pathname`s to be filtered.
**NOTICE** that:
### `Pathname` Conventions:
- `pathname` should be a string that have been `path.join()`ed, or the return value of `path.relative()` to the current directory.
#### 1. `Pathname` should be a `path.relative()`d pathname
`Pathname` should be a string that have been `path.join()`ed, or the return value of `path.relative()` to the current directory.
```js
// WRONG
@ -191,7 +187,7 @@ ig.ignores('abc')
ig.ignores(path.join('./abc')) // path.join('./abc') -> 'abc'
```
- In other words, each `pathname` here should be a relative path to the directory of the git ignore rules.
In other words, each `Pathname` here should be a relative path to the directory of the gitignore rules.
Suppose the dir structure is:
@ -234,7 +230,32 @@ glob('**', {
})
```
### .createFilter()
#### 2. filenames and dirnames
`node-ignore` does NO `fs.stat` during path matching, so for the example below:
```js
ig.add('config/')
// `ig` does NOT know if 'config' is a normal file, directory or something
ig.ignores('config') // And it returns `false`
ig.ignores('config/') // returns `true`
```
Specially for people who develop some library based on `node-ignore`, it is important to understand that.
## .ignores(pathname: Pathname): boolean
> new in 3.2.0
Returns `Boolean` whether `pathname` should be ignored.
```js
ig.ignores('.abc/a.js') // true
```
## .createFilter()
Creates a filter function which could filter an array of paths with `Array.prototype.filter`.
@ -256,6 +277,8 @@ ig.ignores('*.PNG') // false
****
# Upgrade Guide
## Upgrade 2.x -> 3.x
- All `options` of 2.x are unnecessary and removed, so just remove them.
@ -272,7 +295,7 @@ var ignore = require('ignore/legacy')
****
## Collaborators
# Collaborators
- [@whitecolor](https://github.com/whitecolor) *Alex*
- [@SamyPesse](https://github.com/SamyPesse) *Samy Pessé*

View File

@ -265,7 +265,7 @@ const NEGATIVE_REPLACERS = [
]
// A simple cache, because an ignore rule only has only one certain meaning
const cache = {}
const cache = Object.create(null)
// @param {pattern}
const make_regex = (pattern, negative, ignorecase) => {
@ -335,7 +335,7 @@ class IgnoreBase {
}
_initCache () {
this._cache = {}
this._cache = Object.create(null)
}
// @param {Array.<string>|string|Ignore} pattern

View File

@ -242,7 +242,7 @@ var NEGATIVE_REPLACERS = [].concat(DEFAULT_REPLACER_PREFIX, [
}]], DEFAULT_REPLACER_SUFFIX);
// A simple cache, because an ignore rule only has only one certain meaning
var cache = {};
var cache = Object.create(null);
// @param {pattern}
var make_regex = function make_regex(pattern, negative, ignorecase) {
@ -313,7 +313,7 @@ var IgnoreBase = function () {
_createClass(IgnoreBase, [{
key: '_initCache',
value: function _initCache() {
this._cache = {};
this._cache = Object.create(null);
}
// @param {Array.<string>|string|Ignore} pattern

View File

@ -11,17 +11,17 @@
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.7.0",
"codecov": "^3.0.2",
"eslint": "^5.0.0-rc.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.12.0",
"codecov": "^3.0.4",
"eslint": "^5.3.0",
"eslint-config-ostai": "^1.3.2",
"eslint-plugin-import": "^2.13.0",
"mkdirp": "^0.5.1",
"pre-suf": "^1.1.0",
"rimraf": "^2.6.2",
"spawn-sync": "^2.0.0",
"tap": "^12.0.1",
"tmp": "0.0.33",
"typescript": "^2.9.2"
"typescript": "^3.0.1"
},
"engines": {
"node": ">= 4"
@ -65,5 +65,5 @@
"test:lint": "eslint .",
"test:tsc": "tsc ./test/ts/simple.ts"
},
"version": "4.0.3"
"version": "4.0.6"
}

View File

@ -1,47 +0,0 @@
verbose: false
instrumentation:
root: .
extensions:
- .js
- .jsx
default-excludes: true
excludes: []
variable: __coverage__
compact: true
preserve-comments: false
complete-copy: false
save-baseline: false
baseline-file: ./coverage/coverage-baseline.raw.json
include-all-sources: false
include-pid: false
es-modules: false
auto-wrap: false
reporting:
print: summary
reports:
- html
dir: ./coverage
summarizer: pkg
report-config: {}
watermarks:
statements: [50, 80]
functions: [50, 80]
branches: [50, 80]
lines: [50, 80]
hooks:
hook-run-in-context: false
post-require-hook: null
handle-sigint: false
check:
global:
statements: 100
lines: 100
branches: 100
functions: 100
excludes: []
each:
statements: 100
lines: 100
branches: 100
functions: 100
excludes: []

View File

@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015 Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,61 +0,0 @@
# Since we rely on paths relative to the makefile location, abort if make isn't being run from there.
$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in))
# The files that need updating when incrementing the version number.
VERSIONED_FILES := *.js *.json README*
# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly.
# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment
# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests.
export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH")
UTILS := semver
# Make sure that all required utilities can be located.
UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS)))
# Default target (by virtue of being the first non '.'-prefixed in the file).
.PHONY: _no-target-specified
_no-target-specified:
$(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests)
# Lists all targets defined in this makefile.
.PHONY: list
list:
@$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort
# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS).
.PHONY: test
test:
@npm test
.PHONY: _ensure-tag
_ensure-tag:
ifndef TAG
$(error Please invoke with `make TAG=<new-version> release`, where <new-version> is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number)
endif
CHANGELOG_ERROR = $(error No CHANGELOG specified)
.PHONY: _ensure-changelog
_ensure-changelog:
@ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2)
# Ensures that the git workspace is clean.
.PHONY: _ensure-clean
_ensure-clean:
@[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; }
# Makes a release; invoke with `make TAG=<versionOrIncrementSpec> release`.
.PHONY: release
release: _ensure-tag _ensure-changelog _ensure-clean
@old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \
new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \
if printf "$$new_ver" | command grep -q '^[0-9]'; then \
semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \
semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \
else \
new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \
fi; \
printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \
replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \
git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \
git tag -a -m "v$$new_ver" "v$$new_ver"

View File

@ -1,59 +0,0 @@
# is-callable <sup>[![Version Badge][2]][1]</sup>
[![Build Status][3]][4]
[![dependency status][5]][6]
[![dev dependency status][7]][8]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][11]][1]
[![browser support][9]][10]
Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.
## Example
```js
var isCallable = require('is-callable');
var assert = require('assert');
assert.notOk(isCallable(undefined));
assert.notOk(isCallable(null));
assert.notOk(isCallable(false));
assert.notOk(isCallable(true));
assert.notOk(isCallable([]));
assert.notOk(isCallable({}));
assert.notOk(isCallable(/a/g));
assert.notOk(isCallable(new RegExp('a', 'g')));
assert.notOk(isCallable(new Date()));
assert.notOk(isCallable(42));
assert.notOk(isCallable(NaN));
assert.notOk(isCallable(Infinity));
assert.notOk(isCallable(new Number(42)));
assert.notOk(isCallable('foo'));
assert.notOk(isCallable(Object('foo')));
assert.ok(isCallable(function () {}));
assert.ok(isCallable(function* () {}));
assert.ok(isCallable(x => x * x));
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[1]: https://npmjs.org/package/is-callable
[2]: http://versionbadg.es/ljharb/is-callable.svg
[3]: https://travis-ci.org/ljharb/is-callable.svg
[4]: https://travis-ci.org/ljharb/is-callable
[5]: https://david-dm.org/ljharb/is-callable.svg
[6]: https://david-dm.org/ljharb/is-callable
[7]: https://david-dm.org/ljharb/is-callable/dev-status.svg
[8]: https://david-dm.org/ljharb/is-callable#info=devDependencies
[9]: https://ci.testling.com/ljharb/is-callable.png
[10]: https://ci.testling.com/ljharb/is-callable
[11]: https://nodei.co/npm/is-callable.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/is-callable.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/is-callable.svg
[downloads-url]: http://npm-stat.com/charts.html?package=is-callable

View File

@ -1,37 +0,0 @@
'use strict';
var fnToStr = Function.prototype.toString;
var constructorRegex = /^\s*class\b/;
var isES6ClassFn = function isES6ClassFunction(value) {
try {
var fnStr = fnToStr.call(value);
return constructorRegex.test(fnStr);
} catch (e) {
return false; // not a function
}
};
var tryFunctionObject = function tryFunctionToStr(value) {
try {
if (isES6ClassFn(value)) { return false; }
fnToStr.call(value);
return true;
} catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var fnClass = '[object Function]';
var genClass = '[object GeneratorFunction]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
module.exports = function isCallable(value) {
if (!value) { return false; }
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
if (typeof value === 'function' && !value.prototype) { return true; }
if (hasToStringTag) { return tryFunctionObject(value); }
if (isES6ClassFn(value)) { return false; }
var strClass = toStr.call(value);
return strClass === fnClass || strClass === genClass;
};

View File

@ -1,100 +0,0 @@
{
"author": {
"name": "Jordan Harband",
"email": "ljharb@gmail.com",
"url": "http://ljharb.codes"
},
"bugs": {
"url": "https://github.com/ljharb/is-callable/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Jordan Harband",
"email": "ljharb@gmail.com",
"url": "http://ljharb.codes"
}
],
"dependencies": {},
"deprecated": false,
"description": "Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.",
"devDependencies": {
"@ljharb/eslint-config": "^12.2.1",
"covert": "^1.1.0",
"editorconfig-tools": "^0.1.1",
"eslint": "^4.19.1",
"foreach": "^2.0.5",
"istanbul": "1.1.0-alpha.1",
"istanbul-merge": "^1.1.1",
"jscs": "^3.0.7",
"make-arrow-function": "^1.1.0",
"make-generator-function": "^1.1.0",
"nsp": "^3.2.1",
"rimraf": "^2.6.2",
"semver": "^5.5.0",
"tape": "^4.9.1"
},
"engines": {
"node": ">= 0.4"
},
"homepage": "https://github.com/ljharb/is-callable#readme",
"keywords": [
"Function",
"function",
"callable",
"generator",
"generator function",
"arrow",
"arrow function",
"ES6",
"toStringTag",
"@@toStringTag"
],
"license": "MIT",
"main": "index.js",
"name": "is-callable",
"repository": {
"type": "git",
"url": "git://github.com/ljharb/is-callable.git"
},
"scripts": {
"coverage": "npm run --silent istanbul",
"covert": "covert test.js",
"covert:quiet": "covert test.js --quiet",
"eslint": "eslint *.js",
"istanbul": "npm run --silent istanbul:clean && npm run --silent istanbul:std && npm run --silent istanbul:harmony && npm run --silent istanbul:merge && istanbul check",
"istanbul:clean": "rimraf coverage coverage-std coverage-harmony",
"istanbul:harmony": "node --harmony ./node_modules/istanbul/lib/cli.js cover test.js --dir coverage-harmony",
"istanbul:merge": "istanbul-merge --out coverage/coverage.raw.json coverage-harmony/coverage.raw.json coverage-std/coverage.raw.json && istanbul report html",
"istanbul:std": "istanbul cover test.js --report html --dir coverage-std",
"jscs": "jscs *.js",
"lint": "npm run jscs && npm run eslint",
"posttest": "npm run --silent security",
"prelint": "editorconfig-tools check *",
"pretest": "npm run --silent lint",
"security": "nsp check",
"test": "npm run --silent tests-only",
"test:staging": "node --es-staging test.js",
"test:stock": "node test.js",
"tests-only": "npm run --silent test:stock && npm run --silent test:staging"
},
"testling": {
"files": "test.js",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/10.0..latest",
"opera/next",
"safari/4.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"version": "1.1.4"
}

View File

@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015 Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,61 +0,0 @@
# Since we rely on paths relative to the makefile location, abort if make isn't being run from there.
$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in))
# The files that need updating when incrementing the version number.
VERSIONED_FILES := *.js *.json README*
# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly.
# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment
# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests.
export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH")
UTILS := semver
# Make sure that all required utilities can be located.
UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS)))
# Default target (by virtue of being the first non '.'-prefixed in the file).
.PHONY: _no-target-specified
_no-target-specified:
$(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests)
# Lists all targets defined in this makefile.
.PHONY: list
list:
@$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort
# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS).
.PHONY: test
test:
@npm test
.PHONY: _ensure-tag
_ensure-tag:
ifndef TAG
$(error Please invoke with `make TAG=<new-version> release`, where <new-version> is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number)
endif
CHANGELOG_ERROR = $(error No CHANGELOG specified)
.PHONY: _ensure-changelog
_ensure-changelog:
@ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2)
# Ensures that the git workspace is clean.
.PHONY: _ensure-clean
_ensure-clean:
@[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; }
# Makes a release; invoke with `make TAG=<versionOrIncrementSpec> release`.
.PHONY: release
release: _ensure-tag _ensure-changelog _ensure-clean
@old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \
new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \
if printf "$$new_ver" | command grep -q '^[0-9]'; then \
semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \
semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \
else \
new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \
fi; \
printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \
replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \
git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \
git tag -a -m "v$$new_ver" "v$$new_ver"

View File

@ -1,53 +0,0 @@
# is-date-object <sup>[![Version Badge][2]][1]</sup>
[![Build Status][3]][4]
[![dependency status][5]][6]
[![dev dependency status][7]][8]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][11]][1]
[![browser support][9]][10]
Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
## Example
```js
var isDate = require('is-date-object');
var assert = require('assert');
assert.notOk(isDate(undefined));
assert.notOk(isDate(null));
assert.notOk(isDate(false));
assert.notOk(isDate(true));
assert.notOk(isDate(42));
assert.notOk(isDate('foo'));
assert.notOk(isDate(function () {}));
assert.notOk(isDate([]));
assert.notOk(isDate({}));
assert.notOk(isDate(/a/g));
assert.notOk(isDate(new RegExp('a', 'g')));
assert.ok(isDate(new Date()));
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[1]: https://npmjs.org/package/is-date-object
[2]: http://versionbadg.es/ljharb/is-date-object.svg
[3]: https://travis-ci.org/ljharb/is-date-object.svg
[4]: https://travis-ci.org/ljharb/is-date-object
[5]: https://david-dm.org/ljharb/is-date-object.svg
[6]: https://david-dm.org/ljharb/is-date-object
[7]: https://david-dm.org/ljharb/is-date-object/dev-status.svg
[8]: https://david-dm.org/ljharb/is-date-object#info=devDependencies
[9]: https://ci.testling.com/ljharb/is-date-object.png
[10]: https://ci.testling.com/ljharb/is-date-object
[11]: https://nodei.co/npm/is-date-object.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/is-date-object.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/is-date-object.svg
[downloads-url]: http://npm-stat.com/charts.html?package=is-date-object

View File

@ -1,20 +0,0 @@
'use strict';
var getDay = Date.prototype.getDay;
var tryDateObject = function tryDateObject(value) {
try {
getDay.call(value);
return true;
} catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var dateClass = '[object Date]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
module.exports = function isDateObject(value) {
if (typeof value !== 'object' || value === null) { return false; }
return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
};

View File

@ -1,70 +0,0 @@
{
"author": {
"name": "Jordan Harband"
},
"bugs": {
"url": "https://github.com/ljharb/is-date-object/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.",
"devDependencies": {
"@ljharb/eslint-config": "^1.2.0",
"covert": "^1.1.0",
"eslint": "^1.5.1",
"foreach": "^2.0.5",
"indexof": "^0.0.1",
"is": "^3.1.0",
"jscs": "^2.1.1",
"nsp": "^1.1.0",
"semver": "^5.0.3",
"tape": "^4.2.0"
},
"engines": {
"node": ">= 0.4"
},
"homepage": "https://github.com/ljharb/is-date-object#readme",
"keywords": [
"Date",
"ES6",
"toStringTag",
"@@toStringTag",
"Date object"
],
"license": "MIT",
"main": "index.js",
"name": "is-date-object",
"repository": {
"type": "git",
"url": "git://github.com/ljharb/is-date-object.git"
},
"scripts": {
"coverage": "covert test.js",
"coverage-quiet": "covert test.js --quiet",
"eslint": "eslint test.js *.js",
"jscs": "jscs test.js *.js",
"lint": "npm run jscs && npm run eslint",
"security": "nsp package",
"test": "npm run lint && node --harmony --es-staging test.js && npm run security"
},
"testling": {
"files": "test.js",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/10.0..latest",
"opera/next",
"safari/4.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"version": "1.0.1"
}

View File

@ -1,20 +0,0 @@
The MIT License (MIT)
Copyright (c) 2014 Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,61 +0,0 @@
# Since we rely on paths relative to the makefile location, abort if make isn't being run from there.
$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in))
# The files that need updating when incrementing the version number.
VERSIONED_FILES := *.js *.json README*
# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly.
# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment
# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests.
export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH")
UTILS := semver
# Make sure that all required utilities can be located.
UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS)))
# Default target (by virtue of being the first non '.'-prefixed in the file).
.PHONY: _no-target-specified
_no-target-specified:
$(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests)
# Lists all targets defined in this makefile.
.PHONY: list
list:
@$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort
# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS).
.PHONY: test
test:
@npm test
.PHONY: _ensure-tag
_ensure-tag:
ifndef TAG
$(error Please invoke with `make TAG=<new-version> release`, where <new-version> is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number)
endif
CHANGELOG_ERROR = $(error No CHANGELOG specified)
.PHONY: _ensure-changelog
_ensure-changelog:
@ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2)
# Ensures that the git workspace is clean.
.PHONY: _ensure-clean
_ensure-clean:
@[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; }
# Makes a release; invoke with `make TAG=<versionOrIncrementSpec> release`.
.PHONY: release
release: _ensure-tag _ensure-changelog _ensure-clean
@old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \
new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \
if printf "$$new_ver" | command grep -q '^[0-9]'; then \
semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \
semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \
else \
new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \
fi; \
printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \
replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \
git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \
git tag -a -m "v$$new_ver" "v$$new_ver"

View File

@ -1,54 +0,0 @@
#is-regex <sup>[![Version Badge][2]][1]</sup>
[![Build Status][3]][4]
[![dependency status][5]][6]
[![dev dependency status][7]][8]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][11]][1]
[![browser support][9]][10]
Is this value a JS regex?
This module works cross-realm/iframe, and despite ES6 @@toStringTag.
## Example
```js
var isRegex = require('is-regex');
var assert = require('assert');
assert.notOk(isRegex(undefined));
assert.notOk(isRegex(null));
assert.notOk(isRegex(false));
assert.notOk(isRegex(true));
assert.notOk(isRegex(42));
assert.notOk(isRegex('foo'));
assert.notOk(isRegex(function () {}));
assert.notOk(isRegex([]));
assert.notOk(isRegex({}));
assert.ok(isRegex(/a/g));
assert.ok(isRegex(new RegExp('a', 'g')));
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[1]: https://npmjs.org/package/is-regex
[2]: http://versionbadg.es/ljharb/is-regex.svg
[3]: https://travis-ci.org/ljharb/is-regex.svg
[4]: https://travis-ci.org/ljharb/is-regex
[5]: https://david-dm.org/ljharb/is-regex.svg
[6]: https://david-dm.org/ljharb/is-regex
[7]: https://david-dm.org/ljharb/is-regex/dev-status.svg
[8]: https://david-dm.org/ljharb/is-regex#info=devDependencies
[9]: https://ci.testling.com/ljharb/is-regex.png
[10]: https://ci.testling.com/ljharb/is-regex
[11]: https://nodei.co/npm/is-regex.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/is-regex.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/is-regex.svg
[downloads-url]: http://npm-stat.com/charts.html?package=is-regex

View File

@ -1,39 +0,0 @@
'use strict';
var has = require('has');
var regexExec = RegExp.prototype.exec;
var gOPD = Object.getOwnPropertyDescriptor;
var tryRegexExecCall = function tryRegexExec(value) {
try {
var lastIndex = value.lastIndex;
value.lastIndex = 0;
regexExec.call(value);
return true;
} catch (e) {
return false;
} finally {
value.lastIndex = lastIndex;
}
};
var toStr = Object.prototype.toString;
var regexClass = '[object RegExp]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
module.exports = function isRegex(value) {
if (!value || typeof value !== 'object') {
return false;
}
if (!hasToStringTag) {
return toStr.call(value) === regexClass;
}
var descriptor = gOPD(value, 'lastIndex');
var hasLastIndexDataProperty = descriptor && has(descriptor, 'value');
if (!hasLastIndexDataProperty) {
return false;
}
return tryRegexExecCall(value);
};

View File

@ -1,77 +0,0 @@
{
"author": {
"name": "Jordan Harband"
},
"bugs": {
"url": "https://github.com/ljharb/is-regex/issues"
},
"bundleDependencies": false,
"dependencies": {
"has": "^1.0.1"
},
"deprecated": false,
"description": "Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag",
"devDependencies": {
"@ljharb/eslint-config": "^11.0.0",
"covert": "^1.1.0",
"editorconfig-tools": "^0.1.1",
"eslint": "^3.15.0",
"jscs": "^3.0.7",
"nsp": "^2.6.2",
"replace": "^0.3.0",
"semver": "^5.3.0",
"tape": "^4.6.3"
},
"engines": {
"node": ">= 0.4"
},
"homepage": "https://github.com/ljharb/is-regex",
"keywords": [
"regex",
"regexp",
"is",
"regular expression",
"regular",
"expression"
],
"license": "MIT",
"main": "index.js",
"name": "is-regex",
"repository": {
"type": "git",
"url": "git://github.com/ljharb/is-regex.git"
},
"scripts": {
"coverage": "covert test.js",
"coverage-quiet": "covert test.js --quiet",
"eccheck": "editorconfig-tools check *.js **/*.js > /dev/null",
"eslint": "eslint test.js *.js",
"jscs": "jscs *.js",
"lint": "npm run jscs && npm run eslint",
"posttest": "npm run security",
"pretest": "npm run lint",
"security": "nsp check",
"test": "npm run tests-only",
"tests-only": "node --harmony --es-staging test.js"
},
"testling": {
"files": "test.js",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/10.0..12.0",
"opera/15.0..latest",
"opera/next",
"safari/4.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"version": "1.0.4"
}

View File

@ -1 +0,0 @@
iojs

View File

@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2015 Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,61 +0,0 @@
# Since we rely on paths relative to the makefile location, abort if make isn't being run from there.
$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in))
# The files that need updating when incrementing the version number.
VERSIONED_FILES := *.js *.json README*
# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly.
# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment
# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests.
export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH")
UTILS := semver
# Make sure that all required utilities can be located.
UTIL_CHECK := $(or $(shell PATH="$(PATH)" which $(UTILS) >/dev/null && echo 'ok'),$(error Did you forget to run `npm install` after cloning the repo? At least one of the required supporting utilities not found: $(UTILS)))
# Default target (by virtue of being the first non '.'-prefixed in the file).
.PHONY: _no-target-specified
_no-target-specified:
$(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests)
# Lists all targets defined in this makefile.
.PHONY: list
list:
@$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | command grep -v -e '^[^[:alnum:]]' -e '^$@$$command ' | sort
# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS).
.PHONY: test
test:
@npm test
.PHONY: _ensure-tag
_ensure-tag:
ifndef TAG
$(error Please invoke with `make TAG=<new-version> release`, where <new-version> is either an increment specifier (patch, minor, major, prepatch, preminor, premajor, prerelease), or an explicit major.minor.patch version number)
endif
CHANGELOG_ERROR = $(error No CHANGELOG specified)
.PHONY: _ensure-changelog
_ensure-changelog:
@ (git status -sb --porcelain | command grep -E '^( M|[MA] ) CHANGELOG.md' > /dev/null) || (echo no CHANGELOG.md specified && exit 2)
# Ensures that the git workspace is clean.
.PHONY: _ensure-clean
_ensure-clean:
@[ -z "$$((git status --porcelain --untracked-files=no || echo err) | command grep -v 'CHANGELOG.md')" ] || { echo "Workspace is not clean; please commit changes first." >&2; exit 2; }
# Makes a release; invoke with `make TAG=<versionOrIncrementSpec> release`.
.PHONY: release
release: _ensure-tag _ensure-changelog _ensure-clean
@old_ver=`git describe --abbrev=0 --tags --match 'v[0-9]*.[0-9]*.[0-9]*'` || { echo "Failed to determine current version." >&2; exit 1; }; old_ver=$${old_ver#v}; \
new_ver=`echo "$(TAG)" | sed 's/^v//'`; new_ver=$${new_ver:-patch}; \
if printf "$$new_ver" | command grep -q '^[0-9]'; then \
semver "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be major.minor.patch' >&2; exit 2; }; \
semver -r "> $$old_ver" "$$new_ver" >/dev/null || { echo 'Invalid version number specified: $(TAG) - must be HIGHER than current one.' >&2; exit 2; } \
else \
new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \
fi; \
printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \
replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \
git commit -m "v$$new_ver" $(VERSIONED_FILES) CHANGELOG.md && \
git tag -a -m "v$$new_ver" "v$$new_ver"

View File

@ -1,46 +0,0 @@
#is-symbol <sup>[![Version Badge][2]][1]</sup>
[![Build Status][3]][4]
[![dependency status][5]][6]
[![dev dependency status][7]][8]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][11]][1]
[![browser support][9]][10]
Is this an ES6 Symbol value?
## Example
```js
var isSymbol = require('is-symbol');
assert(!isSymbol(function () {}));
assert(!isSymbol(null));
assert(!isSymbol(function* () { yield 42; return Infinity; });
assert(isSymbol(Symbol.iterator));
assert(isSymbol(Symbol('foo')));
assert(isSymbol(Symbol.for('foo')));
assert(isSymbol(Object(Symbol('foo'))));
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[1]: https://npmjs.org/package/is-symbol
[2]: http://vb.teelaun.ch/ljharb/is-symbol.svg
[3]: https://travis-ci.org/ljharb/is-symbol.svg
[4]: https://travis-ci.org/ljharb/is-symbol
[5]: https://david-dm.org/ljharb/is-symbol.svg
[6]: https://david-dm.org/ljharb/is-symbol
[7]: https://david-dm.org/ljharb/is-symbol/dev-status.svg
[8]: https://david-dm.org/ljharb/is-symbol#info=devDependencies
[9]: https://ci.testling.com/ljharb/is-symbol.png
[10]: https://ci.testling.com/ljharb/is-symbol
[11]: https://nodei.co/npm/is-symbol.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/is-symbol.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/is-symbol.svg
[downloads-url]: http://npm-stat.com/charts.html?package=is-symbol

Some files were not shown because too many files have changed in this diff Show More