Skip to content

Commit

Permalink
[Dev Deps] update tape, jscs, nsp, eslint, `@ljharb/eslint-co…
Browse files Browse the repository at this point in the history
…nfig`, `semver`
  • Loading branch information
ljharb committed Jan 10, 2017
1 parent 89d9528 commit 7290076
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 15 deletions.
62 changes: 58 additions & 4 deletions .jscs.json
Expand Up @@ -9,13 +9,17 @@

"disallowIdentifierNames": [],

"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
"requireCurlyBraces": {
"allExcept": [],
"keywords": ["if", "else", "for", "while", "do", "try", "catch"]
},

"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"],

"disallowSpaceAfterKeywords": [],

"disallowSpaceBeforeComma": true,
"disallowSpaceAfterComma": false,
"disallowSpaceBeforeSemicolon": true,

"disallowNodeTypes": [
Expand All @@ -27,6 +31,8 @@
"WithStatement"
],

"requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] },

"requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true },
"requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true },
"disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true },
Expand All @@ -39,7 +45,7 @@

"disallowSpacesInsideArrayBrackets": true,

"disallowQuotedKeysInObjects": "allButReserved",
"disallowQuotedKeysInObjects": { "allExcept": ["reserved"] },

"disallowSpaceAfterObjectKeys": true,

Expand Down Expand Up @@ -74,7 +80,7 @@

"disallowMultipleLineStrings": true,

"requireDotNotation": true,
"requireDotNotation": { "allExcept": ["keywords"] },

"requireParenthesesAroundIIFE": true,

Expand Down Expand Up @@ -117,6 +123,54 @@

"disallowArrowFunctions": 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
}

8 changes: 5 additions & 3 deletions index.js
@@ -1,7 +1,7 @@
'use strict';

var regexExec = RegExp.prototype.exec;
var tryRegexExec = function tryRegexExec(value) {
var tryRegexExecCall = function tryRegexExec(value) {
try {
regexExec.call(value);
return true;
Expand All @@ -14,6 +14,8 @@ var regexClass = '[object RegExp]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';

module.exports = function isRegex(value) {
if (typeof value !== 'object') { return false; }
return hasToStringTag ? tryRegexExec(value) : toStr.call(value) === regexClass;
if (typeof value !== 'object') {
return false;
}
return hasToStringTag ? tryRegexExecCall(value) : toStr.call(value) === regexClass;
};
14 changes: 7 additions & 7 deletions package.json
Expand Up @@ -13,7 +13,7 @@
"jscs": "jscs *.js",
"eslint": "eslint test.js *.js",
"eccheck": "editorconfig-tools check *.js **/*.js > /dev/null",
"security": "nsp package"
"security": "nsp check"
},
"repository": {
"type": "git",
Expand All @@ -33,14 +33,14 @@
],
"dependencies": {},
"devDependencies": {
"tape": "^4.2.0",
"tape": "^4.6.3",
"covert": "^1.1.0",
"jscs": "^2.1.1",
"jscs": "^3.0.7",
"editorconfig-tools": "^0.1.1",
"nsp": "^1.1.0",
"eslint": "^1.5.1",
"@ljharb/eslint-config": "^1.2.0",
"semver": "^5.0.3",
"nsp": "^2.6.2",
"eslint": "^3.13.1",
"@ljharb/eslint-config": "^9.0.1",
"semver": "^5.3.0",
"replace": "^0.3.0"
},
"testling": {
Expand Down
5 changes: 4 additions & 1 deletion test.js
Expand Up @@ -19,7 +19,10 @@ test('not regexes', function (t) {

test('@@toStringTag', { skip: !hasToStringTag }, function (t) {
var regex = /a/g;
var fakeRegex = { toString: function () { return String(regex); }, valueOf: function () { return regex; } };
var fakeRegex = {
toString: function () { return String(regex); },
valueOf: function () { return regex; }
};
fakeRegex[Symbol.toStringTag] = 'RegExp';
t.notOk(isRegex(fakeRegex), 'fake RegExp with @@toStringTag "RegExp" is not regex');
t.end();
Expand Down

0 comments on commit 7290076

Please sign in to comment.