aboutsummaryrefslogtreecommitdiff
path: root/node_modules/stringify-object/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/stringify-object/index.js')
-rw-r--r--node_modules/stringify-object/index.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/node_modules/stringify-object/index.js b/node_modules/stringify-object/index.js
index 4a55bd9ec..a60caef59 100644
--- a/node_modules/stringify-object/index.js
+++ b/node_modules/stringify-object/index.js
@@ -1,7 +1,7 @@
'use strict';
const isRegexp = require('is-regexp');
const isObj = require('is-obj');
-const getOwnEnumPropSymbols = require('get-own-enumerable-property-symbols');
+const getOwnEnumPropSymbols = require('get-own-enumerable-property-symbols').default;
module.exports = (val, opts, pad) => {
const seen = [];
@@ -89,7 +89,11 @@ module.exports = (val, opts, pad) => {
}
if (isObj(val)) {
- const objKeys = Object.keys(val).concat(getOwnEnumPropSymbols(val));
+ let objKeys = Object.keys(val).concat(getOwnEnumPropSymbols(val));
+
+ if (opts.filter) {
+ objKeys = objKeys.filter(el => opts.filter(val, el));
+ }
if (objKeys.length === 0) {
return '{}';
@@ -98,10 +102,6 @@ module.exports = (val, opts, pad) => {
seen.push(val);
const ret = '{' + tokens.newLine + objKeys.map((el, i) => {
- if (opts.filter && !opts.filter(val, el)) {
- return '';
- }
-
const eol = objKeys.length - 1 === i ? tokens.newLine : ',' + tokens.newLineOrSpace;
const isSymbol = typeof el === 'symbol';
const isClassic = !isSymbol && /^[a-z$_][a-z$_0-9]*$/i.test(el);