diff --git a/index.d.ts b/index.d.ts index d916836..6fbca80 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,5 +1,5 @@ -declare module 'data-store' { +declare module '@juln/data-store' { interface Options { /**Disabled by default. Milliseconds to delay writing the JSON file to the file system. This can make the store more performant by preventing multiple subsequent writes after calling .set or setting/getting store.data, but comes with the potential side effect that (when accessing the object directly) the persisted file might be outdated during the timeout. To get around this, use data-store's API to (re-)load the file instead of directly reading the file (using fs.readFile for example). */ debounce?: number @@ -23,7 +23,7 @@ declare module 'data-store' { * Initialize a new Store with the given name, options and default data. */ - class Store { + export class Store { constructor (name?: string, options?: Options, defaults?: any) constructor (options?: Options, defaults?: any) @@ -100,5 +100,9 @@ declare module 'data-store' { unlink: () => void } - export = Store + + function createDataStore(name?: string, options?: Options, defaults?: any): Store; + function createDataStore(options?: Options, defaults?: any): Store; + + export default createDataStore; } diff --git a/index.js b/index.js index 205adb9..acf7a01 100644 --- a/index.js +++ b/index.js @@ -177,7 +177,7 @@ class Store { */ get(key, fallback) { - if (typeof key === 'undefined') { + if (typeof key === 'undefined') { return this.data; } assert.equal(typeof key, 'string', 'expected key to be a string'); diff --git a/package.json b/package.json index 305fd0d..c15befc 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,20 @@ { - "name": "data-store", + "name": "@juln/data-store", "description": "Easily persist and load config data. No dependencies.", - "version": "4.1.0", - "homepage": "https://github.com/jonschlinkert/data-store", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "version": "1.0.2", + "typings": "index.d.ts", + "homepage": "https://github.com/z-juln/data-store", + "author": "juln (https://github.com/z-juln)", "contributors": [ "Brian Woodward (https://twitter.com/doowb)", "Jamen Marz (jamenmarz.com)", "Jon Schlinkert (http://twitter.com/jonschlinkert)", - "Olsten Larck (https://i.am.charlike.online)" + "Olsten Larck (https://i.am.charlike.online)", + "juln (https://github.com/z-juln)" ], - "repository": "jonschlinkert/data-store", + "repository": "z-juln/data-store", "bugs": { - "url": "https://github.com/jonschlinkert/data-store/issues" + "url": "https://github.com/z-juln/data-store/issues" }, "license": "MIT", "files": [