MCPcopy Create free account
hub / github.com/GrapesJS/cli / normalizeJsonOpt

Function normalizeJsonOpt

src/utils.ts:42–56  ·  view source on GitHub ↗
(opts: Record<string, any>, key: string)

Source from the content-addressed store, hash-verified

40 * @returns {Object}
41 */
42export const normalizeJsonOpt = (opts: Record<string, any>, key: string) => {
43 let devServerOpt = opts[key] || {};
44
45 if (isString(devServerOpt)) {
46 try {
47 devServerOpt = JSON.parse(devServerOpt);
48 } catch (e) {
49 printError(`Error while parsing "${key}" option`);
50 printError(e);
51 devServerOpt = {}
52 }
53 }
54
55 return devServerOpt;
56}
57
58export const buildWebpackArgs = (opts: Record<string, any>) => {
59 return {

Callers 3

serve.tsFile · 0.90
buildWebpackFunction · 0.90
buildWebpackArgsFunction · 0.85

Calls 2

isStringFunction · 0.85
printErrorFunction · 0.85

Tested by

no test coverage detected