json-to-js-const
v0.5.0
Published
JSON to JavaScript tree-shakeable constants
Downloads
1
Readme
json-to-js-const
JSON to JavaScript tree-shakeable constants.
Installation
npm add json-to-js-const
Usage
const convert from 'json-to-js-const';
const result = convert({ intValue: -12, strValue: 'haha"\'', nullValue: null, arrayValue: [32, 'wow', null] });
console.log(result);
It prints:
/******************************************************************************************
* This code was automatically generated by json-to-js-const.
* Do not edit this file manually, your changes will be overwritten.
******************************************************************************************/
export const intValue = -12;
export const strValue = 'haha"\'';
export const nullValue = null;
export const arrayValue = [32, 'wow', null];