request-object-fingerprint
v1.0.0
Published
generate a unique string from a [request](http://npm.im/request) object for use as a cache key
Downloads
5
Readme
request-object-fingerprint
generate a unique string from a request object for use as a cache key
Installation
Download node at nodejs.org and install it, if you haven't already.
npm install request-object-fingerprint --save
Usage
var fingerprint = require("request-object-fingerprint")
var request = {
method: 'GET',
url: '/flowers',
qs: {color: 'red', fragrance: 'sweet'},
headers: {bearer: 'beholder'}
}
fingerprint(request)
// => acl:e25f8d798636632ee5c91d27defb6749
// Set a custom prefix
fingerprint(request, {prefix: 'baz'})
// => baz:e25f8d798636632ee5c91d27defb6749
Tests
npm install
npm test
Dependencies
None
Dev Dependencies
- code: assertion library
- mocha: simple, flexible, fun test framework
- standard: JavaScript Standard Style
License
MIT