From 25811c52222cbe0ee85c8ae0d984b4ae09de0ca7 Mon Sep 17 00:00:00 2001 From: jghaanstra Date: Thu, 11 Jul 2019 20:31:07 +0200 Subject: [PATCH] Release 2.12.0 --- node_modules/map-age-cleaner/dist/index.d.ts | 20 ++ node_modules/map-age-cleaner/dist/index.js | 92 ++++++ node_modules/map-age-cleaner/license | 9 + node_modules/map-age-cleaner/package.json | 91 ++++++ node_modules/map-age-cleaner/readme.md | 67 +++++ node_modules/mem/index.d.ts | 93 ++++++ node_modules/mem/index.js | 66 +++-- node_modules/mem/license | 20 +- node_modules/mem/package.json | 48 ++-- node_modules/mem/readme.md | 92 +++--- node_modules/mimic-fn/index.d.ts | 54 ++++ node_modules/mimic-fn/index.js | 10 +- node_modules/mimic-fn/package.json | 34 +-- node_modules/mimic-fn/readme.md | 5 +- .../os-locale/node_modules/mem/index.js | 55 ++++ .../os-locale/node_modules/mem/license | 21 ++ .../os-locale/node_modules/mem/package.json | 77 +++++ .../os-locale/node_modules/mem/readme.md | 147 ++++++++++ .../os-locale/node_modules/mimic-fn/index.js | 9 + .../os-locale/node_modules/mimic-fn/license | 9 + .../node_modules/mimic-fn/package.json | 72 +++++ .../os-locale/node_modules/mimic-fn/readme.md | 68 +++++ node_modules/p-defer/index.js | 11 + node_modules/p-defer/license | 21 ++ node_modules/p-defer/package.json | 73 +++++ node_modules/p-defer/readme.md | 47 +++ node_modules/p-is-promise/index.d.ts | 23 ++ node_modules/p-is-promise/index.js | 15 + node_modules/p-is-promise/license | 9 + node_modules/p-is-promise/package.json | 74 +++++ node_modules/p-is-promise/readme.md | 43 +++ package-lock.json | 272 ++++++++++-------- package.json | 1 + 33 files changed, 1515 insertions(+), 233 deletions(-) create mode 100644 node_modules/map-age-cleaner/dist/index.d.ts create mode 100644 node_modules/map-age-cleaner/dist/index.js create mode 100644 node_modules/map-age-cleaner/license create mode 100644 node_modules/map-age-cleaner/package.json create mode 100644 node_modules/map-age-cleaner/readme.md create mode 100644 node_modules/mem/index.d.ts create mode 100644 node_modules/mimic-fn/index.d.ts create mode 100644 node_modules/os-locale/node_modules/mem/index.js create mode 100644 node_modules/os-locale/node_modules/mem/license create mode 100644 node_modules/os-locale/node_modules/mem/package.json create mode 100644 node_modules/os-locale/node_modules/mem/readme.md create mode 100644 node_modules/os-locale/node_modules/mimic-fn/index.js create mode 100644 node_modules/os-locale/node_modules/mimic-fn/license create mode 100644 node_modules/os-locale/node_modules/mimic-fn/package.json create mode 100644 node_modules/os-locale/node_modules/mimic-fn/readme.md create mode 100644 node_modules/p-defer/index.js create mode 100644 node_modules/p-defer/license create mode 100644 node_modules/p-defer/package.json create mode 100644 node_modules/p-defer/readme.md create mode 100644 node_modules/p-is-promise/index.d.ts create mode 100644 node_modules/p-is-promise/index.js create mode 100644 node_modules/p-is-promise/license create mode 100644 node_modules/p-is-promise/package.json create mode 100644 node_modules/p-is-promise/readme.md diff --git a/node_modules/map-age-cleaner/dist/index.d.ts b/node_modules/map-age-cleaner/dist/index.d.ts new file mode 100644 index 0000000..fbf5ce0 --- /dev/null +++ b/node_modules/map-age-cleaner/dist/index.d.ts @@ -0,0 +1,20 @@ +interface Entry { + [key: string]: any; +} +interface MaxAgeEntry extends Entry { + maxAge: number; +} +/** + * Automatically cleanup the items in the provided `map`. The property of the expiration timestamp should be named `maxAge`. + * + * @param map - Map instance which should be cleaned up. + */ +export default function mapAgeCleaner(map: Map): any; +/** + * Automatically cleanup the items in the provided `map`. + * + * @param map - Map instance which should be cleaned up. + * @param property - Name of the property which olds the expiry timestamp. + */ +export default function mapAgeCleaner(map: Map, property: string): any; +export {}; diff --git a/node_modules/map-age-cleaner/dist/index.js b/node_modules/map-age-cleaner/dist/index.js new file mode 100644 index 0000000..ff137de --- /dev/null +++ b/node_modules/map-age-cleaner/dist/index.js @@ -0,0 +1,92 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const p_defer_1 = __importDefault(require("p-defer")); +function mapAgeCleaner(map, property = 'maxAge') { + let processingKey; + let processingTimer; + let processingDeferred; + const cleanup = () => __awaiter(this, void 0, void 0, function* () { + if (processingKey !== undefined) { + // If we are already processing an item, we can safely exit + return; + } + const setupTimer = (item) => __awaiter(this, void 0, void 0, function* () { + processingDeferred = p_defer_1.default(); + const delay = item[1][property] - Date.now(); + if (delay <= 0) { + // Remove the item immediately if the delay is equal to or below 0 + map.delete(item[0]); + processingDeferred.resolve(); + return; + } + // Keep track of the current processed key + processingKey = item[0]; + processingTimer = setTimeout(() => { + // Remove the item when the timeout fires + map.delete(item[0]); + if (processingDeferred) { + processingDeferred.resolve(); + } + }, delay); + // tslint:disable-next-line:strict-type-predicates + if (typeof processingTimer.unref === 'function') { + // Don't hold up the process from exiting + processingTimer.unref(); + } + return processingDeferred.promise; + }); + try { + for (const entry of map) { + yield setupTimer(entry); + } + } + catch (_a) { + // Do nothing if an error occurs, this means the timer was cleaned up and we should stop processing + } + processingKey = undefined; + }); + const reset = () => { + processingKey = undefined; + if (processingTimer !== undefined) { + clearTimeout(processingTimer); + processingTimer = undefined; + } + if (processingDeferred !== undefined) { // tslint:disable-line:early-exit + processingDeferred.reject(undefined); + processingDeferred = undefined; + } + }; + const originalSet = map.set.bind(map); + map.set = (key, value) => { + if (map.has(key)) { + // If the key already exist, remove it so we can add it back at the end of the map. + map.delete(key); + } + // Call the original `map.set` + const result = originalSet(key, value); + // If we are already processing a key and the key added is the current processed key, stop processing it + if (processingKey && processingKey === key) { + reset(); + } + // Always run the cleanup method in case it wasn't started yet + cleanup(); // tslint:disable-line:no-floating-promises + return result; + }; + cleanup(); // tslint:disable-line:no-floating-promises + return map; +} +exports.default = mapAgeCleaner; +// Add support for CJS +module.exports = mapAgeCleaner; +module.exports.default = mapAgeCleaner; diff --git a/node_modules/map-age-cleaner/license b/node_modules/map-age-cleaner/license new file mode 100644 index 0000000..0711ab0 --- /dev/null +++ b/node_modules/map-age-cleaner/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sam Verschueren (github.com/SamVerschueren) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/map-age-cleaner/package.json b/node_modules/map-age-cleaner/package.json new file mode 100644 index 0000000..eb6231b --- /dev/null +++ b/node_modules/map-age-cleaner/package.json @@ -0,0 +1,91 @@ +{ + "_from": "map-age-cleaner@^0.1.3", + "_id": "map-age-cleaner@0.1.3", + "_inBundle": false, + "_integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "_location": "/map-age-cleaner", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "map-age-cleaner@^0.1.3", + "name": "map-age-cleaner", + "escapedName": "map-age-cleaner", + "rawSpec": "^0.1.3", + "saveSpec": null, + "fetchSpec": "^0.1.3" + }, + "_requiredBy": [ + "/mem" + ], + "_resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "_shasum": "7d583a7306434c055fe474b0f45078e6e1b4b92a", + "_spec": "map-age-cleaner@^0.1.3", + "_where": "D:\\Solide Webservices\\Github\\com.xiaomi-miio\\node_modules\\mem", + "author": { + "name": "Sam Verschueren", + "email": "sam.verschueren@gmail.com", + "url": "github.com/SamVerschueren" + }, + "bugs": { + "url": "https://github.com/SamVerschueren/map-age-cleaner/issues" + }, + "bundleDependencies": false, + "dependencies": { + "p-defer": "^1.0.0" + }, + "deprecated": false, + "description": "Automatically cleanup expired items in a Map", + "devDependencies": { + "@types/delay": "^2.0.1", + "@types/node": "^10.7.1", + "ava": "^0.25.0", + "codecov": "^3.0.0", + "del-cli": "^1.1.0", + "delay": "^3.0.0", + "nyc": "^12.0.0", + "tslint": "^5.11.0", + "tslint-xo": "^0.9.0", + "typescript": "^3.0.1" + }, + "engines": { + "node": ">=6" + }, + "files": [ + "dist/index.js", + "dist/index.d.ts" + ], + "homepage": "https://github.com/SamVerschueren/map-age-cleaner#readme", + "keywords": [ + "map", + "age", + "cleaner", + "maxage", + "expire", + "expiration", + "expiring" + ], + "license": "MIT", + "main": "dist/index.js", + "name": "map-age-cleaner", + "nyc": { + "exclude": [ + "dist/test.js" + ] + }, + "repository": { + "type": "git", + "url": "git+https://github.com/SamVerschueren/map-age-cleaner.git" + }, + "scripts": { + "build": "npm run clean && tsc", + "clean": "del-cli dist", + "lint": "tslint --format stylish --project .", + "prepublishOnly": "npm run build", + "pretest": "npm run build -- --sourceMap", + "test": "npm run lint && nyc ava dist/test.js" + }, + "sideEffects": false, + "typings": "dist/index.d.ts", + "version": "0.1.3" +} diff --git a/node_modules/map-age-cleaner/readme.md b/node_modules/map-age-cleaner/readme.md new file mode 100644 index 0000000..471d933 --- /dev/null +++ b/node_modules/map-age-cleaner/readme.md @@ -0,0 +1,67 @@ +# map-age-cleaner + +[![Build Status](https://travis-ci.org/SamVerschueren/map-age-cleaner.svg?branch=master)](https://travis-ci.org/SamVerschueren/map-age-cleaner) [![codecov](https://codecov.io/gh/SamVerschueren/map-age-cleaner/badge.svg?branch=master)](https://codecov.io/gh/SamVerschueren/map-age-cleaner?branch=master) + +> Automatically cleanup expired items in a Map + + +## Install + +``` +$ npm install map-age-cleaner +``` + + +## Usage + +```js +import mapAgeCleaner from 'map-age-cleaner'; + +const map = new Map([ + ['unicorn', {data: '🦄', maxAge: Date.now() + 1000}] +]); + +mapAgeCleaner(map); + +map.has('unicorn'); +//=> true + +// Wait for 1 second... + +map.has('unicorn'); +//=> false +``` + +> **Note**: Items have to be ordered ascending based on the expiry property. This means that the item which will be expired first, should be in the first position of the `Map`. + + +## API + +### mapAgeCleaner(map, [property]) + +Returns the `Map` instance. + +#### map + +Type: `Map` + +Map instance which should be cleaned up. + +#### property + +Type: `string`
+Default: `maxAge` + +Name of the property which olds the expiry timestamp. + + +## Related + +- [expiry-map](https://github.com/SamVerschueren/expiry-map) - A `Map` implementation with expirable items +- [expiry-set](https://github.com/SamVerschueren/expiry-set) - A `Set` implementation with expirable keys +- [mem](https://github.com/sindresorhus/mem) - Memoize functions + + +## License + +MIT © [Sam Verschueren](https://github.com/SamVerschueren) diff --git a/node_modules/mem/index.d.ts b/node_modules/mem/index.d.ts new file mode 100644 index 0000000..dc74ec9 --- /dev/null +++ b/node_modules/mem/index.d.ts @@ -0,0 +1,93 @@ +declare namespace mem { + interface CacheStorage { + has(key: KeyType): boolean; + get(key: KeyType): ValueType | undefined; + set(key: KeyType, value: ValueType): void; + delete(key: KeyType): void; + clear?: () => void; + } + + interface Options< + ArgumentsType extends unknown[], + CacheKeyType, + ReturnType + > { + /** + Milliseconds until the cache expires. + + @default Infinity + */ + readonly maxAge?: number; + + /** + Determines the cache key for storing the result based on the function arguments. By default, if there's only one argument and it's a [primitive](https://developer.mozilla.org/en-US/docs/Glossary/Primitive), it's used directly as a key (if it's a `function`, its reference will be used as key), otherwise it's all the function arguments JSON stringified as an array. + + You could for example change it to only cache on the first argument `x => JSON.stringify(x)`. + */ + readonly cacheKey?: (...arguments: ArgumentsType) => CacheKeyType; + + /** + Use a different cache storage. You could for example use a `WeakMap` instead or [`quick-lru`](https://github.com/sindresorhus/quick-lru) for a LRU cache. + + @default new Map() + */ + readonly cache?: CacheStorage; + + /** + Cache rejected promises. + + @default true + */ + readonly cachePromiseRejection?: boolean; + } +} + +declare const mem: { + /** + [Memoize](https://en.wikipedia.org/wiki/Memoization) functions - An optimization used to speed up consecutive function calls by caching the result of calls with identical input. + + @param fn - Function to be memoized. + + @example + ``` + import mem = require('mem'); + + let i = 0; + const counter = () => ++i; + const memoized = mem(counter); + + memoized('foo'); + //=> 1 + + // Cached as it's the same arguments + memoized('foo'); + //=> 1 + + // Not cached anymore as the arguments changed + memoized('bar'); + //=> 2 + + memoized('bar'); + //=> 2 + ``` + */ + < + ArgumentsType extends unknown[], + ReturnType, + CacheKeyType + >( + fn: (...arguments: ArgumentsType) => ReturnType, + options?: mem.Options + ): (...arguments: ArgumentsType) => ReturnType; + + /** + Clear all cached data of a memoized function. + + @param fn - Memoized function. + */ + clear( + fn: (...arguments: ArgumentsType) => ReturnType + ): void; +}; + +export = mem; diff --git a/node_modules/mem/index.js b/node_modules/mem/index.js index aa5a073..34de26c 100644 --- a/node_modules/mem/index.js +++ b/node_modules/mem/index.js @@ -1,51 +1,71 @@ 'use strict'; const mimicFn = require('mimic-fn'); +const isPromise = require('p-is-promise'); +const mapAgeCleaner = require('map-age-cleaner'); const cacheStore = new WeakMap(); -const defaultCacheKey = function (x) { - if (arguments.length === 1 && (x === null || x === undefined || (typeof x !== 'function' && typeof x !== 'object'))) { - return x; +const defaultCacheKey = (...arguments_) => { + if (arguments_.length === 0) { + return '__defaultKey'; } - return JSON.stringify(arguments); + if (arguments_.length === 1) { + const [firstArgument] = arguments_; + const isObject = typeof firstArgument === 'object' && firstArgument !== null; + const isPrimitive = !isObject; + if (isPrimitive) { + return firstArgument; + } + } + + return JSON.stringify(arguments_); }; -module.exports = (fn, opts) => { - opts = Object.assign({ - cacheKey: defaultCacheKey, - cache: new Map() - }, opts); +const mem = (fn, { + cacheKey = defaultCacheKey, + cache = new Map(), + cachePromiseRejection = true, + maxAge +} = {}) => { + if (typeof maxAge === 'number') { + mapAgeCleaner(cache); + } - const memoized = function () { - const cache = cacheStore.get(memoized); - const key = opts.cacheKey.apply(null, arguments); + const memoized = function (...arguments_) { + const key = cacheKey(...arguments_); if (cache.has(key)) { - const c = cache.get(key); - - if (typeof opts.maxAge !== 'number' || Date.now() < c.maxAge) { - return c.data; - } + return cache.get(key).data; } - const ret = fn.apply(null, arguments); + const cacheItem = fn.apply(this, arguments_); cache.set(key, { - data: ret, - maxAge: Date.now() + (opts.maxAge || 0) + data: cacheItem, + maxAge: maxAge ? Date.now() + maxAge : Infinity }); - return ret; + if (isPromise(cacheItem) && cachePromiseRejection === false) { + cacheItem.catch(() => cache.delete(key)); + } + + return cacheItem; }; - mimicFn(memoized, fn); + try { + // The below call will throw in some host environments + // See https://github.com/sindresorhus/mimic-fn/issues/10 + mimicFn(memoized, fn); + } catch (_) {} - cacheStore.set(memoized, opts.cache); + cacheStore.set(memoized, cache); return memoized; }; +module.exports = mem; + module.exports.clear = fn => { const cache = cacheStore.get(fn); diff --git a/node_modules/mem/license b/node_modules/mem/license index 654d0bf..e7af2f7 100644 --- a/node_modules/mem/license +++ b/node_modules/mem/license @@ -1,21 +1,9 @@ -The MIT License (MIT) +MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/mem/package.json b/node_modules/mem/package.json index 0e0c2ec..694160f 100644 --- a/node_modules/mem/package.json +++ b/node_modules/mem/package.json @@ -1,27 +1,28 @@ { - "_from": "mem@^1.1.0", - "_id": "mem@1.1.0", + "_from": "mem", + "_id": "mem@5.1.1", "_inBundle": false, - "_integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "_integrity": "sha512-qvwipnozMohxLXG1pOqoLiZKNkC4r4qqRucSoDwXowsNGDSULiqFTRUF05vcZWnwJSG22qTsynQhxbaMtnX9gw==", "_location": "/mem", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "tag", "registry": true, - "raw": "mem@^1.1.0", + "raw": "mem", "name": "mem", "escapedName": "mem", - "rawSpec": "^1.1.0", + "rawSpec": "", "saveSpec": null, - "fetchSpec": "^1.1.0" + "fetchSpec": "latest" }, "_requiredBy": [ - "/os-locale" + "#USER", + "/" ], - "_resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "_shasum": "5edd52b485ca1d900fe64895505399a0dfa45f76", - "_spec": "mem@^1.1.0", - "_where": "D:\\Solide Webservices\\Github\\SDK2\\com.xiaomi-miio\\node_modules\\os-locale", + "_resolved": "https://registry.npmjs.org/mem/-/mem-5.1.1.tgz", + "_shasum": "7059b67bf9ac2c924c9f1cff7155a064394adfb3", + "_spec": "mem", + "_where": "D:\\Solide Webservices\\Github\\com.xiaomi-miio", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -32,20 +33,24 @@ }, "bundleDependencies": false, "dependencies": { - "mimic-fn": "^1.0.0" + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^2.1.0", + "p-is-promise": "^2.1.0" }, "deprecated": false, "description": "Memoize functions - An optimization used to speed up consecutive function calls by caching the result of calls with identical input", "devDependencies": { - "ava": "*", - "delay": "^1.1.0", - "xo": "*" + "ava": "^1.4.1", + "delay": "^4.1.0", + "tsd": "^0.7.3", + "xo": "^0.24.0" }, "engines": { - "node": ">=4" + "node": ">=8" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "homepage": "https://github.com/sindresorhus/mem#readme", "keywords": [ @@ -68,10 +73,7 @@ "url": "git+https://github.com/sindresorhus/mem.git" }, "scripts": { - "test": "xo && ava" + "test": "xo && ava && tsd" }, - "version": "1.1.0", - "xo": { - "esnext": true - } + "version": "5.1.1" } diff --git a/node_modules/mem/readme.md b/node_modules/mem/readme.md index 7ebab84..a22ec19 100644 --- a/node_modules/mem/readme.md +++ b/node_modules/mem/readme.md @@ -2,11 +2,13 @@ > [Memoize](https://en.wikipedia.org/wiki/Memoization) functions - An optimization used to speed up consecutive function calls by caching the result of calls with identical input +Memory is automatically released when an item expires. + ## Install ``` -$ npm install --save mem +$ npm install mem ``` @@ -22,11 +24,11 @@ const memoized = mem(counter); memoized('foo'); //=> 1 -// cached as it's the same arguments +// Cached as it's the same arguments memoized('foo'); //=> 1 -// not cached anymore as the arguments changed +// Not cached anymore as the arguments changed memoized('bar'); //=> 2 @@ -40,41 +42,43 @@ memoized('bar'); const mem = require('mem'); let i = 0; -const counter = () => Promise.resolve(++i); +const counter = async () => ++i; const memoized = mem(counter); -memoized().then(a => { - console.log(a); +(async () => { + console.log(await memoized()); //=> 1 - memoized().then(b => { - // the return value didn't increase as it's cached - console.log(b); - //=> 1 - }); -}); + // The return value didn't increase as it's cached + console.log(await memoized()); + //=> 1 +})(); ``` ```js const mem = require('mem'); const got = require('got'); +const delay = require('delay'); + const memGot = mem(got, {maxAge: 1000}); -memGot('sindresorhus.com').then(() => { - // this call is cached - memGot('sindresorhus.com').then(() => { - setTimeout(() => { - // this call is not cached as the cache has expired - memGot('sindresorhus.com').then(() => {}); - }, 2000); - }); -}); +(async () => { + await memGot('sindresorhus.com'); + + // This call is cached + await memGot('sindresorhus.com'); + + await delay(2000); + + // This call is not cached as the cache has expired + await memGot('sindresorhus.com'); +})(); ``` ## API -### mem(fn, [options]) +### mem(fn, options?) #### fn @@ -84,6 +88,8 @@ Function to be memoized. #### options +Type: `object` + ##### maxAge Type: `number`
@@ -95,16 +101,23 @@ Milliseconds until the cache expires. Type: `Function` -Determines the cache key for storing the result based on the function arguments. By default, if there's only one argument and it's a [primitive](https://developer.mozilla.org/en-US/docs/Glossary/Primitive), it's used directly as a key, otherwise it's all the function arguments JSON stringified as an array. +Determines the cache key for storing the result based on the function arguments. By default, if there's only one argument and it's a [primitive](https://developer.mozilla.org/en-US/docs/Glossary/Primitive), it's used directly as a key (if it's a `function`, its reference will be used as key), otherwise it's all the function arguments JSON stringified as an array. You could for example change it to only cache on the first argument `x => JSON.stringify(x)`. ##### cache -Type: `Object`
+Type: `object`
Default: `new Map()` -Use a different cache storage. Must implement the following methods: `.has(key)`, `.get(key)`, `.set(key, value)`, and optionally `.clear()`. You could for example use a `WeakMap` instead. +Use a different cache storage. Must implement the following methods: `.has(key)`, `.get(key)`, `.set(key, value)`, `.delete(key)`, and optionally `.clear()`. You could for example use a `WeakMap` instead or [`quick-lru`](https://github.com/sindresorhus/quick-lru) for a LRU cache. + +##### cachePromiseRejection + +Type: `boolean`
+Default: `true` + +Cache rejected promises. ### mem.clear(fn) @@ -133,15 +146,30 @@ const got = require('got'); const cache = new StatsMap(); const memGot = mem(got, {cache}); -memGot('sindresorhus.com') - .then(() => memGot('sindresorhus.com')) - .then(() => memGot('sindresorhus.com')); +(async () => { + await memGot('sindresorhus.com'); + await memGot('sindresorhus.com'); + await memGot('sindresorhus.com'); -console.log(cache.stats); -//=> {hits: 2, misses: 1} + console.log(cache.stats); + //=> {hits: 2, misses: 1} +})(); ``` -## License +## Related + +- [p-memoize](https://github.com/sindresorhus/p-memoize) - Memoize promise-returning & async functions + + +--- -MIT © [Sindre Sorhus](https://sindresorhus.com) +
+ + Get professional support for this package with a Tidelift subscription + +
+ + Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. +
+
diff --git a/node_modules/mimic-fn/index.d.ts b/node_modules/mimic-fn/index.d.ts new file mode 100644 index 0000000..b4047d5 --- /dev/null +++ b/node_modules/mimic-fn/index.d.ts @@ -0,0 +1,54 @@ +declare const mimicFn: { + /** + Make a function mimic another one. It will copy over the properties `name`, `length`, `displayName`, and any custom properties you may have set. + + @param to - Mimicking function. + @param from - Function to mimic. + @returns The modified `to` function. + + @example + ``` + import mimicFn = require('mimic-fn'); + + function foo() {} + foo.unicorn = '🦄'; + + function wrapper() { + return foo(); + } + + console.log(wrapper.name); + //=> 'wrapper' + + mimicFn(wrapper, foo); + + console.log(wrapper.name); + //=> 'foo' + + console.log(wrapper.unicorn); + //=> '🦄' + ``` + */ + < + ArgumentsType extends unknown[], + ReturnType, + FunctionType extends (...arguments: ArgumentsType) => ReturnType + >( + to: (...arguments: ArgumentsType) => ReturnType, + from: FunctionType + ): FunctionType; + + // TODO: Remove this for the next major release, refactor the whole definition to: + // declare function mimicFn< + // ArgumentsType extends unknown[], + // ReturnType, + // FunctionType extends (...arguments: ArgumentsType) => ReturnType + // >( + // to: (...arguments: ArgumentsType) => ReturnType, + // from: FunctionType + // ): FunctionType; + // export = mimicFn; + default: typeof mimicFn; +}; + +export = mimicFn; diff --git a/node_modules/mimic-fn/index.js b/node_modules/mimic-fn/index.js index 08e69d3..1a59705 100644 --- a/node_modules/mimic-fn/index.js +++ b/node_modules/mimic-fn/index.js @@ -1,9 +1,13 @@ 'use strict'; -module.exports = (to, from) => { - // TODO: use `Reflect.ownKeys()` when targeting Node.js 6 - for (const prop of Object.getOwnPropertyNames(from).concat(Object.getOwnPropertySymbols(from))) { + +const mimicFn = (to, from) => { + for (const prop of Reflect.ownKeys(from)) { Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop)); } return to; }; + +module.exports = mimicFn; +// TODO: Remove this for the next major release +module.exports.default = mimicFn; diff --git a/node_modules/mimic-fn/package.json b/node_modules/mimic-fn/package.json index eaac361..f81584f 100644 --- a/node_modules/mimic-fn/package.json +++ b/node_modules/mimic-fn/package.json @@ -1,27 +1,27 @@ { - "_from": "mimic-fn@^1.0.0", - "_id": "mimic-fn@1.2.0", + "_from": "mimic-fn@^2.1.0", + "_id": "mimic-fn@2.1.0", "_inBundle": false, - "_integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "_integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "_location": "/mimic-fn", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "mimic-fn@^1.0.0", + "raw": "mimic-fn@^2.1.0", "name": "mimic-fn", "escapedName": "mimic-fn", - "rawSpec": "^1.0.0", + "rawSpec": "^2.1.0", "saveSpec": null, - "fetchSpec": "^1.0.0" + "fetchSpec": "^2.1.0" }, "_requiredBy": [ "/mem" ], - "_resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "_shasum": "820c86a39334640e99516928bd03fca88057d022", - "_spec": "mimic-fn@^1.0.0", - "_where": "D:\\Solide Webservices\\Github\\SDK2\\com.xiaomi-miio\\node_modules\\mem", + "_resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "_shasum": "7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b", + "_spec": "mimic-fn@^2.1.0", + "_where": "D:\\Solide Webservices\\Github\\com.xiaomi-miio\\node_modules\\mem", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", @@ -34,14 +34,16 @@ "deprecated": false, "description": "Make a function mimic another one", "devDependencies": { - "ava": "*", - "xo": "*" + "ava": "^1.4.1", + "tsd": "^0.7.1", + "xo": "^0.24.0" }, "engines": { - "node": ">=4" + "node": ">=6" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "homepage": "https://github.com/sindresorhus/mimic-fn#readme", "keywords": [ @@ -66,7 +68,7 @@ "url": "git+https://github.com/sindresorhus/mimic-fn.git" }, "scripts": { - "test": "xo && ava" + "test": "xo && ava && tsd" }, - "version": "1.2.0" + "version": "2.1.0" } diff --git a/node_modules/mimic-fn/readme.md b/node_modules/mimic-fn/readme.md index e575734..0ef8a13 100644 --- a/node_modules/mimic-fn/readme.md +++ b/node_modules/mimic-fn/readme.md @@ -21,7 +21,7 @@ function foo() {} foo.unicorn = '🦄'; function wrapper() { - return foo() {}; + return foo(); } console.log(wrapper.name); @@ -43,7 +43,7 @@ It will copy over the properties `name`, `length`, `displayName`, and any custom ### mimicFn(to, from) -It will modify `to` and return it. +Modifies the `to` function and returns it. #### to @@ -61,6 +61,7 @@ Function to mimic. ## Related - [rename-fn](https://github.com/sindresorhus/rename-fn) - Rename a function +- [keep-func-props](https://github.com/ehmicky/keep-func-props) - Wrap a function without changing its name, length and other properties ## License diff --git a/node_modules/os-locale/node_modules/mem/index.js b/node_modules/os-locale/node_modules/mem/index.js new file mode 100644 index 0000000..aa5a073 --- /dev/null +++ b/node_modules/os-locale/node_modules/mem/index.js @@ -0,0 +1,55 @@ +'use strict'; +const mimicFn = require('mimic-fn'); + +const cacheStore = new WeakMap(); + +const defaultCacheKey = function (x) { + if (arguments.length === 1 && (x === null || x === undefined || (typeof x !== 'function' && typeof x !== 'object'))) { + return x; + } + + return JSON.stringify(arguments); +}; + +module.exports = (fn, opts) => { + opts = Object.assign({ + cacheKey: defaultCacheKey, + cache: new Map() + }, opts); + + const memoized = function () { + const cache = cacheStore.get(memoized); + const key = opts.cacheKey.apply(null, arguments); + + if (cache.has(key)) { + const c = cache.get(key); + + if (typeof opts.maxAge !== 'number' || Date.now() < c.maxAge) { + return c.data; + } + } + + const ret = fn.apply(null, arguments); + + cache.set(key, { + data: ret, + maxAge: Date.now() + (opts.maxAge || 0) + }); + + return ret; + }; + + mimicFn(memoized, fn); + + cacheStore.set(memoized, opts.cache); + + return memoized; +}; + +module.exports.clear = fn => { + const cache = cacheStore.get(fn); + + if (cache && typeof cache.clear === 'function') { + cache.clear(); + } +}; diff --git a/node_modules/os-locale/node_modules/mem/license b/node_modules/os-locale/node_modules/mem/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/os-locale/node_modules/mem/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/os-locale/node_modules/mem/package.json b/node_modules/os-locale/node_modules/mem/package.json new file mode 100644 index 0000000..42067e8 --- /dev/null +++ b/node_modules/os-locale/node_modules/mem/package.json @@ -0,0 +1,77 @@ +{ + "_from": "mem@^1.1.0", + "_id": "mem@1.1.0", + "_inBundle": false, + "_integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "_location": "/os-locale/mem", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "mem@^1.1.0", + "name": "mem", + "escapedName": "mem", + "rawSpec": "^1.1.0", + "saveSpec": null, + "fetchSpec": "^1.1.0" + }, + "_requiredBy": [ + "/os-locale" + ], + "_resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "_shasum": "5edd52b485ca1d900fe64895505399a0dfa45f76", + "_spec": "mem@^1.1.0", + "_where": "D:\\Solide Webservices\\Github\\com.xiaomi-miio\\node_modules\\os-locale", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/mem/issues" + }, + "bundleDependencies": false, + "dependencies": { + "mimic-fn": "^1.0.0" + }, + "deprecated": false, + "description": "Memoize functions - An optimization used to speed up consecutive function calls by caching the result of calls with identical input", + "devDependencies": { + "ava": "*", + "delay": "^1.1.0", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/mem#readme", + "keywords": [ + "memoize", + "function", + "mem", + "memoization", + "cache", + "caching", + "optimize", + "performance", + "ttl", + "expire", + "promise" + ], + "license": "MIT", + "name": "mem", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/mem.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.1.0", + "xo": { + "esnext": true + } +} diff --git a/node_modules/os-locale/node_modules/mem/readme.md b/node_modules/os-locale/node_modules/mem/readme.md new file mode 100644 index 0000000..7ebab84 --- /dev/null +++ b/node_modules/os-locale/node_modules/mem/readme.md @@ -0,0 +1,147 @@ +# mem [![Build Status](https://travis-ci.org/sindresorhus/mem.svg?branch=master)](https://travis-ci.org/sindresorhus/mem) + +> [Memoize](https://en.wikipedia.org/wiki/Memoization) functions - An optimization used to speed up consecutive function calls by caching the result of calls with identical input + + +## Install + +``` +$ npm install --save mem +``` + + +## Usage + +```js +const mem = require('mem'); + +let i = 0; +const counter = () => ++i; +const memoized = mem(counter); + +memoized('foo'); +//=> 1 + +// cached as it's the same arguments +memoized('foo'); +//=> 1 + +// not cached anymore as the arguments changed +memoized('bar'); +//=> 2 + +memoized('bar'); +//=> 2 +``` + +##### Works fine with promise returning functions + +```js +const mem = require('mem'); + +let i = 0; +const counter = () => Promise.resolve(++i); +const memoized = mem(counter); + +memoized().then(a => { + console.log(a); + //=> 1 + + memoized().then(b => { + // the return value didn't increase as it's cached + console.log(b); + //=> 1 + }); +}); +``` + +```js +const mem = require('mem'); +const got = require('got'); +const memGot = mem(got, {maxAge: 1000}); + +memGot('sindresorhus.com').then(() => { + // this call is cached + memGot('sindresorhus.com').then(() => { + setTimeout(() => { + // this call is not cached as the cache has expired + memGot('sindresorhus.com').then(() => {}); + }, 2000); + }); +}); +``` + + +## API + +### mem(fn, [options]) + +#### fn + +Type: `Function` + +Function to be memoized. + +#### options + +##### maxAge + +Type: `number`
+Default: `Infinity` + +Milliseconds until the cache expires. + +##### cacheKey + +Type: `Function` + +Determines the cache key for storing the result based on the function arguments. By default, if there's only one argument and it's a [primitive](https://developer.mozilla.org/en-US/docs/Glossary/Primitive), it's used directly as a key, otherwise it's all the function arguments JSON stringified as an array. + +You could for example change it to only cache on the first argument `x => JSON.stringify(x)`. + +##### cache + +Type: `Object`
+Default: `new Map()` + +Use a different cache storage. Must implement the following methods: `.has(key)`, `.get(key)`, `.set(key, value)`, and optionally `.clear()`. You could for example use a `WeakMap` instead. + +### mem.clear(fn) + +Clear all cached data of a memoized function. + +#### fn + +Type: `Function` + +Memoized function. + + +## Tips + +### Cache statistics + +If you want to know how many times your cache had a hit or a miss, you can make use of [stats-map](https://github.com/SamVerschueren/stats-map) as a replacement for the default cache. + +#### Example + +```js +const mem = require('mem'); +const StatsMap = require('stats-map'); +const got = require('got'); + +const cache = new StatsMap(); +const memGot = mem(got, {cache}); + +memGot('sindresorhus.com') + .then(() => memGot('sindresorhus.com')) + .then(() => memGot('sindresorhus.com')); + +console.log(cache.stats); +//=> {hits: 2, misses: 1} +``` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/os-locale/node_modules/mimic-fn/index.js b/node_modules/os-locale/node_modules/mimic-fn/index.js new file mode 100644 index 0000000..08e69d3 --- /dev/null +++ b/node_modules/os-locale/node_modules/mimic-fn/index.js @@ -0,0 +1,9 @@ +'use strict'; +module.exports = (to, from) => { + // TODO: use `Reflect.ownKeys()` when targeting Node.js 6 + for (const prop of Object.getOwnPropertyNames(from).concat(Object.getOwnPropertySymbols(from))) { + Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop)); + } + + return to; +}; diff --git a/node_modules/os-locale/node_modules/mimic-fn/license b/node_modules/os-locale/node_modules/mimic-fn/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/os-locale/node_modules/mimic-fn/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/os-locale/node_modules/mimic-fn/package.json b/node_modules/os-locale/node_modules/mimic-fn/package.json new file mode 100644 index 0000000..334d28f --- /dev/null +++ b/node_modules/os-locale/node_modules/mimic-fn/package.json @@ -0,0 +1,72 @@ +{ + "_from": "mimic-fn@^1.0.0", + "_id": "mimic-fn@1.2.0", + "_inBundle": false, + "_integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "_location": "/os-locale/mimic-fn", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "mimic-fn@^1.0.0", + "name": "mimic-fn", + "escapedName": "mimic-fn", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/os-locale/mem" + ], + "_resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "_shasum": "820c86a39334640e99516928bd03fca88057d022", + "_spec": "mimic-fn@^1.0.0", + "_where": "D:\\Solide Webservices\\Github\\com.xiaomi-miio\\node_modules\\os-locale\\node_modules\\mem", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/mimic-fn/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Make a function mimic another one", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/mimic-fn#readme", + "keywords": [ + "function", + "mimic", + "imitate", + "rename", + "copy", + "inherit", + "properties", + "name", + "func", + "fn", + "set", + "infer", + "change" + ], + "license": "MIT", + "name": "mimic-fn", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/mimic-fn.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.2.0" +} diff --git a/node_modules/os-locale/node_modules/mimic-fn/readme.md b/node_modules/os-locale/node_modules/mimic-fn/readme.md new file mode 100644 index 0000000..e575734 --- /dev/null +++ b/node_modules/os-locale/node_modules/mimic-fn/readme.md @@ -0,0 +1,68 @@ +# mimic-fn [![Build Status](https://travis-ci.org/sindresorhus/mimic-fn.svg?branch=master)](https://travis-ci.org/sindresorhus/mimic-fn) + +> Make a function mimic another one + +Useful when you wrap a function in another function and like to preserve the original name and other properties. + + +## Install + +``` +$ npm install mimic-fn +``` + + +## Usage + +```js +const mimicFn = require('mimic-fn'); + +function foo() {} +foo.unicorn = '🦄'; + +function wrapper() { + return foo() {}; +} + +console.log(wrapper.name); +//=> 'wrapper' + +mimicFn(wrapper, foo); + +console.log(wrapper.name); +//=> 'foo' + +console.log(wrapper.unicorn); +//=> '🦄' +``` + + +## API + +It will copy over the properties `name`, `length`, `displayName`, and any custom properties you may have set. + +### mimicFn(to, from) + +It will modify `to` and return it. + +#### to + +Type: `Function` + +Mimicking function. + +#### from + +Type: `Function` + +Function to mimic. + + +## Related + +- [rename-fn](https://github.com/sindresorhus/rename-fn) - Rename a function + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/p-defer/index.js b/node_modules/p-defer/index.js new file mode 100644 index 0000000..eaef75e --- /dev/null +++ b/node_modules/p-defer/index.js @@ -0,0 +1,11 @@ +'use strict'; +module.exports = () => { + const ret = {}; + + ret.promise = new Promise((resolve, reject) => { + ret.resolve = resolve; + ret.reject = reject; + }); + + return ret; +}; diff --git a/node_modules/p-defer/license b/node_modules/p-defer/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/p-defer/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/p-defer/package.json b/node_modules/p-defer/package.json new file mode 100644 index 0000000..cc03a73 --- /dev/null +++ b/node_modules/p-defer/package.json @@ -0,0 +1,73 @@ +{ + "_from": "p-defer@^1.0.0", + "_id": "p-defer@1.0.0", + "_inBundle": false, + "_integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", + "_location": "/p-defer", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "p-defer@^1.0.0", + "name": "p-defer", + "escapedName": "p-defer", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/map-age-cleaner" + ], + "_resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "_shasum": "9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c", + "_spec": "p-defer@^1.0.0", + "_where": "D:\\Solide Webservices\\Github\\com.xiaomi-miio\\node_modules\\map-age-cleaner", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/p-defer/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Create a deferred promise", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/p-defer#readme", + "keywords": [ + "promise", + "defer", + "deferred", + "resolve", + "reject", + "lazy", + "later", + "async", + "await", + "promises", + "bluebird" + ], + "license": "MIT", + "name": "p-defer", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/p-defer.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.0.0", + "xo": { + "esnext": true + } +} diff --git a/node_modules/p-defer/readme.md b/node_modules/p-defer/readme.md new file mode 100644 index 0000000..b94f137 --- /dev/null +++ b/node_modules/p-defer/readme.md @@ -0,0 +1,47 @@ +# p-defer [![Build Status](https://travis-ci.org/sindresorhus/p-defer.svg?branch=master)](https://travis-ci.org/sindresorhus/p-defer) + +> Create a deferred promise + +[**Don't use this unless you know what you're doing!**](https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns#the-deferred-anti-pattern) Prefer the `Promise` constructor. + + +## Install + +``` +$ npm install --save p-defer +``` + + +## Usage + +```js +const pDefer = require('p-defer'); + +function delay(ms) { + const deferred = pDefer(); + setTimeout(deferred.resolve, ms, '🦄'); + return deferred.promise; +} + +delay(100).then(console.log); +//=> '🦄' +``` + +*The above is just an example. Use [`delay`](https://github.com/sindresorhus/delay) if you need to delay a promise.* + + +## API + +### pDefer() + +Returns an `Object` with a `promise` property and functions to `resolve()` and `reject()`. + + +## Related + +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/p-is-promise/index.d.ts b/node_modules/p-is-promise/index.d.ts new file mode 100644 index 0000000..662d9e0 --- /dev/null +++ b/node_modules/p-is-promise/index.d.ts @@ -0,0 +1,23 @@ +declare const pIsPromise: { + /** + Check if `input` is a ES2015 promise. + + @param input - Value to be checked. + + @example + ``` + import isPromise = require('p-is-promise'); + + isPromise(Promise.resolve('🦄')); + //=> true + ``` + */ + (input: unknown): input is Promise; + + // TODO: Remove this for the next major release, refactor the whole definition to: + // declare function pIsPromise(input: unknown): input is Promise; + // export = pIsPromise; + default: typeof pIsPromise; +}; + +export = pIsPromise; diff --git a/node_modules/p-is-promise/index.js b/node_modules/p-is-promise/index.js new file mode 100644 index 0000000..389d38f --- /dev/null +++ b/node_modules/p-is-promise/index.js @@ -0,0 +1,15 @@ +'use strict'; + +const isPromise = input => ( + input instanceof Promise || + ( + input !== null && + typeof input === 'object' && + typeof input.then === 'function' && + typeof input.catch === 'function' + ) +); + +module.exports = isPromise; +// TODO: Remove this for the next major release +module.exports.default = isPromise; diff --git a/node_modules/p-is-promise/license b/node_modules/p-is-promise/license new file mode 100644 index 0000000..e7af2f7 --- /dev/null +++ b/node_modules/p-is-promise/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/p-is-promise/package.json b/node_modules/p-is-promise/package.json new file mode 100644 index 0000000..738646a --- /dev/null +++ b/node_modules/p-is-promise/package.json @@ -0,0 +1,74 @@ +{ + "_from": "p-is-promise@^2.1.0", + "_id": "p-is-promise@2.1.0", + "_inBundle": false, + "_integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", + "_location": "/p-is-promise", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "p-is-promise@^2.1.0", + "name": "p-is-promise", + "escapedName": "p-is-promise", + "rawSpec": "^2.1.0", + "saveSpec": null, + "fetchSpec": "^2.1.0" + }, + "_requiredBy": [ + "/mem" + ], + "_resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", + "_shasum": "918cebaea248a62cf7ffab8e3bca8c5f882fc42e", + "_spec": "p-is-promise@^2.1.0", + "_where": "D:\\Solide Webservices\\Github\\com.xiaomi-miio\\node_modules\\mem", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/p-is-promise/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Check if something is a promise", + "devDependencies": { + "ava": "^1.4.1", + "bluebird": "^3.5.4", + "tsd": "^0.7.2", + "xo": "^0.24.0" + }, + "engines": { + "node": ">=6" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "homepage": "https://github.com/sindresorhus/p-is-promise#readme", + "keywords": [ + "promise", + "is", + "detect", + "check", + "kind", + "type", + "thenable", + "es2015", + "async", + "await", + "promises", + "bluebird" + ], + "license": "MIT", + "name": "p-is-promise", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/p-is-promise.git" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "version": "2.1.0" +} diff --git a/node_modules/p-is-promise/readme.md b/node_modules/p-is-promise/readme.md new file mode 100644 index 0000000..0e0e481 --- /dev/null +++ b/node_modules/p-is-promise/readme.md @@ -0,0 +1,43 @@ +# p-is-promise [![Build Status](https://travis-ci.org/sindresorhus/p-is-promise.svg?branch=master)](https://travis-ci.org/sindresorhus/p-is-promise) + +> Check if something is a promise + +Why not [`is-promise`](https://github.com/then/is-promise)? That module [checks for a thenable](https://github.com/then/is-promise/issues/6), not an ES2015 promise. This one is stricter. + +You most likely don't need this. Just pass your value to `Promise.resolve()` and let it handle it. + +Can be useful if you need to create a fast path for a synchronous operation. + + +## Install + +``` +$ npm install p-is-promise +``` + + +## Usage + +```js +const pIsPromise = require('p-is-promise'); +const Bluebird = require('bluebird'); + +pIsPromise(Promise.resolve('🦄')); +//=> true + +pIsPromise(Bluebird.resolve('🦄')); +//=> true + +pIsPromise('🦄'); +//=> false +``` + + +## Related + +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/package-lock.json b/package-lock.json index 5ffc35f..1fc2cc5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "com.xiaomi-miio", - "version": "2.8.0", + "version": "2.12.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -9,18 +9,18 @@ "resolved": "https://registry.npmjs.org/abstract-things/-/abstract-things-0.9.0.tgz", "integrity": "sha512-2JJU/nfKfdqan+95KZdrBU/xUfFe/V8O5SE54tFx2e1gsL6dgEd2fcHUaVYJ/tkbRVdIdsIYWk4WyfKxC989rQ==", "requires": { - "amounts": "0.5.0", - "appdirectory": "0.1.0", - "color-convert": "1.9.1", - "color-string": "1.5.2", - "color-temperature": "0.2.7", - "debug": "3.1.0", - "deep-equal": "1.0.1", - "dwaal": "0.1.4", - "foibles": "0.2.0", - "is-mergeable-object": "1.1.0", - "mkdirp": "0.5.1", - "tinkerhub-discovery": "0.3.1" + "amounts": "^0.5.0", + "appdirectory": "^0.1.0", + "color-convert": "^1.9.1", + "color-string": "^1.5.2", + "color-temperature": "^0.2.7", + "debug": "^3.1.0", + "deep-equal": "^1.0.1", + "dwaal": "^0.1.4", + "foibles": "^0.2.0", + "is-mergeable-object": "^1.1.0", + "mkdirp": "^0.5.1", + "tinkerhub-discovery": "^0.3.1" } }, "amounts": { @@ -38,7 +38,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "requires": { - "color-convert": "1.9.1" + "color-convert": "^1.9.0" } }, "appdirectory": { @@ -56,9 +56,9 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.1.tgz", "integrity": "sha512-QUU4ofkDoMIVO7hcx1iPTISs88wsO8jA92RQIm4JAwZvFGGAV2hSAA1NX7oVj2Ej2Q6NDTcRDjPTFrMCRZoJ6g==", "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "5.2.0" + "ansi-styles": "^3.2.0", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.2.0" } }, "cliui": { @@ -66,9 +66,9 @@ "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.0.0.tgz", "integrity": "sha512-nY3W5Gu2racvdDk//ELReY+dHjb9PlIcVDFXP72nVIhq2Gy3LuVXYwJoPVudwQnv1shtohpgkdCKT2YaKY0CKw==", "requires": { - "string-width": "2.1.1", - "strip-ansi": "4.0.0", - "wrap-ansi": "2.1.0" + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" } }, "code-point-at": { @@ -81,7 +81,7 @@ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", "requires": { - "color-name": "1.1.3" + "color-name": "^1.1.1" } }, "color-name": { @@ -94,8 +94,8 @@ "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.2.tgz", "integrity": "sha1-JuRYFLw8mny9Z1FkikFDRRSnc6k=", "requires": { - "color-name": "1.1.3", - "simple-swizzle": "0.2.2" + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" } }, "color-temperature": { @@ -113,9 +113,9 @@ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "requires": { - "lru-cache": "4.1.1", - "shebang-command": "1.2.0", - "which": "1.3.0" + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" } }, "debug": { @@ -141,13 +141,13 @@ "resolved": "https://registry.npmjs.org/dwaal/-/dwaal-0.1.4.tgz", "integrity": "sha512-k/r/3bHW4/uqYC0q+yVFh2ZC2sWHVn+/nmGdVOXpj8sPyBCbK/1xJRrUZZ3mbGy080QKkU+Uv4Nz2936zi7Aaw==", "requires": { - "debug": "3.1.0", - "deep-equal": "1.0.1", - "end-of-stream": "1.4.1", - "fs-write-stream-atomic": "1.0.10", - "msgpack-lite": "0.1.26", - "msgpack-sock": "1.1.0", - "unix-socket-leader": "0.1.2" + "debug": "^3.1.0", + "deep-equal": "^1.0.1", + "end-of-stream": "^1.4.0", + "fs-write-stream-atomic": "^1.0.10", + "msgpack-lite": "^0.1.26", + "msgpack-sock": "^1.1.0", + "unix-socket-leader": "^0.1.2" } }, "end-of-stream": { @@ -155,7 +155,7 @@ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", "requires": { - "once": "1.4.0" + "once": "^1.4.0" } }, "escape-string-regexp": { @@ -178,13 +178,13 @@ "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "requires": { - "cross-spawn": "5.1.0", - "get-stream": "3.0.0", - "is-stream": "1.1.0", - "npm-run-path": "2.0.2", - "p-finally": "1.0.0", - "signal-exit": "3.0.2", - "strip-eof": "1.0.0" + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" } }, "find-up": { @@ -192,7 +192,7 @@ "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "requires": { - "locate-path": "2.0.0" + "locate-path": "^2.0.0" } }, "foibles": { @@ -205,10 +205,10 @@ "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", "requires": { - "graceful-fs": "4.1.11", - "iferr": "0.1.5", - "imurmurhash": "0.1.4", - "readable-stream": "2.3.4" + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" } }, "get-caller-file": { @@ -296,7 +296,7 @@ "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "requires": { - "invert-kv": "1.0.0" + "invert-kv": "^1.0.0" } }, "locate-path": { @@ -304,8 +304,8 @@ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "requires": { - "p-locate": "2.0.0", - "path-exists": "3.0.0" + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" } }, "lru-cache": { @@ -313,16 +313,26 @@ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "requires": { + "p-defer": "^1.0.0" } }, "mem": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/mem/-/mem-5.1.1.tgz", + "integrity": "sha512-qvwipnozMohxLXG1pOqoLiZKNkC4r4qqRucSoDwXowsNGDSULiqFTRUF05vcZWnwJSG22qTsynQhxbaMtnX9gw==", "requires": { - "mimic-fn": "1.2.0" + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^2.1.0", + "p-is-promise": "^2.1.0" } }, "miio": { @@ -330,20 +340,20 @@ "resolved": "https://registry.npmjs.org/miio/-/miio-0.15.6.tgz", "integrity": "sha512-Xxj5nefwZN1FRooUxLW0uFv42lP3RTY/91W3RtdMvlIChpcbqvdxpd4O5p3UidSqOuoMcWbqmchOiNFfLXUHGQ==", "requires": { - "abstract-things": "0.9.0", - "appdirectory": "0.1.0", - "chalk": "2.3.1", - "debug": "3.1.0", - "deep-equal": "1.0.1", - "mkdirp": "0.5.1", - "tinkerhub-discovery": "0.3.1", - "yargs": "10.1.2" + "abstract-things": "^0.9.0", + "appdirectory": "^0.1.0", + "chalk": "^2.3.0", + "debug": "^3.1.0", + "deep-equal": "^1.0.1", + "mkdirp": "^0.5.1", + "tinkerhub-discovery": "^0.3.1", + "yargs": "^10.1.1" } }, "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" }, "minimist": { "version": "0.0.8", @@ -368,10 +378,10 @@ "resolved": "https://registry.npmjs.org/msgpack-lite/-/msgpack-lite-0.1.26.tgz", "integrity": "sha1-3TxQsm8FnyXn7e42REGDWOKprYk=", "requires": { - "event-lite": "0.1.1", - "ieee754": "1.1.8", - "int64-buffer": "0.1.10", - "isarray": "1.0.0" + "event-lite": "^0.1.1", + "ieee754": "^1.1.8", + "int64-buffer": "^0.1.9", + "isarray": "^1.0.0" } }, "msgpack-sock": { @@ -379,7 +389,7 @@ "resolved": "https://registry.npmjs.org/msgpack-sock/-/msgpack-sock-1.1.0.tgz", "integrity": "sha1-YCNYe1CqvWirlBnQWAaK3Kf6Hvc=", "requires": { - "msgpack-lite": "0.1.26" + "msgpack-lite": "^0.1.26" } }, "npm-run-path": { @@ -387,7 +397,7 @@ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "requires": { - "path-key": "2.0.1" + "path-key": "^2.0.0" } }, "number-is-nan": { @@ -400,7 +410,7 @@ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "os-locale": { @@ -408,22 +418,47 @@ "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "requires": { - "execa": "0.7.0", - "lcid": "1.0.0", - "mem": "1.1.0" + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + }, + "dependencies": { + "mem": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" + } } }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=" + }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" }, + "p-is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", + "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==" + }, "p-limit": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.2.0.tgz", "integrity": "sha512-Y/OtIaXtUPr4/YpMv1pCL5L5ed0rumAaAeBSj12F+bSlMdys7i8oQF/GUJmfpTS/QoaRrS/k6pma29haJpsMng==", "requires": { - "p-try": "1.0.0" + "p-try": "^1.0.0" } }, "p-locate": { @@ -431,7 +466,7 @@ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "requires": { - "p-limit": "1.2.0" + "p-limit": "^1.1.0" } }, "p-try": { @@ -469,13 +504,13 @@ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.4.tgz", "integrity": "sha512-vuYxeWYM+fde14+rajzqgeohAI7YoJcHE7kXDAc4Nk0EbuKnJfqtY9YtRkLo/tqkuF7MsBQRhPnPeyjYITp3ZQ==", "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, "require-directory": { @@ -503,7 +538,7 @@ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "requires": { - "shebang-regex": "1.0.0" + "shebang-regex": "^1.0.0" } }, "shebang-regex": { @@ -521,7 +556,7 @@ "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", "requires": { - "is-arrayish": "0.3.1" + "is-arrayish": "^0.3.1" } }, "string-width": { @@ -529,8 +564,8 @@ "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" } }, "string_decoder": { @@ -538,7 +573,7 @@ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", "requires": { - "safe-buffer": "5.1.1" + "safe-buffer": "~5.1.0" } }, "strip-ansi": { @@ -546,7 +581,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "requires": { - "ansi-regex": "3.0.0" + "ansi-regex": "^3.0.0" } }, "strip-eof": { @@ -559,7 +594,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.2.0.tgz", "integrity": "sha512-F39vS48la4YvTZUPVeTqsjsFNrvcMwrV3RLZINsmHo+7djCvuUzSIeXOnZ5hmjef4bajL1dNccN+tg5XAliO5Q==", "requires": { - "has-flag": "3.0.0" + "has-flag": "^3.0.0" } }, "tinkerhub-discovery": { @@ -567,12 +602,13 @@ "resolved": "https://registry.npmjs.org/tinkerhub-discovery/-/tinkerhub-discovery-0.3.1.tgz", "integrity": "sha512-SAf6yys8Klxw7BeXa3sSRuA9q2EVfnwGc1wX1NGTsa7wnCE72T7csyAvUpqc/Tu39ed1wIGvxcejxZF5ZwaZbw==", "requires": { - "debug": "3.1.0", - "eventemitter3": "2.0.3" + "debug": "^3.1.0", + "eventemitter3": "^2.0.3" } }, "tinycolor2": { - "version": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz", "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g=" }, "unix-socket-leader": { @@ -580,8 +616,8 @@ "resolved": "https://registry.npmjs.org/unix-socket-leader/-/unix-socket-leader-0.1.2.tgz", "integrity": "sha1-i0zsbT1cbCwwIyFewhDbo4Eilnk=", "requires": { - "end-of-stream": "1.4.1", - "pidlockfile": "1.1.1" + "end-of-stream": "^1.1.0", + "pidlockfile": "^1.1.1" } }, "util-deprecate": { @@ -594,7 +630,7 @@ "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "requires": { - "isexe": "2.0.0" + "isexe": "^2.0.0" } }, "which-module": { @@ -607,8 +643,8 @@ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1" + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" }, "dependencies": { "ansi-regex": { @@ -621,7 +657,7 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "requires": { - "number-is-nan": "1.0.1" + "number-is-nan": "^1.0.0" } }, "string-width": { @@ -629,9 +665,9 @@ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } }, "strip-ansi": { @@ -639,7 +675,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { - "ansi-regex": "2.1.1" + "ansi-regex": "^2.0.0" } } } @@ -664,18 +700,18 @@ "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.1.2.tgz", "integrity": "sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig==", "requires": { - "cliui": "4.0.0", - "decamelize": "1.2.0", - "find-up": "2.1.0", - "get-caller-file": "1.0.2", - "os-locale": "2.1.0", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "2.1.1", - "which-module": "2.0.0", - "y18n": "3.2.1", - "yargs-parser": "8.1.0" + "cliui": "^4.0.0", + "decamelize": "^1.1.1", + "find-up": "^2.1.0", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^8.1.0" } }, "yargs-parser": { @@ -683,7 +719,7 @@ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.1.0.tgz", "integrity": "sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==", "requires": { - "camelcase": "4.1.0" + "camelcase": "^4.1.0" } } } diff --git a/package.json b/package.json index 7bce8c2..d0aa863 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Xiaomi Mi Home", "main": "app.js", "dependencies": { + "mem": "^5.1.1", "miio": "^0.15.6", "tinycolor2": "^1.4.1" },