is-arguments
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -12,3 +12,6 @@ { | ||
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], | ||
"requireCurlyBraces": { | ||
"allExcept": [], | ||
"keywords": ["if", "else", "for", "while", "do", "try", "catch"] | ||
}, | ||
@@ -20,2 +23,3 @@ "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], | ||
"disallowSpaceBeforeComma": true, | ||
"disallowSpaceAfterComma": false, | ||
"disallowSpaceBeforeSemicolon": true, | ||
@@ -32,3 +36,3 @@ | ||
"requireObjectKeysOnNewLine": true, | ||
"requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, | ||
@@ -47,3 +51,3 @@ "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, | ||
"disallowQuotedKeysInObjects": "allButReserved", | ||
"disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, | ||
@@ -83,3 +87,3 @@ "disallowSpaceAfterObjectKeys": true, | ||
"requireDotNotation": true, | ||
"requireDotNotation": { "allExcept": ["keywords"] }, | ||
@@ -127,4 +131,52 @@ "requireParenthesesAroundIIFE": true, | ||
"validateOrderInObjectKeys": "asc-insensitive" | ||
"disallowMultiLineTernary": true, | ||
"validateOrderInObjectKeys": "asc-insensitive", | ||
"disallowIdenticalDestructuringNames": true, | ||
"disallowNestedTernaries": { "maxLevel": 1 }, | ||
"requireSpaceAfterComma": { "allExcept": ["trailing"] }, | ||
"requireAlignedMultilineParams": false, | ||
"requireSpacesInGenerator": { | ||
"afterStar": true | ||
}, | ||
"disallowSpacesInGenerator": { | ||
"beforeStar": true | ||
}, | ||
"disallowVar": false, | ||
"requireArrayDestructuring": false, | ||
"requireEnhancedObjectLiterals": false, | ||
"requireObjectDestructuring": false, | ||
"requireEarlyReturn": false, | ||
"requireCapitalizedConstructorsNew": { | ||
"allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] | ||
}, | ||
"requireImportAlphabetized": false, | ||
"requireSpaceBeforeObjectValues": true, | ||
"requireSpaceBeforeDestructuredValues": true, | ||
"disallowSpacesInsideTemplateStringPlaceholders": true, | ||
"disallowArrayDestructuringReturn": false, | ||
"requireNewlineBeforeSingleStatementsInIf": false, | ||
"disallowUnusedVariables": true, | ||
"requireSpacesInsideImportedObjectBraces": true, | ||
"requireUseStrict": true | ||
} | ||
@@ -0,1 +1,7 @@ | ||
1.0.3 / 2015-09-21 | ||
================== | ||
* [Fix] add awareness of Symbol.toStringTag (#20) | ||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `jscs`, `nsp` | ||
* [Tests] up to `node` `v11.1`, `v10.13`, `v9.11`, `v8.12`, `v7.10`, `v6.14`, `v5.11`, `v4.8`; use `nvm install-latest-npm`; pin included builds to LTS. | ||
1.0.2 / 2015-09-21 | ||
@@ -2,0 +8,0 @@ ================== |
'use strict'; | ||
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; | ||
var toStr = Object.prototype.toString; | ||
var isStandardArguments = function isArguments(value) { | ||
if (hasToStringTag && value && Symbol.toStringTag in value) { | ||
return false; | ||
} | ||
return toStr.call(value) === '[object Arguments]'; | ||
@@ -7,0 +11,0 @@ }; |
{ | ||
"name": "is-arguments", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Is this an arguments object? It's a harder question than you think.", | ||
"author": "Jordan Harband", | ||
"author": { | ||
"name": "Jordan Harband", | ||
"email": "ljharb@gmail.com", | ||
"url": "http://ljharb.codes" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Jordan Harband", | ||
"email": "ljharb@gmail.com", | ||
"url": "http://ljharb.codes" | ||
} | ||
], | ||
"license": "MIT", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "npm run lint && node test.js", | ||
"pretest": "npm run --silent lint", | ||
"test": "npm run --silent tests-only", | ||
"tests-only": "node test.js", | ||
"posttest": "npm run --silent security", | ||
"security": "nsp check", | ||
"coverage": "covert test.js", | ||
"coverage-quiet": "covert test.js --quiet", | ||
"lint": "npm run jscs && npm run eslint", | ||
"lint": "npm run --silent jscs && npm run --silent eslint", | ||
"jscs": "jscs *.js", | ||
@@ -34,7 +48,8 @@ "eslint": "eslint *.js" | ||
"devDependencies": { | ||
"tape": "^4.2.0", | ||
"@ljharb/eslint-config": "^13.0.0", | ||
"covert": "^1.1.0", | ||
"jscs": "^2.1.1", | ||
"eslint": "^1.5.0", | ||
"@ljharb/eslint-config": "^1.2.0" | ||
"eslint": "^5.8.0", | ||
"jscs": "^3.0.7", | ||
"nsp": "^3.2.1", | ||
"tape": "^4.9.1" | ||
}, | ||
@@ -63,2 +78,1 @@ "testling": { | ||
} | ||
@@ -28,2 +28,5 @@ #is-arguments <sup>[![Version Badge][2]][1]</sup> | ||
## Caveats | ||
If you have modified an actual `arguments` object by giving it a `Symbol.toStringTag` property, then this package will return `false`. | ||
## Tests | ||
@@ -30,0 +33,0 @@ Simply clone the repo, `npm install`, and run `npm test` |
15
test.js
@@ -5,2 +5,3 @@ 'use strict'; | ||
var isArguments = require('./'); | ||
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; | ||
@@ -30,1 +31,15 @@ test('primitives', function (t) { | ||
}); | ||
test('Symbol.toStringTag', { skip: !hasToStringTag }, function (t) { | ||
var obj = {}; | ||
obj[Symbol.toStringTag] = 'Arguments'; | ||
t.notOk(isArguments(obj), 'object with faked toStringTag is not arguments'); | ||
var args = (function () { | ||
return arguments; | ||
}()); | ||
args[Symbol.toStringTag] = 'Arguments'; | ||
t.notOk(isArguments(obj), 'real arguments with faked toStringTag is not arguments'); | ||
t.end(); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
19572
175
50
6