MCPcopy Index your code
hub / github.com/messageformat/messageformat / stringifyObject

Function stringifyObject

packages/messageformat/src/compile-module.js:31–39  ·  view source on GitHub ↗
(obj, level = 0)

Source from the content-addressed store, hash-verified

29}
30
31function stringifyObject(obj, level = 0) {
32 if (typeof obj !== 'object') return obj;
33 const indent = ' '.repeat(level);
34 const o = Object.keys(obj).map(key => {
35 const v = stringifyObject(obj[key], level + 1);
36 return `\n${indent} ${property(null, key)}: ${v}`;
37 });
38 return `{${o.join(',')}\n${indent}}`;
39}
40
41/**
42 * Compile a collection of messages into an ES module.

Callers 1

compileModuleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected