Skip to content

Latest commit

 

History

History

stringify-json-output

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

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

A Shanzhai output which "stringifies" a value before passing it to an output.

Usage

Give an instance of StringifyJsonOutput to a Step as an output and it will convert the value it is given into a string of JSON before passing it to its nested Output.

For example, the following examples are equivalent:

new CopyStep(
  `Example`,
  new ConstantInput([1, 2, 3]),
  new StringifyJsonOutput(new ExampleOutput())
);
new CopyStep(
  `Example`,
  new ConstantInput(`[1,2,3]`),
  new ExampleOutput()
);

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