Skip to content

create stable cache keys from complex objects

License

Notifications You must be signed in to change notification settings

smeijer/cache-key

Repository files navigation

cache-key

create stable cache keys from complex objects

Install

npm install cache-key

Usage

Just pass an array of values to hashCacheKey and it will return a stable hash. The order of items in the array is untouched. The keys of objects are sorted alphabetically.

import { hashCacheKey } from 'cache-key';

hashCacheKey(['users', { id: 1, name: 'person' }]);
//=> '["users",{"id":1,name:"person"}]'

hashCacheKey(['users', { name: 'person', id: 1 }]);
//=> '["users",{"id":1,name:"person"}]'

About

create stable cache keys from complex objects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published