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`; add `has`
  • Loading branch information
ljharb committed Jul 6, 2016
1 parent 14638bd commit 556de86
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"no-magic-numbers": 0
}
}
17 changes: 9 additions & 8 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var flags = require('../');
var test = require('tape');
var has = require('has');

var getRegexLiteral = function (stringRegex) {
try {
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 556de86

Please sign in to comment.