UNPKG

@augment-vir/common

Version:

A collection of augments, helpers types, functions, and classes for any JavaScript environment.

25 lines (24 loc) 898 B
/** This is the _only_ way to import json5 that actually works. */ import json5 from 'json5'; /** * A simple wrapper for `json5.parse`. This is abstracted so that we don't have to worry about * remembering how to import json5 because a wrong import (like `import * as json5 from 'json5'`) * will fail at runtime but _not_ at build time. * * @category JSON : Common * @category Package : @augment-vir/common */ export function parseWithJson5(input) { return json5.parse(input); } /** * A simple wrapper for `json5.stringify`. This is abstracted so that we don't have to worry about * remembering how to import json5 because a wrong import (like `import * as json5 from 'json5'`) * will fail at runtime but _not_ at build time. * * @category JSON : Common * @category Package : @augment-vir/common */ export function stringifyWithJson5(input) { return json5.stringify(input); }