Stringify anything in a predictable manner, i.e. two objects with equal keys in different order gets the same result
Useful if you want to generate a hash from an object.
Install to-predictable-string
using npm:
npm install --save to-predictable-string
var toPredictableString = require('to-predictable-string');
toPredictableString({my: 'data', prop1: {prop2: /regexp/, prop3: ['a', 'r', 'r', 'a', 'y']}});
// "{my:data,prop1:{prop2:/regexp/,prop3:[a,r,r,a,y]}}"
Name | Type | Description |
---|---|---|
val | Mixed |
The data to generate a string from |
Returns: String
, the generated string.
MIT