regexp.prototype.flags
Advanced tools
Comparing version 1.5.1 to 1.5.2
@@ -8,2 +8,15 @@ # Changelog | ||
## [v1.5.2](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.5.1...v1.5.2) - 2024-02-11 | ||
### Commits | ||
- [Tests] increase coverage [`c692c88`](https://github.com/es-shims/RegExp.prototype.flags/commit/c692c88e073f6d17fc5b6b1c740ef1ecb433eb4b) | ||
- [Dev Deps] use `hasown` instead of `has` [`fb5b350`](https://github.com/es-shims/RegExp.prototype.flags/commit/fb5b350122507e4bec68fb417a46f07d062caf77) | ||
- [Dev Deps] update `aud`, `hasown`, `npmignore`, `tape` [`fd0ddd9`](https://github.com/es-shims/RegExp.prototype.flags/commit/fd0ddd9c837c0a8066de37a41eb4f83310f15a57) | ||
- [Deps] update `call-bind`, `define-properties`, `set-function-name` [`ca53f66`](https://github.com/es-shims/RegExp.prototype.flags/commit/ca53f662549b2fbff61323a6d2aa9af15a6c836b) | ||
- [Dev Deps] update `object-inspect`, `tape` [`4491680`](https://github.com/es-shims/RegExp.prototype.flags/commit/449168010d4d63a2cd854dcec9f37efacda19082) | ||
- [Refactor] use `es-errors` [`1d03d22`](https://github.com/es-shims/RegExp.prototype.flags/commit/1d03d225327008aeb6b4b501a4720318d717621e) | ||
- [Fix] properly check for a non-object receiver [`024d442`](https://github.com/es-shims/RegExp.prototype.flags/commit/024d4421edd8922f9acbac35afcfe69a8a3db6a9) | ||
- [Deps] update `call-bind` [`f222ce0`](https://github.com/es-shims/RegExp.prototype.flags/commit/f222ce0925a7431d1d3dd113d803746f07e1175d) | ||
## [v1.5.1](https://github.com/es-shims/RegExp.prototype.flags/compare/v1.5.0...v1.5.1) - 2023-09-12 | ||
@@ -10,0 +23,0 @@ |
'use strict'; | ||
var setFunctionName = require('set-function-name'); | ||
var $TypeError = require('es-errors/type'); | ||
var $Object = Object; | ||
var $TypeError = TypeError; | ||
module.exports = setFunctionName(function flags() { | ||
if (this != null && this !== $Object(this)) { | ||
if (this == null || this !== $Object(this)) { | ||
throw new $TypeError('RegExp.prototype.flags getter called on non-object'); | ||
@@ -11,0 +11,0 @@ } |
{ | ||
"name": "regexp.prototype.flags", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"author": "Jordan Harband <ljharb@gmail.com>", | ||
@@ -43,5 +43,6 @@ "funding": { | ||
"dependencies": { | ||
"call-bind": "^1.0.2", | ||
"define-properties": "^1.2.0", | ||
"set-function-name": "^2.0.0" | ||
"call-bind": "^1.0.6", | ||
"define-properties": "^1.2.1", | ||
"es-errors": "^1.3.0", | ||
"set-function-name": "^2.0.1" | ||
}, | ||
@@ -51,18 +52,18 @@ "devDependencies": { | ||
"@ljharb/eslint-config": "^21.1.0", | ||
"aud": "^2.0.3", | ||
"aud": "^2.0.4", | ||
"auto-changelog": "^2.4.0", | ||
"available-regexp-flags": "^1.0.2", | ||
"covert": "^1.1.1", | ||
"eclint": "^2.8.1", | ||
"es-value-fixtures": "^1.4.2", | ||
"eslint": "=8.8.0", | ||
"for-each": "^0.3.3", | ||
"functions-have-names": "^1.2.3", | ||
"has": "^1.0.3", | ||
"has-strict-mode": "^1.0.1", | ||
"hasown": "^2.0.1", | ||
"in-publish": "^2.0.1", | ||
"npmignore": "^0.3.0", | ||
"npmignore": "^0.3.1", | ||
"nyc": "^10.3.2", | ||
"object-inspect": "^1.12.3", | ||
"object-inspect": "^1.13.1", | ||
"safe-publish-latest": "^2.0.0", | ||
"tape": "^5.6.6" | ||
"tape": "^5.7.4" | ||
}, | ||
@@ -69,0 +70,0 @@ "testling": { |
'use strict'; | ||
var has = require('has'); | ||
var hasOwn = require('hasown'); | ||
var inspect = require('object-inspect'); | ||
var supportsDescriptors = require('define-properties').supportsDescriptors; | ||
var v = require('es-value-fixtures'); | ||
@@ -22,2 +23,10 @@ var forEach = require('for-each'); | ||
module.exports = function runTests(flags, t) { | ||
forEach(v.primitives, function (nonObject) { | ||
t['throws']( | ||
function () { flags(nonObject); }, | ||
TypeError, | ||
'throws when called with a non-object receiver: ' + inspect(nonObject) | ||
); | ||
}); | ||
t.equal(flags(/a/g), 'g', 'flags(/a/g) !== "g"'); | ||
@@ -42,9 +51,9 @@ t.equal(flags(/a/gmi), 'gim', 'flags(/a/gmi) !== "gim"'); | ||
st.equal(flags(/a/mgi), 'gim', 'flags(/a/mgi) !== "gim"'); | ||
if (has(RegExp.prototype, 'sticky')) { | ||
if (hasOwn(RegExp.prototype, 'sticky')) { | ||
st.equal(flags(getRegexLiteral('/a/gyim')), 'gimy', 'flags(/a/gyim) !== "gimy"'); | ||
} | ||
if (has(RegExp.prototype, 'unicode')) { | ||
if (hasOwn(RegExp.prototype, 'unicode')) { | ||
st.equal(flags(getRegexLiteral('/a/ugmi')), 'gimu', 'flags(/a/ugmi) !== "gimu"'); | ||
} | ||
if (has(RegExp.prototype, 'dotAll')) { | ||
if (hasOwn(RegExp.prototype, 'dotAll')) { | ||
st.equal(flags(getRegexLiteral('/a/sgmi')), 'gims', 'flags(/a/sgmi) !== "gims"'); | ||
@@ -90,11 +99,2 @@ } | ||
t.test('throws properly', function (st) { | ||
var nonObjects = ['', false, true, 42, NaN, null, undefined]; | ||
st.plan(nonObjects.length); | ||
var throwsOnNonObject = function (nonObject) { | ||
st['throws'](flags.bind(null, nonObject), TypeError, inspect(nonObject) + ' is not an Object'); | ||
}; | ||
nonObjects.forEach(throwsOnNonObject); | ||
}); | ||
t.test('getters', { skip: !supportsDescriptors }, function (st) { | ||
@@ -101,0 +101,0 @@ /* eslint getter-return: 0 */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40353
4
+ Addedes-errors@^1.3.0
Updatedcall-bind@^1.0.6
Updateddefine-properties@^1.2.1
Updatedset-function-name@^2.0.1