UNPKG

@mongez/gnz

Version:

Generator Z, the next generation of scaffolding tools.

18 lines (17 loc) 583 B
'use strict';/** * Converts an object into json string */ function toJson(object) { const entries = Object.entries(object); const strEntries = entries.map(([key, value]) => { if (typeof value === "function") { // If the value is a function, return it's name return `${key}: ${value.name}`; } else { // Otherwise, stringify the value return `"${key}": ${JSON.stringify(value)}`; } }); return `{ ${strEntries.join(", ")} }`; }exports.toJson=toJson;//# sourceMappingURL=converters.js.map