object-inspect
Advanced tools
Comparing version 1.12.0 to 1.12.1
@@ -8,2 +8,12 @@ # Changelog | ||
## [v1.12.1](https://github.com/inspect-js/object-inspect/compare/v1.12.0...v1.12.1) - 2022-05-21 | ||
### Commits | ||
- [Tests] use `mock-property` [`4ec8893`](https://github.com/inspect-js/object-inspect/commit/4ec8893ea9bfd28065ca3638cf6762424bf44352) | ||
- [meta] use `npmignore` to autogenerate an npmignore file [`07f868c`](https://github.com/inspect-js/object-inspect/commit/07f868c10bd25a9d18686528339bb749c211fc9a) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`b05244b`](https://github.com/inspect-js/object-inspect/commit/b05244b4f331e00c43b3151bc498041be77ccc91) | ||
- [Dev Deps] update `@ljharb/eslint-config`, `error-cause`, `es-value-fixtures`, `functions-have-names`, `tape` [`d037398`](https://github.com/inspect-js/object-inspect/commit/d037398dcc5d531532e4c19c4a711ed677f579c1) | ||
- [Fix] properly handle callable regexes in older engines [`848fe48`](https://github.com/inspect-js/object-inspect/commit/848fe48bd6dd0064ba781ee6f3c5e54a94144c37) | ||
## [v1.12.0](https://github.com/inspect-js/object-inspect/compare/v1.11.1...v1.12.0) - 2021-12-18 | ||
@@ -10,0 +20,0 @@ |
@@ -159,3 +159,3 @@ var hasMap = typeof Map === 'function' && Map.prototype; | ||
if (typeof obj === 'function') { | ||
if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable | ||
var name = nameOf(obj); | ||
@@ -162,0 +162,0 @@ var keys = arrObjKeys(obj, inspect); |
{ | ||
"name": "object-inspect", | ||
"version": "1.12.0", | ||
"version": "1.12.1", | ||
"description": "string representations of objects in node and the browser", | ||
@@ -8,19 +8,22 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^20.1.0", | ||
"aud": "^1.1.5", | ||
"auto-changelog": "^2.3.0", | ||
"@ljharb/eslint-config": "^21.0.0", | ||
"aud": "^2.0.0", | ||
"auto-changelog": "^2.4.0", | ||
"core-js": "^2.6.12", | ||
"error-cause": "^1.0.3", | ||
"es-value-fixtures": "^1.2.1", | ||
"eslint": "^8.5.0", | ||
"error-cause": "^1.0.4", | ||
"es-value-fixtures": "^1.4.1", | ||
"eslint": "=8.8.0", | ||
"for-each": "^0.3.3", | ||
"functions-have-names": "^1.2.2", | ||
"functions-have-names": "^1.2.3", | ||
"has-tostringtag": "^1.0.0", | ||
"make-arrow-function": "^1.2.0", | ||
"mock-property": "^1.0.0", | ||
"npmignore": "^0.3.0", | ||
"nyc": "^10.3.2", | ||
"safe-publish-latest": "^2.0.0", | ||
"string.prototype.repeat": "^1.0.0", | ||
"tape": "^5.3.2" | ||
"tape": "^5.5.3" | ||
}, | ||
"scripts": { | ||
"prepack": "npmignore --auto --commentLines=autogenerated", | ||
"prepublish": "not-in-publish || npm run prepublishOnly", | ||
@@ -84,3 +87,9 @@ "prepublishOnly": "safe-publish-latest", | ||
"hideCredit": true | ||
}, | ||
"publishConfig": { | ||
"ignore": [ | ||
".github/workflows", | ||
"./test-core-js.js" | ||
] | ||
} | ||
} |
@@ -0,23 +1,7 @@ | ||
'use strict'; | ||
var inspect = require('../'); | ||
var test = require('tape'); | ||
var mockProperty = require('mock-property'); | ||
function withoutProperty(object, property, fn) { | ||
var original; | ||
if (Object.getOwnPropertyDescriptor) { | ||
original = Object.getOwnPropertyDescriptor(object, property); | ||
} else { | ||
original = object[property]; | ||
} | ||
delete object[property]; | ||
try { | ||
fn(); | ||
} finally { | ||
if (Object.getOwnPropertyDescriptor) { | ||
Object.defineProperty(object, property, original); | ||
} else { | ||
object[property] = original; | ||
} | ||
} | ||
} | ||
test('when Object#hasOwnProperty is deleted', function (t) { | ||
@@ -27,9 +11,6 @@ t.plan(1); | ||
// eslint-disable-next-line no-extend-native | ||
Array.prototype[1] = 2; // this is needed to account for "in" vs "hasOwnProperty" | ||
t.teardown(mockProperty(Array.prototype, 1, { value: 2 })); // this is needed to account for "in" vs "hasOwnProperty" | ||
t.teardown(mockProperty(Object.prototype, 'hasOwnProperty', { 'delete': true })); | ||
withoutProperty(Object.prototype, 'hasOwnProperty', function () { | ||
t.equal(inspect(arr), '[ 1, , 3 ]'); | ||
}); | ||
delete Array.prototype[1]; | ||
t.equal(inspect(arr), '[ 1, , 3 ]'); | ||
}); |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var test = require('tape'); | ||
var mockProperty = require('mock-property'); | ||
var hasSymbols = require('has-symbols/shams')(); | ||
@@ -27,6 +28,5 @@ var hasToStringTag = require('has-tostringtag/shams')(); | ||
t.plan(1); | ||
var has = Object.prototype.hasOwnProperty; | ||
delete Object.prototype.hasOwnProperty; | ||
t.teardown(mockProperty(Object.prototype, 'hasOwnProperty', { 'delete': true })); | ||
t.equal(inspect({ a: 1, b: 2 }), '{ a: 1, b: 2 }'); | ||
Object.prototype.hasOwnProperty = has; // eslint-disable-line no-extend-native | ||
}); | ||
@@ -33,0 +33,0 @@ |
91340
17
32
1413