UNPKG

@tuzki/cli

Version:

πŸ‡ lowcode-cli is an efficient cli tool for Rabbitpre plugin component secondary development. ❀️

27 lines (26 loc) β€’ 614 B
/* * comment json εΊεˆ—εŒ–ε’ŒεεΊεˆ—εŒ– * * @Author: xu.jin * @Date: 2022-12-08 14:00:32 * * Copyright Β© 2014-2022 Rabbitpre.com. All Rights Reserved. */ import * as commentJson from 'comment-json'; /** * parse comment-json * @param str jsonStr * @returns */ const parse = str => commentJson.parse(str); /** * stringify comment-json * * @param {Record<string, any>} parsed * @return {*} {string} */ const stringify = (parsed) => { const sorted = commentJson.assign({}, parsed, Object.keys(parsed).sort()); return commentJson.stringify(sorted, null, 2); }; export { parse, stringify };