1.0.0 • Published 10 years ago
to-predictable-string v1.0.0
to-predictable-string
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.
Installation
Install to-predictable-string using npm:
npm install --save to-predictable-stringUsage
Module usage
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]}}"API
toPredictableString(val)
| Name | Type | Description |
|---|---|---|
| val | Mixed | The data to generate a string from |
Returns: String, the generated string.
License
MIT
1.0.0
10 years ago