UNPKG

460 BJavaScriptView Raw
1/*
2 Copyright 2018 Google LLC
3
4 Use of this source code is governed by an MIT-style
5 license that can be found in the LICENSE file or at
6 https://opensource.org/licenses/MIT.
7*/
8
9const objectStringify = require('stringify-object');
10const stripComments = require('strip-comments');
11
12module.exports = (obj) => {
13 return objectStringify(obj, {
14 transform: (_obj, _prop, str) =>
15 typeof _obj[_prop] === 'function' ? stripComments(str) : str,
16 });
17};