|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
764 bytes
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | Copyright 2021 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 |
|
|---|
| 9 | import objectStringify from 'stringify-object';
|
|---|
| 10 | import stripComments from 'strip-comments';
|
|---|
| 11 |
|
|---|
| 12 | export function stringifyWithoutComments(obj: {[key: string]: any}): string {
|
|---|
| 13 | return objectStringify(obj, {
|
|---|
| 14 | // See https://github.com/yeoman/stringify-object#transformobject-property-originalresult
|
|---|
| 15 | transform: (_obj: {[key: string]: any}, _prop, str) => {
|
|---|
| 16 | if (typeof _prop !== 'symbol' && typeof _obj[_prop] === 'function') {
|
|---|
| 17 | // Can't typify correctly stripComments
|
|---|
| 18 | return stripComments(str); // eslint-disable-line
|
|---|
| 19 | }
|
|---|
| 20 | return str;
|
|---|
| 21 | },
|
|---|
| 22 | });
|
|---|
| 23 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.