{"_id":"date-store","_rev":"221172","name":"date-store","description":"Easily persist or get stored dates/times. Useful for conditionally making updates in an application based on the amount of time that has passed.","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T15:40:03.000Z","created":"2016-04-11T14:59:29.540Z","1.0.1":"2019-07-03T07:16:44.483Z","1.0.0":"2018-05-29T23:44:34.469Z","0.1.2":"2016-04-21T13:11:20.847Z","0.1.1":"2016-04-11T15:14:33.727Z","0.1.0":"2016-04-11T14:59:29.540Z"},"users":{},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/date-store.git"},"versions":{"1.0.1":{"name":"date-store","description":"Easily persist or get stored dates/times. Useful for conditionally making updates in an application based on the amount of time that has passed.","version":"1.0.1","homepage":"https://github.com/jonschlinkert/date-store","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/date-store.git"},"bugs":{"url":"https://github.com/jonschlinkert/date-store/issues"},"license":"MIT","main":"index.js","engines":{"node":">=8"},"scripts":{"test":"mocha"},"dependencies":{"date.js":"^0.3.3"},"devDependencies":{"gulp-format-md":"^2.0.0","mocha":"^6.1.4"},"keywords":["ago","cache","data","date","day","db","filter","month","since","store","time","week","year"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"related":{"list":["data-store","nanoseconds","time-stamp"]},"lint":{"reflinks":true}},"gitHead":"6cc5fad9ded051c32751740a1d232ddd31cefe74","_id":"date-store@1.0.1","_nodeVersion":"12.3.1","_npmVersion":"6.9.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"dist":{"shasum":"5b40899b43b6a0a6709188c1624049ade99ca3b9","size":5984,"noattachment":false,"key":"/date-store/-/date-store-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/date-store/download/date-store-1.0.1.tgz"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/date-store_1.0.1_1562138204362_0.6911595716935195"},"_hasShrinkwrap":false,"publish_time":1562138204483,"_cnpm_publish_time":1562138204483},"1.0.0":{"name":"date-store","description":"Easily persist or get stored dates/times. Useful for conditionally making updates in an application based on the amount of time that has passed.","version":"1.0.0","homepage":"https://github.com/jonschlinkert/date-store","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/date-store.git"},"bugs":{"url":"https://github.com/jonschlinkert/date-store/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=8"},"scripts":{"test":"mocha"},"dependencies":{"date.js":"^0.3.3"},"devDependencies":{"gulp-format-md":"^1.0.0","mocha":"^5.2.0"},"keywords":["ago","cache","data","date","day","db","filter","month","since","store","time","week","year"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"related":{"list":["data-store","nanoseconds","time-stamp"]},"lint":{"reflinks":true}},"gitHead":"47b0ceb17e8e33cadde7d4fab357daef04d4cba4","_id":"date-store@1.0.0","_npmVersion":"6.0.1","_nodeVersion":"10.0.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"dist":{"shasum":"60459dc7edbbcd7142e69ab7d6090dd7eb5cbddb","size":6007,"noattachment":false,"key":"/date-store/-/date-store-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/date-store/download/date-store-1.0.0.tgz"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/date-store_1.0.0_1527637474396_0.3745163058265606"},"_hasShrinkwrap":false,"publish_time":1527637474469,"_cnpm_publish_time":1527637474469},"0.1.2":{"name":"date-store","description":"Easily persist or get stored dates/times. Useful for conditionally making updates in an application based on the amount of time that has passed.","version":"0.1.2","homepage":"https://github.com/jonschlinkert/date-store","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/date-store.git"},"bugs":{"url":"https://github.com/jonschlinkert/date-store/issues"},"license":"MIT","files":["index.js","utils.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"date.js":"github:matthewmueller/date","graceful-fs":"^4.1.3","kind-of":"^3.0.2","lazy-cache":"^1.0.3","map-cache":"^0.2.1","os-homedir":"^1.0.1","write-json":"^0.2.2"},"devDependencies":{"gulp-format-md":"^0.1.7","mocha":"^2.4.5"},"keywords":["ago","cache","data","date","day","db","filter","month","since","store","time","week","year"],"verb":{"plugins":["gulp-format-md"],"reflinks":["date","date.js","os-homedir","verb"],"related":{"highlight":"data-store","list":["data-store","time-stamp","nanoseconds"]},"run":true,"toc":false,"layout":"default","lint":{"reflinks":true},"tasks":["readme"]},"gitHead":"48fe4601ed7d403348d826e2846479deb492a155","_id":"date-store@0.1.2","_shasum":"f08355fcc0dc0c86d0ca3399e1e1230c027b8873","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.5.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"f08355fcc0dc0c86d0ca3399e1e1230c027b8873","size":5686,"noattachment":false,"key":"/date-store/-/date-store-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/date-store/download/date-store-0.1.2.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/date-store-0.1.2.tgz_1461244279405_0.26435133977793157"},"directories":{},"publish_time":1461244280847,"_cnpm_publish_time":1461244280847,"_hasShrinkwrap":false},"0.1.1":{"name":"date-store","description":"Easily persist or get stored dates/times. Useful for conditionally making updates in an application based on the amount of time that has passed.","version":"0.1.1","homepage":"https://github.com/jonschlinkert/date-store","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/date-store.git"},"bugs":{"url":"https://github.com/jonschlinkert/date-store/issues"},"license":"MIT","files":["index.js","utils.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"date.js":"^0.3.1","graceful-fs":"^4.1.3","kind-of":"^3.0.2","lazy-cache":"^1.0.3","map-cache":"^0.2.1","os-homedir":"^1.0.1","write-json":"^0.2.2"},"devDependencies":{"gulp-format-md":"^0.1.7","mocha":"^2.4.5"},"keywords":[],"verb":{"run":true,"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"reflinks":["verb","date.js","date","os-homedir"],"lint":{"reflinks":true}},"gitHead":"42f33fae46841f1099d95b36c9db563b3bf4eb8e","_id":"date-store@0.1.1","_shasum":"bf59bc7bfc328546d7c31b9e9195c1054db73952","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.5.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"bf59bc7bfc328546d7c31b9e9195c1054db73952","size":5216,"noattachment":false,"key":"/date-store/-/date-store-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/date-store/download/date-store-0.1.1.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/date-store-0.1.1.tgz_1460387672973_0.3361773386131972"},"directories":{},"publish_time":1460387673727,"_cnpm_publish_time":1460387673727,"_hasShrinkwrap":false},"0.1.0":{"name":"date-store","description":"Easily persist or get stored dates/times. Useful for conditionally making updates in an application based on the amount of time that has passed.","version":"0.1.0","homepage":"https://github.com/jonschlinkert/date-store","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/date-store.git"},"bugs":{"url":"https://github.com/jonschlinkert/date-store/issues"},"license":"MIT","files":["index.js","utils.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"date.js":"^0.3.1","graceful-fs":"^4.1.3","kind-of":"^3.0.2","lazy-cache":"^1.0.3","map-cache":"^0.2.1","os-homedir":"^1.0.1","write-json":"^0.2.2"},"devDependencies":{"gulp-format-md":"^0.1.7","mocha":"^2.4.5"},"keywords":[],"verb":{"run":true,"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"reflinks":["verb","date.js","date","os-homedir"],"lint":{"reflinks":true}},"gitHead":"d0cb17d5978414560680d790aabf4c0a36965263","_id":"date-store@0.1.0","_shasum":"a5f054e285ab6285e01dd0028a119a219963612d","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.5.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"a5f054e285ab6285e01dd0028a119a219963612d","size":5064,"noattachment":false,"key":"/date-store/-/date-store-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/date-store/download/date-store-0.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/date-store-0.1.0.tgz_1460386767077_0.7130572607275099"},"directories":{},"publish_time":1460386769540,"_cnpm_publish_time":1460386769540,"_hasShrinkwrap":false}},"readme":"# date-store [![NPM version](https://img.shields.io/npm/v/date-store.svg?style=flat)](https://www.npmjs.com/package/date-store) [![NPM monthly downloads](https://img.shields.io/npm/dm/date-store.svg?style=flat)](https://npmjs.org/package/date-store) [![NPM total downloads](https://img.shields.io/npm/dt/date-store.svg?style=flat)](https://npmjs.org/package/date-store) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/date-store.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/date-store)\n\n> Easily persist or get stored dates/times. Useful for conditionally making updates in an application based on the amount of time that has passed.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save date-store\n```\n\n## Usage\n\n```js\nconst DateStore = require('date-store');\n```\n\n## API\n\n**Params**\n\n* `name` **{String}**: If `options.path` is supplied, `name` will be ignored. Otherwise `name` is used as the filename for the JSON store: `~/.date-store/{name}.json`\n* `options` **{Object}**: Optionally pass a `dir` and/or `path` to use for the JSON store. Default is `~/.date-store.json`\n\n**Example**\n\n```js\nconst store = new DateStore();\n```\n\n**Params**\n\n* `key` **{string}**\n* `returns` **{object}**: Returns the instance for chaining.\n\n**Example**\n\n```js\nstore.set(key);\n```\n\n**Params**\n\n* `key` **{String}**: The name of the stored date to get.\n* `returns` **{Date}**: Returns the date object for `key`\n\n**Example**\n\n```js\nstore.set('foo');\nconsole.log(store.get('foo'));\n//=> Mon Apr 11 2016 06:18:31 GMT-0400 (EDT)\n\nconsole.log(store.get('foo') instanceof Date);\n//=> true\n```\n\n**Params**\n\n* `key` **{String}**: The name of the stored date to get.\n* `returns` **{String}**: Returns the stringified date for `key`\n\n**Example**\n\n```js\nstore.set('foo');\nconsole.log(store.getRaw('foo'));\n//=> Mon Apr 11 2016 08:39:10 GMT-0400 (EDT)\n\nconsole.log(store.getRaw('foo') instanceof Date);\n//=> false\n\nconsole.log(store.get('foo') instanceof Date);\n//=> true\n```\n\n**Params**\n\n* `key` **{String}**: The name of the stored date to get.\n* `returns` **{Number}**\n\n**Example**\n\n```js\nstore.set('foo');\nconsole.log(store.getTime('foo'));\n//=> 1460378350000\n```\n\n**Params**\n\n* `key` **{String}**\n* `returns` **{Boolean}**\n\n**Example**\n\n```js\nstore.set('foo');\nconsole.log(store.has('foo'));\n//=> true\n```\n\n**Params**\n\n* `key` **{String|Array}**: Property name or array of property names.\n* `returns` **{Object}**: Returns the instance for chaining.\n\n**Example**\n\n```js\nstore.del('foo');\n```\n\n**Params**\n\n* `str` **{String}**: A human-readable string to pass to [date.js](https://github.com/MatthewMueller/date)\n* `returns` **{Date}**: JavaScript Date object\n\n**Example**\n\n```js\nconsole.log(store.date('1 day from now'));\n//=> Tue Apr 12 2016 10:05:12 GMT-0400 (EDT)\n```\n\n**Params**\n\n* `timespan` **{String}**: A human-readable string to pass to [date.js](https://github.com/MatthewMueller/date)\n* `returns` **{Date}**: JavaScript Date object\n\n**Example**\n\n```js\nconsole.log(store.date('1 day from now'));\n//=> Tue Apr 12 2016 10:05:12 GMT-0400 (EDT)\n```\n\n**Params**\n\n* `key` **{String}**: The stored date to compare\n* `timespan` **{String}**: A human-readable string to pass to [date.js](https://github.com/MatthewMueller/date)\n* `returns` **{Number}**: The difference in seconds between the two dates, or `NaN` if invalid.\n\n**Example**\n\n```js\nconsole.log(store.diff('foo', '10 minutes ago'));\n//=> 338563\n```\n\n**Params**\n\n* `key` **{String}**: The name of the stored date to set on `.current`\n* `returns` **{Object}**: Returns the instance for chaining.\n\n**Example**\n\n```js\nstore.set('bar');\nstore.lastSaved('bar');\nconsole.log(store.current);\n//=> 1460378350000\nconsole.log(store.lastSaved('bar').moreThan('31 minutes ago'));\n//= false\nconsole.log(store.lastSaved('bar').lessThan('31 minutes ago'));\n//=> true\n```\n\n**Params**\n\n* `key` **{String}**: The name of the stored date to set on `.current`\n* `returns` **{Object}**: Returns the instance for chaining.\n\n**Example**\n\n```js\nstore.set('bar');\n\nconsole.log(store.lastSaved('bar').moreThan('31 minutes ago'));\n//= false\nconsole.log(store.lastSaved('bar').lessThan('1 minutes ago'));\n//=> true\n```\n\n**Params**\n\n* `key` **{String}**: The name of the stored date to set on `.current`\n* `returns` **{Object}**: Returns the instance for chaining.\n\n**Example**\n\n```js\nstore.set('bar');\n\nconsole.log(store.lastSaved('bar').moreThan('31 minutes ago'));\n//= false\nconsole.log(store.lastSaved('bar').lessThan('1 minutes ago'));\n//=> true\n```\n\n**Params**\n\n* `timespan` **{String}**: A human-readable string to pass to [date.js](https://github.com/MatthewMueller/date)\n* `returns` **{Array}**: Returns an array of keys\n\n**Example**\n\n```js\nvar keys = store.filterSince('1 week ago');\n```\n\n### [.clear](index.js#L323)\n\nReset `store.dates` to an empty object.\n\n* `returns` **{undefined}**\n\n**Example**\n\n```js\nstore.clear();\n```\n\n### [.json](index.js#L339)\n\nStringify the store. Takes the same arguments as `JSON.stringify`.\n\n* `returns` **{string}**\n\n**Example**\n\n```js\nconsole.log(store.json(null, 2));\n```\n\n### [.save](index.js#L358)\n\nCalls [.writeFile()](#writefile) to persist the store to the file system, after an optional [debounce](#options) period. This method should probably not be called directly as it's used internally by other methods.\n\n* `returns` **{undefined}**\n\n**Example**\n\n```js\nstore.save();\n```\n\n### [.dates](index.js#L425)\n\nGetter/setter for the `store.dates` object, which holds the values that are persisted to the file system.\n\n* `returns` **{object}**\n\n**Example**\n\n```js\nconsole.log(store.dates); //=> {}\n\nstore.set('foo');\nstore.set('bar');\n\nconsole.log(store.dates);\n// { foo: 'Mon Apr 11 2016 08:39:10 GMT-0400 (EDT)',\n//   bar: 'Mon Apr 11 2016 08:39:10 GMT-0400 (EDT)' }\n```\n\n## About\n\n<details>\n<summary><strong>Contributing</strong></summary>\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n</details>\n\n<details>\n<summary><strong>Running Tests</strong></summary>\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n</details>\n\n<details>\n<summary><strong>Building docs</strong></summary>\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n</details>\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [data-store](https://www.npmjs.com/package/data-store): Easily persist and load config data. No dependencies. | [homepage](https://github.com/jonschlinkert/data-store \"Easily persist and load config data. No dependencies.\")\n* [nanoseconds](https://www.npmjs.com/package/nanoseconds): Convert the process.hrtime() array to a single nanoseconds value. This makes it easier to diff… [more](https://github.com/jonschlinkert/nanoseconds) | [homepage](https://github.com/jonschlinkert/nanoseconds \"Convert the process.hrtime() array to a single nanoseconds value. This makes it easier to diff times.\")\n* [time-stamp](https://www.npmjs.com/package/time-stamp): Get a formatted timestamp. | [homepage](https://github.com/jonschlinkert/time-stamp \"Get a formatted timestamp.\")\n\n### Author\n\n**Jon Schlinkert**\n\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 29, 2018._","_attachments":{},"homepage":"https://github.com/jonschlinkert/date-store","bugs":{"url":"https://github.com/jonschlinkert/date-store/issues"},"license":"MIT"}