@shanzhai/stringify-json-step

A Shanzhai step which "stringifies" a JSON value to a string.

Usage no npm install needed!

<script type="module">
  import shanzhaiStringifyJsonStep from 'https://cdn.skypack.dev/@shanzhai/stringify-json-step';
</script>

README

@shanzhai/stringify-json-step Continuous Integration License FOSSA Status Renovate enabled npm npm type definitions

A Shanzhai step which "stringifies" a JSON value to a string.

Usage

If within a trigger's event handler an instance of StringifyJsonStep similar to the following were to be returned:

new StringifyJsonStep(
  `A description of the operation being performed`,
  new InputForAJsonValue(),
  new OutputForStringOfJson(),
);

A string containing the rendered generated string of JSON would be written to the output.

Note that this does not directly use JSON.stringify; it has the following differences:

  • Object key order is always sorted, ascending.
  • Object properties with undefined values are omitted from the string of JSON.

Dependencies

This package has no runtime dependencies.

Peer Dependencies

This package has no runtime peer dependencies (it does not expect any other packages to be installed alongside itself).

License

FOSSA Status