Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

es-abstract

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es-abstract - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

38

.jscs.json
{
"additionalRules": [],
"requireSemicolons": true,
"disallowMultipleSpaces": true,
"disallowIdentifierNames": [],
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],

@@ -66,4 +72,34 @@

"mark": "'"
}
},
"disallowOperatorBeforeLineBreak": [],
"requireSpaceBeforeKeywords": [
"do",
"for",
"if",
"else",
"switch",
"case",
"try",
"catch",
"finally",
"while",
"with",
"return"
],
"validateAlignedFunctionParameters": {
"lineBreakAfterOpeningBraces": true,
"lineBreakBeforeClosingBraces": true
},
"requirePaddingNewLinesBeforeExport": true,
"validateNewlineAfterArrayElements": {
"maximum": 9
},
"requirePaddingNewLinesAfterUseStrict": true
}

@@ -0,1 +1,7 @@

1.2.2 / 2015-07-28
=================
* [Fix] Both `ES5.CheckObjectCoercible` and `ES6.RequireObjectCoercible` return the value if they don't throw.
* [Tests] Test on latest `io.js` versions.
* [Dev Deps] Update `eslint`, `jscs`, `tape`, `semver`, `covert`, `nsp`
1.2.1 / 2015-03-20

@@ -2,0 +8,0 @@ =================

4

es5.js

