1.0.0 • Published 9 years ago

to-predictable-string v1.0.0

Weekly downloads
14
License
MIT
Repository
-
Last release
9 years ago

to-predictable-string

NPM version js-xo-style

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-string

Usage

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)

NameTypeDescription
valMixedThe data to generate a string from

Returns: String, the generated string.

License

MIT

1.0.0

9 years ago