min-data
v1.0.3
Published
Store value for object, jQuery style Data
Downloads
41
Readme
min-data
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][downloads-url] [![Dependency Status][david-image]][david-url] [npm-image]: https://img.shields.io/npm/v/min-data.svg?style=flat-square [npm-url]: https://npmjs.org/package/min-data [downloads-image]: http://img.shields.io/npm/dm/min-data.svg?style=flat-square [downloads-url]: https://npmjs.org/package/min-data [david-image]: http://img.shields.io/david/chunpu/min-data.svg?style=flat-square [david-url]: https://david-dm.org/chunpu/min-data
Store value for object, jQuery style Data
Installation
npm i min-data
Usage
var Data = require('min-data')
var data = new Data
var obj = {}
data.set(obj, 'foo', 'bar')
data.get(obj, 'foo') // => 'bar'
data.remove(obj, 'foo')
Why should use Data
We use jQuery style Data rather than obj.foo = 'bar'
Because we can avoid object Circular Reference
Then we can JSON.stringify(obj)
safely
Simple clear all data by data.remove(obj)