From 556de8632bbe7a23279717f7d0b6ee841514fbe1 Mon Sep 17 00:00:00 2001 From: Jordan Harband <ljharb@gmail.com> Date: Tue, 5 Jul 2016 23:25:55 -0700 Subject: [PATCH] [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`; add `has` --- package.json | 13 +++++++------ test/.eslintrc | 5 +++++ test/index.js | 17 +++++++++-------- 3 files changed, 21 insertions(+), 14 deletions(-) create mode 100644 test/.eslintrc diff --git a/package.json b/package.json index 96f5c0e..52347d4 100644 --- a/package.json +++ b/package.json @@ -39,14 +39,15 @@ "define-properties": "^1.1.2" }, "devDependencies": { - "tape": "^4.5.1", + "tape": "^4.6.0", "covert": "^1.1.0", - "jscs": "^3.0.1", + "jscs": "^3.0.6", "editorconfig-tools": "^0.1.1", - "nsp": "^2.3.0", - "eslint": "^2.7.0", - "@ljharb/eslint-config": "^2.2.0", - "@es-shims/api": "^1.2.0" + "nsp": "^2.5.0", + "eslint": "^3.0.1", + "@ljharb/eslint-config": "^6.0.0", + "@es-shims/api": "^1.2.0", + "has": "^1.0.1" }, "testling": { "files": "test/index.js", diff --git a/test/.eslintrc b/test/.eslintrc new file mode 100644 index 0000000..c4fe5ce --- /dev/null +++ b/test/.eslintrc @@ -0,0 +1,5 @@ +{ + "rules": { + "no-magic-numbers": 0 + } +} diff --git a/test/index.js b/test/index.js index 9dd4deb..30359fc 100644 --- a/test/index.js +++ b/test/index.js @@ -2,6 +2,7 @@ var flags = require('../'); var test = require('tape'); +var has = require('has'); var getRegexLiteral = function (stringRegex) { try { @@ -27,13 +28,13 @@ test('works as a function', function (t) { t.equal(flags(/a/), '', 'flags(/a/) !== ""'); t.equal(flags(new RegExp('a')), '', 'flags(new RegExp("a")) !== ""'); - t.test('sticky flag', { skip: !RegExp.prototype.hasOwnProperty('sticky') }, function (st) { + t.test('sticky flag', { skip: !has(RegExp.prototype, 'sticky') }, function (st) { st.equal(flags(getRegexLiteral('/a/y')), 'y', 'flags(/a/y) !== "y"'); st.equal(flags(new RegExp('a', 'y')), 'y', 'flags(new RegExp("a", "y")) !== "y"'); st.end(); }); - t.test('unicode flag', { skip: !RegExp.prototype.hasOwnProperty('unicode') }, function (st) { + t.test('unicode flag', { skip: !has(RegExp.prototype, 'unicode') }, function (st) { st.equal(flags(getRegexLiteral('/a/u')), 'u', 'flags(/a/u) !== "u"'); st.equal(flags(new RegExp('a', 'u')), 'u', 'flags(new RegExp("a", "u")) !== "u"'); st.end(); @@ -43,10 +44,10 @@ test('works as a function', function (t) { st.equal(flags(/a/gim), 'gim', 'flags(/a/gim) !== "gim"'); st.equal(flags(/a/mig), 'gim', 'flags(/a/mig) !== "gim"'); st.equal(flags(/a/mgi), 'gim', 'flags(/a/mgi) !== "gim"'); - if (RegExp.prototype.hasOwnProperty('sticky')) { + if (has(RegExp.prototype, 'sticky')) { st.equal(flags(getRegexLiteral('/a/gyim')), 'gimy', 'flags(/a/gyim) !== "gimy"'); } - if (RegExp.prototype.hasOwnProperty('unicode')) { + if (has(RegExp.prototype, 'unicode')) { st.equal(flags(getRegexLiteral('/a/ugmi')), 'gimu', 'flags(/a/ugmi) !== "gimu"'); } st.end(); @@ -73,13 +74,13 @@ test('shims properly', function (t) { st.end(); }); - t.test('sticky flag', { skip: !RegExp.prototype.hasOwnProperty('sticky') }, function (st) { + t.test('sticky flag', { skip: !has(RegExp.prototype, 'sticky') }, function (st) { st.equal(getRegexLiteral('/a/y').flags, 'y', '(/a/y).flags !== "y"'); st.equal(new RegExp('a', 'y').flags, 'y', 'new RegExp("a", "y").flags !== "y"'); st.end(); }); - t.test('unicode flag', { skip: !RegExp.prototype.hasOwnProperty('unicode') }, function (st) { + t.test('unicode flag', { skip: !has(RegExp.prototype, 'unicode') }, function (st) { st.equal(getRegexLiteral('/a/u').flags, 'u', '(/a/u).flags !== "u"'); st.equal(new RegExp('a', 'u').flags, 'u', 'new RegExp("a", "u").flags !== "u"'); st.end(); @@ -89,10 +90,10 @@ test('shims properly', function (t) { st.equal((/a/gim).flags, 'gim', '(/a/gim).flags !== "gim"'); st.equal((/a/mig).flags, 'gim', '(/a/mig).flags !== "gim"'); st.equal((/a/mgi).flags, 'gim', '(/a/mgi).flags !== "gim"'); - if (RegExp.prototype.hasOwnProperty('sticky')) { + if (has(RegExp.prototype, 'sticky')) { st.equal(getRegexLiteral('/a/gyim').flags, 'gimy', '(/a/gyim).flags !== "gimy"'); } - if (RegExp.prototype.hasOwnProperty('unicode')) { + if (has(RegExp.prototype, 'unicode')) { st.equal(getRegexLiteral('/a/ugmi').flags, 'gimu', '(/a/ugmi).flags !== "gimu"'); } st.end();