@@ -52,7 +52,7 @@ 'use strict';

}
return value;
},
IsCallable: IsCallable,
SameValue: function SameValue(x, y) {
if (x === y) {
// 0 === -0, but they are not identical.
if (x === y) { // 0 === -0, but they are not identical.
if (x === 0) { return 1 / x === 1 / y; }

@@ -59,0 +59,0 @@ return true;

@@ -21,2 +21,3 @@ 'use strict';

var ES6 = assign(assign({}, ES5), {
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-call-f-v-args

@@ -140,4 +141,3 @@ Call: function Call(F, V) {

IsConstructor: function IsConstructor(argument) {
// unfortunately there's no way to truly check this without try/catch `new argument`
return this.IsCallable(argument);
return this.IsCallable(argument); // unfortunately there's no way to truly check this without try/catch `new argument`
},

@@ -183,2 +183,3 @@

delete ES6.CheckObjectCoercible; // renamed in ES6 to RequireObjectCoercible
module.exports = ES6;

@@ -0,1 +1,3 @@

'use strict';
var ES6 = require('./es6');

@@ -2,0 +4,0 @@ var assign = require('./helpers/assign');

{
"name": "es-abstract",
"version": "1.2.1",
"version": "1.2.2",
"author": "Jordan Harband",

@@ -38,11 +38,12 @@ "description": "ECMAScript spec abstract operations.",

"devDependencies": {
"tape": "^3.5.0",
"covert": "^1.0.1",
"jscs": "^1.11.3",
"tape": "^4.0.1",
"covert": "^1.1.0",
"jscs": "^1.13.1",
"editorconfig-tools": "^0.1.1",
"nsp": "^1.0.1",
"eslint": "^0.17.1",
"nsp": "^1.0.3",
"eslint": "^1.0.0-rc-2",
"@ljharb/eslint-config": "^1.0.3",
"object-is": "^1.0.1",
"foreach": "^2.0.5",
"semver": "^4.3.1",
"semver": "^5.0.1",
"replace": "^0.3.0"

@@ -49,0 +50,0 @@ },

@@ -0,1 +1,3 @@

'use strict';
var ES = require('../').ES5;

@@ -20,5 +22,6 @@ var test = require('tape');

t.test('primitives', function (st) {
forEach(primitives, function (primitive) {
var testPrimitive = function (primitive) {
st.ok(is(ES.ToPrimitive(primitive), primitive), primitive + ' is returned correctly');
});
};
forEach(primitives, testPrimitive);
st.end();

@@ -75,3 +78,3 @@ });

forEach(['foo', '0', '4a', '2.0', 'Infinity', '-Infinity'], function (numString) {
t.ok(is(+numString, ES.ToNumber(numString)), '"' + numString + '" coerces to ' + (+numString));
t.ok(is(+numString, ES.ToNumber(numString)), '"' + numString + '" coerces to ' + Number(numString));
});

@@ -168,5 +171,6 @@ forEach(objects, function (object) {

t.throws(function () { return ES.CheckObjectCoercible(null); }, TypeError, 'null throws');
forEach(objects.concat(nonNullPrimitives), function (value) {
var checkCoercible = function (value) {
t.doesNotThrow(function () { return ES.CheckObjectCoercible(value); }, '"' + value + '" does not throw');
});
};
forEach(objects.concat(nonNullPrimitives), checkCoercible);
t.end();

@@ -173,0 +177,0 @@ });

@@ -0,1 +1,3 @@

'use strict';
var ES = require('../').ES6;

@@ -6,2 +8,3 @@ var test = require('tape');

var is = require('object-is');
var debug = require('util').format;

@@ -23,5 +26,6 @@ var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';

t.test('primitives', function (st) {
forEach(primitives, function (primitive) {
var testPrimitive = function (primitive) {
st.ok(is(ES.ToPrimitive(primitive), primitive), primitive + ' is returned correctly');
});
};
forEach(primitives, testPrimitive);
st.end();

@@ -76,3 +80,3 @@ });

forEach(['foo', '0', '4a', '2.0', 'Infinity', '-Infinity'], function (numString) {
t.ok(is(+numString, ES.ToNumber(numString)), '"' + numString + '" coerces to ' + (+numString));
t.ok(is(+numString, ES.ToNumber(numString)), '"' + numString + '" coerces to ' + Number(numString));
});

@@ -224,3 +228,9 @@ forEach(objects, function (object) {

test('ToString', function (t) {
forEach(objects.concat(primitives), function (item) {
t.equal(ES.ToString(item), String(item), 'ES.ToString(' + debug(item) + ') ToStrings to String(' + debug(item) + ')');
});
t.throws(function () { return ES.ToString(uncoercibleObject); }, TypeError, 'uncoercibleObject throws');
if (hasSymbols) {
t.throws(function () { return ES.ToString(Symbol.iterator); }, TypeError, debug(Symbol.iterator) + ' throws');
}
t.end();

@@ -245,5 +255,6 @@ });

t.throws(function () { return ES.RequireObjectCoercible(null); }, TypeError, 'null throws');
forEach(objects.concat(nonNullPrimitives), function (value) {
var doesNotThrow = function (value) {
t.doesNotThrow(function () { return ES.RequireObjectCoercible(value); }, '"' + value + '" does not throw');
});
};
forEach(objects.concat(nonNullPrimitives), doesNotThrow);
t.end();

@@ -362,5 +373,6 @@ });

test('CanonicalNumericIndexString', function (t) {
forEach(objects.concat(numbers), function (notString) {
var throwsOnNonString = function (notString) {
t.throws(function () { return ES.CanonicalNumericIndexString(notString); }, TypeError, notString + ' is not a string');
});
};
forEach(objects.concat(numbers), throwsOnNonString);
t.ok(is(-0, ES.CanonicalNumericIndexString('-0')), '"-0" returns -0');

@@ -387,5 +399,6 @@ for (var i = -50; i < 50; i += 10) {

t.plan(notFuncs.length + 4);
forEach(notFuncs, function (notFunc) {
var throwsOnCall = function (notFunc) {
t.throws(function () { return ES.Call(notFunc, receiver); }, TypeError, notFunc + ' (' + typeof notFunc + ') is not callable');
});
};
forEach(notFuncs, throwsOnCall);
ES.Call(function (a, b) {

@@ -392,0 +405,0 @@ t.equal(this, receiver, 'context matches expected');

@@ -0,1 +1,3 @@

'use strict';
var ES = require('../').ES7;

@@ -22,5 +24,6 @@ var test = require('tape');

t.test('primitives', function (st) {
forEach(primitives, function (primitive) {
var testPrimitive = function (primitive) {
st.ok(is(ES.ToPrimitive(primitive), primitive), primitive + ' is returned correctly');
});
};
forEach(primitives, testPrimitive);
st.end();

@@ -75,3 +78,3 @@ });

forEach(['foo', '0', '4a', '2.0', 'Infinity', '-Infinity'], function (numString) {
t.ok(is(+numString, ES.ToNumber(numString)), '"' + numString + '" coerces to ' + (+numString));
t.ok(is(+numString, ES.ToNumber(numString)), '"' + numString + '" coerces to ' + Number(numString));
});

@@ -243,5 +246,6 @@ forEach(objects, function (object) {

t.throws(function () { return ES.RequireObjectCoercible(null); }, TypeError, 'null throws');
forEach(objects.concat(nonNullPrimitives), function (value) {
var isCoercible = function (value) {
t.doesNotThrow(function () { return ES.RequireObjectCoercible(value); }, '"' + value + '" does not throw');
});
};
forEach(objects.concat(nonNullPrimitives), isCoercible);
t.end();

@@ -360,5 +364,6 @@ });

test('CanonicalNumericIndexString', function (t) {
forEach(objects.concat(numbers), function (notString) {
var throwsOnNonString = function (notString) {
t.throws(function () { return ES.CanonicalNumericIndexString(notString); }, TypeError, notString + ' is not a string');
});
};
forEach(objects.concat(numbers), throwsOnNonString);
t.ok(is(-0, ES.CanonicalNumericIndexString('-0')), '"-0" returns -0');

@@ -385,5 +390,6 @@ for (var i = -50; i < 50; i += 10) {

t.plan(notFuncs.length + 4);
forEach(notFuncs, function (notFunc) {
var throwsIfNotCallable = function (notFunc) {
t.throws(function () { return ES.Call(notFunc, receiver); }, TypeError, notFunc + ' (' + typeof notFunc + ') is not callable');
});
};
forEach(notFuncs, throwsIfNotCallable);
ES.Call(function (a, b) {

@@ -390,0 +396,0 @@ t.equal(this, receiver, 'context matches expected');

@@ -0,1 +1,3 @@

'use strict';
var ES = require('../');

@@ -2,0 +4,0 @@ var test = require('tape');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc