diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/stringify-object/index.js | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/stringify-object/index.js')
-rw-r--r-- | node_modules/stringify-object/index.js | 12 |
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); |