stringify-object
Advanced tools
Comparing version 4.0.1 to 5.0.0
11
index.js
import isRegexp from 'is-regexp'; | ||
import isObject from 'is-obj'; | ||
import getOwnEnumPropSymbols from 'get-own-enumerable-property-symbols'; | ||
import getOwnEnumerableKeys from 'get-own-enumerable-keys'; | ||
@@ -92,6 +92,3 @@ export default function stringifyObject(input, options, pad) { | ||
if (isObject(input)) { | ||
let objectKeys = [ | ||
...Object.keys(input), | ||
...getOwnEnumPropSymbols.default(input), | ||
]; | ||
let objectKeys = getOwnEnumerableKeys(input); | ||
@@ -109,4 +106,4 @@ if (options.filter) { | ||
const returnValue = '{' + tokens.newline + objectKeys.map((element, i) => { | ||
const eol = objectKeys.length - 1 === i ? tokens.newline : ',' + tokens.newlineOrSpace; | ||
const returnValue = '{' + tokens.newline + objectKeys.map((element, index) => { | ||
const eol = objectKeys.length - 1 === index ? tokens.newline : ',' + tokens.newlineOrSpace; | ||
const isSymbol = typeof element === 'symbol'; | ||
@@ -113,0 +110,0 @@ const isClassic = !isSymbol && /^[a-z$_][$\w]*$/i.test(element); |
{ | ||
"name": "stringify-object", | ||
"version": "4.0.1", | ||
"version": "5.0.0", | ||
"description": "Stringify an object/array like JSON.stringify just without all the double-quotes", | ||
"license": "BSD-2-Clause", | ||
"repository": "yeoman/stringify-object", | ||
"funding": "https://github.com/yeoman/stringify-object?sponsor=1", | ||
"author": { | ||
@@ -15,3 +16,3 @@ "name": "Sindre Sorhus", | ||
"engines": { | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
"node": ">=14.16" | ||
}, | ||
@@ -35,9 +36,9 @@ "scripts": { | ||
"dependencies": { | ||
"get-own-enumerable-property-symbols": "^3.0.2", | ||
"get-own-enumerable-keys": "^1.0.0", | ||
"is-obj": "^3.0.0", | ||
"is-regexp": "^3.0.0" | ||
"is-regexp": "^3.1.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^3.15.0", | ||
"xo": "^0.44.0" | ||
"ava": "^5.1.1", | ||
"xo": "^0.53.1" | ||
}, | ||
@@ -44,0 +45,0 @@ "xo": { |
@@ -11,5 +11,5 @@ # stringify-object | ||
```sh | ||
npm install stringify-object | ||
``` | ||
$ npm install stringify-object | ||
``` | ||
@@ -160,13 +160,1 @@ ## Usage | ||
As you can see, `arr` was printed as a one-liner because its string was shorter than 12 characters. | ||
--- | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-stringify-object?utm_source=npm-stringify-object&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> |
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
8625
106
159
+ Addedget-own-enumerable-keys@1.0.0(transitive)
- Removedget-own-enumerable-property-symbols@3.0.2(transitive)
Updatedis-regexp@^3.1.0