cache-key
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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"}]'

Readme

Keywords

Package Sidebar

Install

npm i cache-key

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

6.12 kB

Total Files

6

Last publish

Collaborators

  • smeijer