From 4ae937035e59a09628655f6baed0673d23c77e58 Mon Sep 17 00:00:00 2001 From: Ardalan Amini Date: Fri, 13 Apr 2018 02:40:03 +0430 Subject: [PATCH 1/5] some improvements --- CHANGELOG.md | 19 + lib/array/all/index.ts | 22 + lib/array/all/method.ts | 3 + lib/array/all/test.ts | 11 + lib/array/any/index.ts | 23 + lib/array/any/method.ts | 3 + lib/array/any/test.ts | 11 + lib/array/append/index.ts | 16 +- lib/array/append/method.ts | 9 + lib/array/append/{test.js => test.ts} | 16 +- lib/array/average/index.ts | 40 +- lib/array/average/method.ts | 15 + lib/array/average/test.js | 15 - lib/array/average/test.ts | 15 + lib/array/chunk/index.ts | 12 +- lib/array/chunk/method.ts | 10 + lib/array/chunk/{test.js => test.ts} | 8 +- lib/array/clone/index.ts | 12 +- lib/array/clone/method.ts | 3 + lib/array/clone/{test.js => test.ts} | 8 +- lib/object/invert/index.ts | 8 +- lib/object/invert/test.js | 6 +- lib/object/lowerCaseKeys/index.ts | 8 +- lib/object/lowerCaseKeys/test.js | 6 +- lib/object/map/index.ts | 8 +- lib/object/map/test.js | 6 +- lib/object/mapKeys/index.ts | 8 +- lib/object/mapKeys/test.js | 6 +- lib/object/merge/index.ts | 8 +- lib/object/merge/test.js | 6 +- lib/object/size/index.ts | 8 +- lib/object/size/test.js | 6 +- lib/string/base64/index.ts | 18 + lib/string/base64/test.js | 8 + lib/string/base64Decode/index.ts | 18 + lib/string/base64Decode/test.js | 8 + lib/string/index.ts | 3 + lib/string/map/index.ts | 21 + lib/string/map/method.ts | 6 + lib/string/map/test.js | 8 + lib/string/pluralize/index.ts | 14 +- lib/string/pluralize/method.ts | 165 ++ package-lock.json | 3643 ++++++++++++++++++------- package.json | 27 +- scripts/preprocessor.js | 10 + tsconfig.json | 12 +- tslint.json | 70 + 47 files changed, 3335 insertions(+), 1051 deletions(-) create mode 100644 lib/array/all/index.ts create mode 100644 lib/array/all/method.ts create mode 100644 lib/array/all/test.ts create mode 100644 lib/array/any/index.ts create mode 100644 lib/array/any/method.ts create mode 100644 lib/array/any/test.ts create mode 100644 lib/array/append/method.ts rename lib/array/append/{test.js => test.ts} (50%) create mode 100644 lib/array/average/method.ts delete mode 100644 lib/array/average/test.js create mode 100644 lib/array/average/test.ts create mode 100644 lib/array/chunk/method.ts rename lib/array/chunk/{test.js => test.ts} (51%) create mode 100644 lib/array/clone/method.ts rename lib/array/clone/{test.js => test.ts} (51%) create mode 100644 lib/string/base64/index.ts create mode 100644 lib/string/base64/test.js create mode 100644 lib/string/base64Decode/index.ts create mode 100644 lib/string/base64Decode/test.js create mode 100644 lib/string/map/index.ts create mode 100644 lib/string/map/method.ts create mode 100644 lib/string/map/test.js create mode 100644 lib/string/pluralize/method.ts create mode 100644 scripts/preprocessor.js create mode 100644 tslint.json diff --git a/CHANGELOG.md b/CHANGELOG.md index e256b747..78758782 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [next](https://github.com/ardalanamini/prototyped.js/releases/tag/next) *(2018-__-__)* +**Implemented enhancements:** +- `Array.prototype` + - function `all` added + - function `any` added +- `Object.prototype` + - function `invert` renamed into `$invert` + - function `lowerCaseKeys` renamed into `$lowerCaseKeys` + - function `mapKeys` renamed into `$mapKeys` + - function `merge` renamed into `$merge` + - function `size` renamed into `$size` +- `String.prototype` + - function `pluralize` improved + - function `base64` added + - function `base64Decode` added + - function `map` added +- some general enhancements + + ## [v0.4.0](https://github.com/ardalanamini/prototyped.js/releases/tag/v0.4.0) *(2018-01-28)* **Implemented enhancements:** - more customizable usage diff --git a/lib/array/all/index.ts b/lib/array/all/index.ts new file mode 100644 index 00000000..dd8806ef --- /dev/null +++ b/lib/array/all/index.ts @@ -0,0 +1,22 @@ +import * as method from "./method"; + +export {}; + +declare global { + interface Array { + all(fn?: (value: T, index: number, array: T[]) => boolean): boolean; + } +} + +/** + * Returns `true` if the provided predicate function returns `true` for all elements in a collection, `false` otherwise + * @memberof Array + * @param {function} [fn=Boolean] + * @returns {boolean} + * @example + * [4, 2, 3].all((x) => x > 1); // true + * [1, 2, 3].all(); // true + */ +Array.prototype.all = function(fn) { + return method(this, fn); +}; diff --git a/lib/array/all/method.ts b/lib/array/all/method.ts new file mode 100644 index 00000000..15d071ec --- /dev/null +++ b/lib/array/all/method.ts @@ -0,0 +1,3 @@ +const all = (arr: any[], fn: (value: any, index: number, array: any[]) => boolean = Boolean) => arr.every(fn); + +export = all; diff --git a/lib/array/all/test.ts b/lib/array/all/test.ts new file mode 100644 index 00000000..2d6fd6dc --- /dev/null +++ b/lib/array/all/test.ts @@ -0,0 +1,11 @@ +import "./index"; + +describe("Array.prototype.all", () => { + test("[4, 2, 3].all((x) => x > 1) returns true", () => { + expect([4, 2, 3].all((x) => x > 1)).toBe(true); + }); + + test("[1, 2, 3].all() returns true", () => { + expect([1, 2, 3].all()).toBe(true); + }); +}); diff --git a/lib/array/any/index.ts b/lib/array/any/index.ts new file mode 100644 index 00000000..e7275106 --- /dev/null +++ b/lib/array/any/index.ts @@ -0,0 +1,23 @@ +import * as method from "./method"; + +export { }; + +declare global { + interface Array { + any(fn?: (value: T, index: number, array: T[]) => boolean): boolean; + } +} + +/** + * Returns `true` if the provided predicate function returns `true` for at least one element in a collection, + * `false` otherwise + * @memberof Array + * @param {function} [fn=Boolean] + * @returns {boolean} + * @example + * [0, 1, 2, 0].any((x) => x >= 2); // true + * [0, 0, 1, 0].any(); // true + */ +Array.prototype.any = function(fn) { + return method(this, fn); +}; diff --git a/lib/array/any/method.ts b/lib/array/any/method.ts new file mode 100644 index 00000000..a957f482 --- /dev/null +++ b/lib/array/any/method.ts @@ -0,0 +1,3 @@ +const method = (arr: any[], fn: (value: any, index: number, array: any[]) => boolean = Boolean) => arr.some(fn); + +export = method; diff --git a/lib/array/any/test.ts b/lib/array/any/test.ts new file mode 100644 index 00000000..ad840c74 --- /dev/null +++ b/lib/array/any/test.ts @@ -0,0 +1,11 @@ +import "./index"; + +describe("Array.prototype.any", () => { + test("[0, 1, 2, 0].any((x) => x >= 2) returns true", () => { + expect([0, 1, 2, 0].any((x) => x >= 2)).toBe(true); + }); + + test("[0, 0, 1, 0].any() returns true", () => { + expect([0, 0, 1, 0].any()).toBe(true); + }); +}); diff --git a/lib/array/append/index.ts b/lib/array/append/index.ts index f783e97f..5d7ac264 100644 --- a/lib/array/append/index.ts +++ b/lib/array/append/index.ts @@ -1,8 +1,10 @@ -export { } +import * as method from "./method"; + +export { }; declare global { interface Array { - append(value?: any): void + append(value: T): void; } } @@ -14,10 +16,6 @@ declare global { * var myArray = [1, 2, 3] * myArray.append(0); // myArray => [1, 2, 3, 0] */ -Array.prototype.append = function(value: any): void { - let array = this.concat([value]) - - this.length = 0 - - this.push(...array) -} +Array.prototype.append = function(value) { + return method(this, value); +}; diff --git a/lib/array/append/method.ts b/lib/array/append/method.ts new file mode 100644 index 00000000..10bee0ad --- /dev/null +++ b/lib/array/append/method.ts @@ -0,0 +1,9 @@ +const method = (arr: any[], value: any) => { + const array = arr.concat([value]); + + arr.length = 0; + + arr.push(...array); +}; + +export = method; diff --git a/lib/array/append/test.js b/lib/array/append/test.ts similarity index 50% rename from lib/array/append/test.js rename to lib/array/append/test.ts index 40a90e00..89288d93 100644 --- a/lib/array/append/test.js +++ b/lib/array/append/test.ts @@ -1,11 +1,13 @@ -require('../../../es6/array/append') +import "./index"; describe("Array.prototype.append", () => { test("myArray = [1, 2, 3] & myArray.append(0) results myArray to be [1, 2, 3, 0]", () => { expect((() => { - let myArray = [1, 2, 3] - myArray.append(0) - return myArray - })()).toEqual([1, 2, 3, 0]) - }) -}) + const myArray = [1, 2, 3]; + + myArray.append(0); + + return myArray; + })()).toEqual([1, 2, 3, 0]); + }); +}); diff --git a/lib/array/average/index.ts b/lib/array/average/index.ts index ecdcbb88..1be9270a 100644 --- a/lib/array/average/index.ts +++ b/lib/array/average/index.ts @@ -1,9 +1,11 @@ -export { } +import * as method from "./method"; + +export { }; declare global { interface Array { - average(key?: string): number - avg(key?: string): number + average(key?: string): number; + avg(key?: string): number; } } @@ -14,28 +16,12 @@ declare global { * @returns {number} * @example * [1, 2, 3].average(); // 2 - * [{a: 1}, {a: 2}, {a: 3}].average('a'); // 2 - * [{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].average('a.b'); // 2 + * [{a: 1}, {a: 2}, {a: 3}].average("a"); // 2 + * [{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].average("a.b"); // 2 */ -Array.prototype.average = function(key?: string): number { - let sum = 0 - - if (key) { - let keys = key.split('.') - - this.map((item) => { - keys.map((k) => item = item && item[k] || 0) - - sum += item - }) - - return sum / this.length - } - - this.map((number) => sum += number) - - return sum / this.length -} +Array.prototype.average = function(key) { + return method(this, key); +}; /** * An alias of Array.prototype.average @@ -44,7 +30,7 @@ Array.prototype.average = function(key?: string): number { * @returns {number} * @example * [1, 2, 3].avg(); // 2 - * [{a: 1}, {a: 2}, {a: 3}].avg('a'); // 2 - * [{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].avg('a.b'); // 2 + * [{a: 1}, {a: 2}, {a: 3}].avg("a"); // 2 + * [{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].avg("a.b"); // 2 */ -Array.prototype.avg = Array.prototype.average +Array.prototype.avg = Array.prototype.average; diff --git a/lib/array/average/method.ts b/lib/array/average/method.ts new file mode 100644 index 00000000..fa2589d5 --- /dev/null +++ b/lib/array/average/method.ts @@ -0,0 +1,15 @@ +const method = (arr: any[], key?: string) => { + if (key) { + const keys = key.split("."); + + return arr.map((item) => { + keys.map((k) => item = (item && item[k]) || 0); + + return item; + }).reduce((acc, val) => acc + val, 0) / arr.length; + } + + return arr.reduce((acc, val) => acc + val, 0) / arr.length; +}; + +export = method; diff --git a/lib/array/average/test.js b/lib/array/average/test.js deleted file mode 100644 index eb81debd..00000000 --- a/lib/array/average/test.js +++ /dev/null @@ -1,15 +0,0 @@ -require('../../../es6/array/average') - -describe("Array.prototype.average", () => { - test("[1, 2, 3].average() returns 2", () => { - expect([1, 2, 3].average()).toBe(2) - }) - - test("[{a: 1}, {a: 2}, {a: 3}].average('a') returns 2", () => { - expect([{a: 1}, {a: 2}, {a: 3}].average('a')).toBe(2) - }) - - test("[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].average('a.b') returns 2", () => { - expect([{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].average('a.b')).toBe(2) - }) -}) diff --git a/lib/array/average/test.ts b/lib/array/average/test.ts new file mode 100644 index 00000000..e15c739e --- /dev/null +++ b/lib/array/average/test.ts @@ -0,0 +1,15 @@ +import "./index"; + +describe("Array.prototype.average", () => { + test("[1, 2, 3].average() returns 2", () => { + expect([1, 2, 3].average()).toBe(2); + }); + + test("[{a: 1}, {a: 2}, {a: 3}].average(\"a\") returns 2", () => { + expect([{ a: 1 }, { a: 2 }, { a: 3 }].average("a")).toBe(2); + }); + + test("[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].average(\"a.b\") returns 2", () => { + expect([{ a: { b: 1 } }, { a: { b: 2 } }, { a: { b: 3 } }].average("a.b")).toBe(2); + }); +}); diff --git a/lib/array/chunk/index.ts b/lib/array/chunk/index.ts index 5ff89679..2202e02f 100644 --- a/lib/array/chunk/index.ts +++ b/lib/array/chunk/index.ts @@ -1,8 +1,10 @@ -export { } +import * as method from "./method"; + +export { }; declare global { interface Array { - chunk(size: number): Array> + chunk(size: number): T[][]; } } @@ -14,6 +16,6 @@ declare global { * @example * [1, 2, 3, 4, 5].chunk(2); // [[1,2],[3,4],[5]] */ -Array.prototype.chunk = function(size: number): Array> { - return Array.from({ length: Math.ceil(this.length / size) }, (value: any, index: number) => this.slice(index * size, index * size + size)) -} +Array.prototype.chunk = function(size) { + return method(this, size); +}; diff --git a/lib/array/chunk/method.ts b/lib/array/chunk/method.ts new file mode 100644 index 00000000..60955d3d --- /dev/null +++ b/lib/array/chunk/method.ts @@ -0,0 +1,10 @@ +const method = (arr: any[], size: number): any[][] => { + return Array.from( + { + length: Math.ceil(arr.length / size), + }, + (value: any, index: number) => arr.slice(index * size, index * size + size), + ); +}; + +export = method; diff --git a/lib/array/chunk/test.js b/lib/array/chunk/test.ts similarity index 51% rename from lib/array/chunk/test.js rename to lib/array/chunk/test.ts index 6524341a..bbfaadb0 100644 --- a/lib/array/chunk/test.js +++ b/lib/array/chunk/test.ts @@ -1,7 +1,7 @@ -require('../../../es6/array/chunk') +import "./index"; describe("Array.prototype.chunk", () => { test("[1, 2, 3, 4, 5].chunk(2) returns [[1,2],[3,4],[5]]", () => { - expect([1,2,3,4,5].chunk(2)).toEqual([[1,2],[3,4],[5]]) - }) -}) + expect([1, 2, 3, 4, 5].chunk(2)).toEqual([[1, 2], [3, 4], [5]]); + }); +}); diff --git a/lib/array/clone/index.ts b/lib/array/clone/index.ts index afd33e6c..fe247767 100644 --- a/lib/array/clone/index.ts +++ b/lib/array/clone/index.ts @@ -1,8 +1,10 @@ -export { } +import * as method from "./method"; + +export { }; declare global { interface Array { - clone(): Array + clone(): T[]; } } @@ -13,6 +15,6 @@ declare global { * @example * [1, 2, 3].clone(); // [1, 2, 3] */ -Array.prototype.clone = function(): Array { - return [...this] -} +Array.prototype.clone = function() { + return method(this); +}; diff --git a/lib/array/clone/method.ts b/lib/array/clone/method.ts new file mode 100644 index 00000000..b398316e --- /dev/null +++ b/lib/array/clone/method.ts @@ -0,0 +1,3 @@ +const method = (arr: any[]) => [...arr]; + +export = method; diff --git a/lib/array/clone/test.js b/lib/array/clone/test.ts similarity index 51% rename from lib/array/clone/test.js rename to lib/array/clone/test.ts index ac6ccb6c..fc72adbf 100644 --- a/lib/array/clone/test.js +++ b/lib/array/clone/test.ts @@ -1,7 +1,7 @@ -require('../../../es6/array/clone') +import "./index"; describe("Array.prototype.clone", () => { test("[1, 2, 3].clone() returns [1, 2, 3]", () => { - expect([1, 2, 3].clone()).toEqual([1, 2, 3]) - }) -}) + expect([1, 2, 3].clone()).toEqual([1, 2, 3]); + }); +}); diff --git a/lib/object/invert/index.ts b/lib/object/invert/index.ts index 9b9c0914..33117a0f 100644 --- a/lib/object/invert/index.ts +++ b/lib/object/invert/index.ts @@ -4,7 +4,7 @@ export { } declare global { interface Object { - invert(): object + $invert(): object } } @@ -13,9 +13,9 @@ declare global { * @memberof Object.prototype * @returns {Object} * @example - * { name: 'John', age: 20 }.invert(); // { 20: 'age', John: 'name' } + * { name: 'John', age: 20 }.$invert(); // { 20: 'age', John: 'name' } */ -function invert(this: { [key: string]: any }): object { +function $invert(this: { [key: string]: any }): object { return Object.keys(this).reduce((acc: { [key: string]: any }, key) => { acc[this[key]] = key @@ -23,4 +23,4 @@ function invert(this: { [key: string]: any }): object { }, {}) } -addPrototype('invert', invert) +addPrototype('$invert', $invert) diff --git a/lib/object/invert/test.js b/lib/object/invert/test.js index 6fdc00eb..37b30c37 100644 --- a/lib/object/invert/test.js +++ b/lib/object/invert/test.js @@ -1,8 +1,8 @@ require('../../../es6/object/invert') -describe("Object.prototype.invert", () => { - test("{ name: 'John', age: 20 }.invert() returns { 20: 'age', John: 'name' }", () => { - expect({ name: 'John', age: 20 }.invert()) +describe("Object.prototype.$invert", () => { + test("{ name: 'John', age: 20 }.$invert() returns { 20: 'age', John: 'name' }", () => { + expect({ name: 'John', age: 20 }.$invert()) .toEqual({ 20: 'age', John: 'name' }) }) }) diff --git a/lib/object/lowerCaseKeys/index.ts b/lib/object/lowerCaseKeys/index.ts index 67377fb1..b1e2ec09 100644 --- a/lib/object/lowerCaseKeys/index.ts +++ b/lib/object/lowerCaseKeys/index.ts @@ -4,7 +4,7 @@ export { } declare global { interface Object { - lowerCaseKeys(): object + $lowerCaseKeys(): object } } @@ -14,9 +14,9 @@ declare global { * @returns {Object} * @example * const myObj = { Name: 'Adam', sUrnAME: 'Smith' }; - * const myObjLower = myObj.lowerCaseKeys(); // {name: 'Adam', surname: 'Smith'} + * const myObjLower = myObj.$lowerCaseKeys(); // {name: 'Adam', surname: 'Smith'} */ -function lowerCaseKeys(this: { [key: string]: any }): object { +function $lowerCaseKeys(this: { [key: string]: any }): object { return Object.keys(this).reduce((acc: { [key: string]: any }, key) => { acc[key.toLowerCase()] = this[key] @@ -24,4 +24,4 @@ function lowerCaseKeys(this: { [key: string]: any }): object { }, {}) } -addPrototype('lowerCaseKeys', lowerCaseKeys) +addPrototype('$lowerCaseKeys', $lowerCaseKeys) diff --git a/lib/object/lowerCaseKeys/test.js b/lib/object/lowerCaseKeys/test.js index 3bf0bdeb..efa3e0cf 100644 --- a/lib/object/lowerCaseKeys/test.js +++ b/lib/object/lowerCaseKeys/test.js @@ -1,7 +1,7 @@ require('../../../es6/object/lowerCaseKeys') -describe("Object.prototype.lowerCaseKeys", () => { - test("{ Name: 'Adam', sUrnAME: 'Smith' }.lowerCaseKeys() returns {name: 'Adam', surname: 'Smith'}", () => { - expect({ Name: 'Adam', sUrnAME: 'Smith' }.lowerCaseKeys()).toEqual({name: 'Adam', surname: 'Smith'}) +describe("Object.prototype.$lowerCaseKeys", () => { + test("{ Name: 'Adam', sUrnAME: 'Smith' }.$lowerCaseKeys() returns {name: 'Adam', surname: 'Smith'}", () => { + expect({ Name: 'Adam', sUrnAME: 'Smith' }.$lowerCaseKeys()).toEqual({name: 'Adam', surname: 'Smith'}) }) }) diff --git a/lib/object/map/index.ts b/lib/object/map/index.ts index b99b1681..84168b40 100644 --- a/lib/object/map/index.ts +++ b/lib/object/map/index.ts @@ -4,7 +4,7 @@ export { } declare global { interface Object { - map(fn: (value: any, key: string | number, object: object) => any): object + $map(fn: (value: any, key: string | number, object: object) => any): object } } @@ -18,9 +18,9 @@ declare global { * fred: { user: 'fred', age: 40 }, * pebbles: { user: 'pebbles', age: 1 } * }; - * users.map(u => u.age); // { fred: 40, pebbles: 1 } + * users.$map(u => u.age); // { fred: 40, pebbles: 1 } */ -function map(this: { [key: string]: any }, fn: (value: any, key: string | number, object: object) => any): object { +function $map(this: { [key: string]: any }, fn: (value: any, key: string | number, object: object) => any): object { return Object.keys(this).reduce((acc: { [key: string]: any }, k) => { acc[k] = fn(this[k], k, this) @@ -28,4 +28,4 @@ function map(this: { [key: string]: any }, fn: (value: any, key: string | number }, {}) } -addPrototype('map', map) +addPrototype('$map', $map) diff --git a/lib/object/map/test.js b/lib/object/map/test.js index 35cbeb55..6cb20f87 100644 --- a/lib/object/map/test.js +++ b/lib/object/map/test.js @@ -1,7 +1,7 @@ require('../../../es6/object/map') -describe("Object.prototype.map", () => { - test("{fred: { user: 'fred', age: 40 }, pebbles: { user: 'pebbles', age: 1 }}.map(u => u.age) returns { fred: 40, pebbles: 1 }", () => { - expect({fred: { user: 'fred', age: 40 }, pebbles: { user: 'pebbles', age: 1 }}.map(u => u.age)).toEqual({ fred: 40, pebbles: 1 }) +describe("Object.prototype.$map", () => { + test("{fred: { user: 'fred', age: 40 }, pebbles: { user: 'pebbles', age: 1 }}.$map(u => u.age) returns { fred: 40, pebbles: 1 }", () => { + expect({fred: { user: 'fred', age: 40 }, pebbles: { user: 'pebbles', age: 1 }}.$map(u => u.age)).toEqual({ fred: 40, pebbles: 1 }) }) }) diff --git a/lib/object/mapKeys/index.ts b/lib/object/mapKeys/index.ts index 1282840f..cc7e1b8b 100644 --- a/lib/object/mapKeys/index.ts +++ b/lib/object/mapKeys/index.ts @@ -4,7 +4,7 @@ export { } declare global { interface Object { - mapKeys(fn: (value: any, key: string | number, object: object) => any): object + $mapKeys(fn: (value: any, key: string | number, object: object) => any): object } } @@ -14,9 +14,9 @@ declare global { * @param {function} fn * @returns {Object} * @example - * { a: 1, b: 2 }.mapKeys((val, key) => key + val); // { a1: 1, b2: 2 } + * { a: 1, b: 2 }.$mapKeys((val, key) => key + val); // { a1: 1, b2: 2 } */ -function mapKeys(this: { [key: string]: any }, fn: (value: any, key: string | number, object: object) => any): object { +function $mapKeys(this: { [key: string]: any }, fn: (value: any, key: string | number, object: object) => any): object { return Object.keys(this).reduce((acc: { [key: string]: any }, k) => { acc[fn(this[k], k, this)] = this[k] @@ -24,4 +24,4 @@ function mapKeys(this: { [key: string]: any }, fn: (value: any, key: string | nu }, {}) } -addPrototype('mapKeys', mapKeys) +addPrototype('$mapKeys', $mapKeys) diff --git a/lib/object/mapKeys/test.js b/lib/object/mapKeys/test.js index 304bc7f6..cf130d93 100644 --- a/lib/object/mapKeys/test.js +++ b/lib/object/mapKeys/test.js @@ -1,7 +1,7 @@ require('../../../es6/object/mapKeys') -describe("Object.prototype.mapKeys", () => { - test("{ a: 1, b: 2 }.mapKeys((val, key) => key + val) returns { a1: 1, b2: 2 }", () => { - expect({ a: 1, b: 2 }.mapKeys((val, key) => key + val)).toEqual({ a1: 1, b2: 2 }) +describe("Object.prototype.$mapKeys", () => { + test("{ a: 1, b: 2 }.$mapKeys((val, key) => key + val) returns { a1: 1, b2: 2 }", () => { + expect({ a: 1, b: 2 }.$mapKeys((val, key) => key + val)).toEqual({ a1: 1, b2: 2 }) }) }) diff --git a/lib/object/merge/index.ts b/lib/object/merge/index.ts index 278b47a6..726bd802 100644 --- a/lib/object/merge/index.ts +++ b/lib/object/merge/index.ts @@ -4,7 +4,7 @@ export { } declare global { interface Object { - merge(...objects: Array): object + $merge(...objects: Array): object } } @@ -23,9 +23,9 @@ declare global { * b: [2, 3], * c: 'foo' * }; - * object.merge(other); // { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' } + * object.$merge(other); // { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' } */ -function merge(this: { [key: string]: any }, ...objects: Array): object { +function $merge(this: { [key: string]: any }, ...objects: Array): object { objects = [this, ...objects] return [...objects].reduce( @@ -39,4 +39,4 @@ function merge(this: { [key: string]: any }, ...objects: Array): object ) } -addPrototype('merge', merge) +addPrototype('$merge', $merge) diff --git a/lib/object/merge/test.js b/lib/object/merge/test.js index 3e2f0a8e..84844f2b 100644 --- a/lib/object/merge/test.js +++ b/lib/object/merge/test.js @@ -1,8 +1,8 @@ require('../../../es6/object/merge') -describe("Object.prototype.merge", () => { - test("{a: [{ x: 2 }, { y: 4 }], b: 1}.merge({a: { z: 3 }, b: [2, 3], c: 'foo'}) returns { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' }", () => { - expect({a: [{ x: 2 }, { y: 4 }], b: 1}.merge({a: { z: 3 }, b: [2, 3], c: 'foo'})) +describe("Object.prototype.$merge", () => { + test("{a: [{ x: 2 }, { y: 4 }], b: 1}.$merge({a: { z: 3 }, b: [2, 3], c: 'foo'}) returns { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' }", () => { + expect({a: [{ x: 2 }, { y: 4 }], b: 1}.$merge({a: { z: 3 }, b: [2, 3], c: 'foo'})) .toEqual({ a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' }) }) }) diff --git a/lib/object/size/index.ts b/lib/object/size/index.ts index a0902d7b..967a8a5b 100644 --- a/lib/object/size/index.ts +++ b/lib/object/size/index.ts @@ -4,7 +4,7 @@ export { } declare global { interface Object { - size(): number + $size(): number } } @@ -13,10 +13,10 @@ declare global { * @memberof Object.prototype * @returns {Object} * @example - * { one: 1, two: 2, three: 3 }.size(); // 3 + * { one: 1, two: 2, three: 3 }.$size(); // 3 */ -function size(this: { [key: string]: any }): number { +function $size(this: { [key: string]: any }): number { return Object.keys(this).length } -addPrototype('size', size) +addPrototype('$size', $size) diff --git a/lib/object/size/test.js b/lib/object/size/test.js index a973246f..0b5a7944 100644 --- a/lib/object/size/test.js +++ b/lib/object/size/test.js @@ -1,8 +1,8 @@ require('../../../es6/object/size') -describe("Object.prototype.size", () => { - test("{ one: 1, two: 2, three: 3 }.size() returns 3", () => { - expect({ one: 1, two: 2, three: 3 }.size()) +describe("Object.prototype.$size", () => { + test("{ one: 1, two: 2, three: 3 }.$size() returns 3", () => { + expect({ one: 1, two: 2, three: 3 }.$size()) .toBe(3) }) }) diff --git a/lib/string/base64/index.ts b/lib/string/base64/index.ts new file mode 100644 index 00000000..146f28d5 --- /dev/null +++ b/lib/string/base64/index.ts @@ -0,0 +1,18 @@ +export { } + +declare global { + interface String { + base64(): string + } +} + +/** + * Encodes data with MIME base64 + * @memberof String + * @returns {string} + * @example + * 'prototyped.js'.base64(); // 'cHJvdG90eXBlZC5qcw==' + */ +String.prototype.base64 = function(): string { + return new Buffer(`${this}`).toString('base64') +} diff --git a/lib/string/base64/test.js b/lib/string/base64/test.js new file mode 100644 index 00000000..4ebd94cf --- /dev/null +++ b/lib/string/base64/test.js @@ -0,0 +1,8 @@ +require('../../../es6/string/base64') + +describe("String.prototype.base64", () => { + test("'prototyped.js'.base64() returns 'cHJvdG90eXBlZC5qcw=='", () => { + expect('prototyped.js'.base64()) + .toBe('cHJvdG90eXBlZC5qcw==') + }) +}) diff --git a/lib/string/base64Decode/index.ts b/lib/string/base64Decode/index.ts new file mode 100644 index 00000000..ca3c752e --- /dev/null +++ b/lib/string/base64Decode/index.ts @@ -0,0 +1,18 @@ +export { } + +declare global { + interface String { + base64Decode(): string + } +} + +/** + * Decodes data encoded with MIME base64 + * @memberof String + * @returns {string} + * @example + * 'cHJvdG90eXBlZC5qcw=='.base64Decode(); // 'prototyped.js' + */ +String.prototype.base64Decode = function(): string { + return new Buffer(`${this}`, 'base64').toString() +} diff --git a/lib/string/base64Decode/test.js b/lib/string/base64Decode/test.js new file mode 100644 index 00000000..9a3a13c1 --- /dev/null +++ b/lib/string/base64Decode/test.js @@ -0,0 +1,8 @@ +require('../../../es6/string/base64Decode') + +describe("String.prototype.base64Decode", () => { + test("'cHJvdG90eXBlZC5qcw=='.base64Decode() returns 'prototyped.js'", () => { + expect('cHJvdG90eXBlZC5qcw=='.base64Decode()) + .toBe('prototyped.js') + }) +}) diff --git a/lib/string/index.ts b/lib/string/index.ts index d7466245..6b41a1e1 100644 --- a/lib/string/index.ts +++ b/lib/string/index.ts @@ -1,5 +1,7 @@ /** @namespace String */ +import './base64' +import './base64Decode' import './camelCase' import './capitalize' import './chars' @@ -9,6 +11,7 @@ import './humanize' import './isInstance' import './kebabCase' import './lines' +import './map' import './mask' import './pluralize' import './reverse' diff --git a/lib/string/map/index.ts b/lib/string/map/index.ts new file mode 100644 index 00000000..b1f43a46 --- /dev/null +++ b/lib/string/map/index.ts @@ -0,0 +1,21 @@ +import * as map from "./method"; + +export { }; + +declare global { + interface String { + map(fn: (char: string, index: number, chars: string[]) => string): string; + } +} + +/** + * Just like array.map + * @memberof String + * @param {Function} fn + * @returns {string[]} + * @example + * 'Hello'.map((char) => char == 'o' ? 'O' : char); // 'HellO' + */ +String.prototype.map = function(fn: (char: string, index: number, chars: string[]) => string): string { + return map(this as string, fn); +}; diff --git a/lib/string/map/method.ts b/lib/string/map/method.ts new file mode 100644 index 00000000..ccd20c3a --- /dev/null +++ b/lib/string/map/method.ts @@ -0,0 +1,6 @@ +const map = ( + str: string, + fn: (char: string, index: number, chars: string[]) => string, +): string => str.split("").map(fn).join(""); + +export = map; diff --git a/lib/string/map/test.js b/lib/string/map/test.js new file mode 100644 index 00000000..cc81bbc6 --- /dev/null +++ b/lib/string/map/test.js @@ -0,0 +1,8 @@ +require('../../../es6/string/map') + +describe("String.prototype.map", () => { + test("'Hello'.map((char) => char == 'o' ? 'O' : char) returns 'HellO'", () => { + expect('Hello'.map((char) => char == 'o' ? 'O' : char)) + .toBe('HellO') + }) +}) diff --git a/lib/string/pluralize/index.ts b/lib/string/pluralize/index.ts index 737af2ea..e95d553e 100644 --- a/lib/string/pluralize/index.ts +++ b/lib/string/pluralize/index.ts @@ -1,8 +1,10 @@ -export { } +import * as pluralize from "./method"; + +export { }; declare global { interface String { - pluralize(value: number, plural?: string): String + pluralize(value: number, plural?: string): string; } } @@ -18,8 +20,6 @@ declare global { * 'apple'.pluralize(2); // 'apples' * 'person'.pluralize(2, 'people'); // 'people' */ -String.prototype.pluralize = function(value: number, plural?: string): String { - if (!plural) plural = `${this}s` - - return value === 1 ? this : plural -} +String.prototype.pluralize = function(value: number, plural?: string): string { + return pluralize(this as string, value, plural); +}; diff --git a/lib/string/pluralize/method.ts b/lib/string/pluralize/method.ts new file mode 100644 index 00000000..e3c85ccb --- /dev/null +++ b/lib/string/pluralize/method.ts @@ -0,0 +1,165 @@ +const IRREGULAR_PLURALS: { [word: string]: string } = { + "addendum": "addenda", + "aircraft": "aircraft", + "alga": "algae", + "alumna": "alumnae", + "alumnus": "alumni", + "amoeba": "amoebae", + "analysis": "analyses", + "antenna": "antennae", + "antithesis": "antitheses", + "apex": "apices", + "appendix": "appendices", + "automaton": "automata", + "axis": "axes", + "bacillus": "bacilli", + "bacterium": "bacteria", + "barracks": "barracks", + "basis": "bases", + "beau": "beaux", + "bison": "bison", + "buffalo": "buffalo", + "bureau": "bureaus", + "cactus": "cacti", + "calf": "calves", + "carp": "carp", + "census": "censuses", + "chassis": "chassis", + "cherub": "cherubim", + "child": "children", + "château": "châteaus", + "cod": "cod", + "codex": "codices", + "concerto": "concerti", + "corpus": "corpora", + "crisis": "crises", + "criterion": "criteria", + "curriculum": "curricula", + "datum": "data", + "deer": "deer", + "diagnosis": "diagnoses", + "die": "dice", + "dwarf": "dwarfs", + "echo": "echoes", + "elf": "elves", + "elk": "elk", + "ellipsis": "ellipses", + "embargo": "embargoes", + "emphasis": "emphases", + "erratum": "errata", + "faux pas": "faux pas", + "fez": "fezes", + "firmware": "firmware", + "fish": "fish", + "focus": "foci", + "foot": "feet", + "formula": "formulae", + "fungus": "fungi", + "gallows": "gallows", + "genus": "genera", + "goose": "geese", + "graffito": "graffiti", + "grouse": "grouse", + "half": "halves", + "hero": "heroes", + "hoof": "hooves", + "hovercraft": "hovercraft", + "hypothesis": "hypotheses", + "index": "indices", + "kakapo": "kakapo", + "knife": "knives", + "larva": "larvae", + "leaf": "leaves", + "libretto": "libretti", + "life": "lives", + "loaf": "loaves", + "locus": "loci", + "louse": "lice", + "man": "men", + "matrix": "matrices", + "means": "means", + "medium": "media", + "memorandum": "memoranda", + "millennium": "millennia", + "minutia": "minutiae", + "moose": "moose", + "mouse": "mice", + "nebula": "nebulae", + "nemesis": "nemeses", + "neurosis": "neuroses", + "news": "news", + "nucleus": "nuclei", + "oasis": "oases", + "offspring": "offspring", + "opus": "opera", + "ovum": "ova", + "ox": "oxen", + "paralysis": "paralyses", + "parenthesis": "parentheses", + "person": "people", + "phenomenon": "phenomena", + "phylum": "phyla", + "pike": "pike", + "polyhedron": "polyhedra", + "potato": "potatoes", + "prognosis": "prognoses", + "quiz": "quizzes", + "radius": "radii", + "referendum": "referenda", + "salmon": "salmon", + "scarf": "scarves", + "self": "selves", + "series": "series", + "sheep": "sheep", + "shelf": "shelves", + "shrimp": "shrimp", + "spacecraft": "spacecraft", + "species": "species", + "spectrum": "spectra", + "squid": "squid", + "stimulus": "stimuli", + "stratum": "strata", + "swine": "swine", + "syllabus": "syllabi", + "symposium": "symposia", + "synopsis": "synopses", + "synthesis": "syntheses", + "tableau": "tableaus", + "that": "those", + "thesis": "theses", + "thief": "thieves", + "this": "these", + "tomato": "tomatoes", + "tooth": "teeth", + "trout": "trout", + "tuna": "tuna", + "vertebra": "vertebrae", + "vertex": "vertices", + "veto": "vetoes", + "vita": "vitae", + "vortex": "vortices", + "watercraft": "watercraft", + "wharf": "wharves", + "wife": "wives", + "wolf": "wolves", + "woman": "women", +}; + +const pluralize = (str: string, value: number, plural?: string): string => { + if (value === 1) return str; + + if (!plural) + plural = + IRREGULAR_PLURALS[str] || + `${str.replace(/(?:s|x|z|ch|sh)$/i, "$&e").replace(/([^aeiou])y$/i, "$1ie")}s` + .replace( + /i?e?s$/i, + (m) => (str.slice(-1) === str.slice(-1).toLowerCase()) ? + m.toLowerCase() : + m.toUpperCase(), + ); + + return plural; +}; + +export = pluralize; diff --git a/package-lock.json b/package-lock.json index dd0f78e5..fbb6c2b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,55 +1,70 @@ { "name": "prototyped.js", - "version": "0.3.2", + "version": "0.4.0", "lockfileVersion": 1, "requires": true, "dependencies": { "@babel/code-frame": { - "version": "7.0.0-beta.38", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.38.tgz", - "integrity": "sha512-JNHofQND7Iiuy3f6RXSillN1uBe87DAp+1ktsBfSxfL3xWeGFyJC9jH5zu2zs7eqVGp2qXWvJZFiJIwOYnaCQw==", + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz", + "integrity": "sha512-cuAuTTIQ9RqcFRJ/Y8PvTh+paepNcaGxwQwjIDRWPXmzzyAeCO4KqS9ikMvq0MCbRk6GlYKwfzStrcP3/jSL8g==", "dev": true, "requires": { - "chalk": "2.3.0", + "@babel/highlight": "7.0.0-beta.44" + } + }, + "@babel/highlight": { + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0-beta.44.tgz", + "integrity": "sha512-Il19yJvy7vMFm8AVAh6OZzaFoAd0hbkeMZiX3P5HGD+z7dyI7RzndHB0dg6Urh/VAFfHtpOIzDUSxmY6coyZWQ==", + "dev": true, + "requires": { + "chalk": "2.3.2", "esutils": "2.0.2", "js-tokens": "3.0.2" }, "dependencies": { "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" } }, "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", "dev": true, "requires": { - "ansi-styles": "3.2.0", + "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" + "supports-color": "5.3.0" } }, "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "3.0.0" } } } }, + "@types/jest": { + "version": "22.2.3", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-22.2.3.tgz", + "integrity": "sha512-e74sM9W/4qqWB6D4TWV9FQk0WoHtX1X4FJpbjxucMSVJHtFjbQOH3H6yp+xno4br0AKG0wz/kPtaN599GUOvAg==", + "dev": true + }, "@types/node": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.3.0.tgz", - "integrity": "sha512-wNBfvNjzsJl4tswIZKXCFQY0lss9nKUyJnG6T94X/eqjRgI2jHZ4evdjhQYBSan/vGtF6XVXPApOmNH2rf0KKw==", + "version": "9.6.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.4.tgz", + "integrity": "sha512-Awg4BcUYiZtNKoveGOu654JVPt11V/KIC77iBz8NweyoOAZpz5rUJfPDwwD+ajfTs2HndbTCEB8IuLfX9m/mmw==", "dev": true }, "abab": { @@ -59,9 +74,9 @@ "dev": true }, "acorn": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz", + "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==", "dev": true }, "acorn-globals": { @@ -70,15 +85,7 @@ "integrity": "sha512-KjZwU26uG3u6eZcfGbTULzFcsoz6pegNKtHPksZPOUsiKo5bUmiBPa38FuHZ/Eun+XYh/JCCkS9AS3Lu4McQOQ==", "dev": true, "requires": { - "acorn": "5.3.0" - }, - "dependencies": { - "acorn": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz", - "integrity": "sha512-Yej+zOJ1Dm/IMZzzj78OntP/r3zHEaKcyNoU2lAaxPtrseM6rF0xwqoz5Q5ysAiED9hTjI2hgtvLXitlCN1/Ug==", - "dev": true - } + "acorn": "5.5.3" } }, "acorn-jsx": { @@ -88,6 +95,14 @@ "dev": true, "requires": { "acorn": "3.3.0" + }, + "dependencies": { + "acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "dev": true + } } }, "ajv": { @@ -97,7 +112,7 @@ "dev": true, "requires": { "co": "4.6.0", - "fast-deep-equal": "1.0.0", + "fast-deep-equal": "1.1.0", "fast-json-stable-stringify": "2.0.0", "json-schema-traverse": "0.3.1" } @@ -140,9 +155,9 @@ } }, "ansi-escapes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", - "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", "dev": true }, "ansi-regex": { @@ -158,13 +173,289 @@ "dev": true }, "anymatch": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", - "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", "dev": true, "requires": { - "micromatch": "2.3.11", + "micromatch": "3.1.10", "normalize-path": "2.1.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "1.1.0", + "array-unique": "0.3.2", + "extend-shallow": "2.0.1", + "fill-range": "4.0.0", + "isobject": "3.0.1", + "repeat-element": "1.1.2", + "snapdragon": "0.8.2", + "snapdragon-node": "2.1.1", + "split-string": "3.1.0", + "to-regex": "3.0.2" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "posix-character-classes": "0.1.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "0.3.2", + "define-property": "1.0.0", + "expand-brackets": "2.1.4", + "extend-shallow": "2.0.1", + "fragment-cache": "0.2.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-number": "3.0.0", + "repeat-string": "1.6.1", + "to-regex-range": "2.1.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "braces": "2.3.2", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "extglob": "2.0.4", + "fragment-cache": "0.2.1", + "kind-of": "6.0.2", + "nanomatch": "1.2.9", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + } + } } }, "append-transform": { @@ -177,9 +468,9 @@ } }, "argparse": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", - "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { "sprintf-js": "1.0.3" @@ -200,6 +491,12 @@ "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "dev": true }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, "array-back": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", @@ -239,6 +536,12 @@ "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, "astral-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", @@ -246,10 +549,13 @@ "dev": true }, "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "dev": true, + "requires": { + "lodash": "4.17.5" + } }, "async-limiter": { "version": "1.0.0", @@ -263,6 +569,12 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, + "atob": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.0.tgz", + "integrity": "sha512-SuiKH8vbsOyCALjA/+EINmt/Kdl+TQPrtFgW7XZZcwtryFu9e5kQoX3bjCW6mIvGH1fbeAZZuvwGR5IlBRznGw==", + "dev": true + }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -270,9 +582,9 @@ "dev": true }, "aws4": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==", "dev": true }, "babel-code-frame": { @@ -293,7 +605,7 @@ "dev": true, "requires": { "babel-code-frame": "6.26.0", - "babel-generator": "6.26.0", + "babel-generator": "6.26.1", "babel-helpers": "6.24.1", "babel-messages": "6.23.0", "babel-register": "6.26.0", @@ -305,26 +617,18 @@ "convert-source-map": "1.5.1", "debug": "2.6.9", "json5": "0.5.1", - "lodash": "4.17.4", + "lodash": "4.17.5", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } } }, "babel-generator": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", - "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", + "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", "dev": true, "requires": { "babel-messages": "6.23.0", @@ -332,17 +636,9 @@ "babel-types": "6.26.0", "detect-indent": "4.0.0", "jsesc": "1.3.0", - "lodash": "4.17.4", + "lodash": "4.17.5", "source-map": "0.5.7", "trim-right": "1.0.1" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } } }, "babel-helper-builder-binary-assignment-operator-visitor": { @@ -377,7 +673,7 @@ "babel-helper-function-name": "6.24.1", "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "lodash": "4.17.4" + "lodash": "4.17.5" } }, "babel-helper-explode-assignable-expression": { @@ -442,7 +738,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "lodash": "4.17.4" + "lodash": "4.17.5" } }, "babel-helper-remap-async-to-generator": { @@ -483,13 +779,13 @@ } }, "babel-jest": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-22.1.0.tgz", - "integrity": "sha512-5pKRFTlDr+x1JESNRd5leqvxEJk3dRwVvIXikB6Lr4BWZbBppk1Wp+BLUzxWL8tM+EYGLCWgfqkD35Sft8r8Lw==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-22.4.3.tgz", + "integrity": "sha512-BgSjmtl3mW3i+VeVHEr9d2zFSAT66G++pJcHQiUjd00pkW+voYXFctIm/indcqOWWXw5a1nUpR1XWszD9fJ1qg==", "dev": true, "requires": { - "babel-plugin-istanbul": "4.1.5", - "babel-preset-jest": "22.1.0" + "babel-plugin-istanbul": "4.1.6", + "babel-preset-jest": "22.4.3" } }, "babel-messages": { @@ -511,20 +807,21 @@ } }, "babel-plugin-istanbul": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.5.tgz", - "integrity": "sha1-Z2DN2Xf0EdPhdbsGTyvDJ9mbK24=", + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz", + "integrity": "sha512-PWP9FQ1AhZhS01T/4qLSKoHGY/xvkZdVBGlKM/HuxxS3+sC66HhTNR7+MpbO/so/cz/wY94MeSWJuP1hXIPfwQ==", "dev": true, "requires": { + "babel-plugin-syntax-object-rest-spread": "6.13.0", "find-up": "2.1.0", - "istanbul-lib-instrument": "1.9.1", - "test-exclude": "4.1.1" + "istanbul-lib-instrument": "1.10.1", + "test-exclude": "4.2.1" } }, "babel-plugin-jest-hoist": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-22.1.0.tgz", - "integrity": "sha512-Og5sjbOZc4XUI3njqwYhS6WLTlHQUJ/y5+dOqmst8eHrozYZgT4OMzAaYaxhk75c2fBVYwn7+mNEN97XDO7cOw==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-22.4.3.tgz", + "integrity": "sha512-zhvv4f6OTWy2bYevcJftwGCWXMFe7pqoz41IhMi4xna7xNsX5NygdagsrE0y6kkfuXq8UalwvPwKTyAxME2E/g==", "dev": true }, "babel-plugin-syntax-async-functions": { @@ -590,7 +887,7 @@ "babel-template": "6.26.0", "babel-traverse": "6.26.0", "babel-types": "6.26.0", - "lodash": "4.17.4" + "lodash": "4.17.5" } }, "babel-plugin-transform-es2015-classes": { @@ -859,18 +1156,18 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.11.1", - "invariant": "2.2.2", - "semver": "5.4.1" + "browserslist": "2.11.3", + "invariant": "2.2.4", + "semver": "5.5.0" } }, "babel-preset-jest": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-22.1.0.tgz", - "integrity": "sha512-ps2UYz7IQpP2IgZ41tJjUuUDTxJioprHXD8fi9DoycKDGNqB3nAX/ggy1S3plaQd43ktBvMS1FkkyGNoBujFpg==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-22.4.3.tgz", + "integrity": "sha512-a+M3LTEXTq3gxv0uBN9Qm6ahUl7a8pj923nFbCUdqFUSsf3YrX8Uc+C3MEwji5Af3LiQjSC7w4ooYewlz8HRTA==", "dev": true, "requires": { - "babel-plugin-jest-hoist": "22.1.0", + "babel-plugin-jest-hoist": "22.4.3", "babel-plugin-syntax-object-rest-spread": "6.13.0" } }, @@ -882,9 +1179,9 @@ "requires": { "babel-core": "6.26.0", "babel-runtime": "6.26.0", - "core-js": "2.5.3", + "core-js": "2.5.5", "home-or-tmp": "2.0.0", - "lodash": "4.17.4", + "lodash": "4.17.5", "mkdirp": "0.5.1", "source-map-support": "0.4.18" } @@ -895,7 +1192,7 @@ "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "dev": true, "requires": { - "core-js": "2.5.3", + "core-js": "2.5.5", "regenerator-runtime": "0.11.1" } }, @@ -909,7 +1206,7 @@ "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", - "lodash": "4.17.4" + "lodash": "4.17.5" } }, "babel-traverse": { @@ -925,8 +1222,8 @@ "babylon": "6.18.0", "debug": "2.6.9", "globals": "9.18.0", - "invariant": "2.2.2", - "lodash": "4.17.4" + "invariant": "2.2.4", + "lodash": "4.17.5" } }, "babel-types": { @@ -937,7 +1234,7 @@ "requires": { "babel-runtime": "6.26.0", "esutils": "2.0.2", - "lodash": "4.17.4", + "lodash": "4.17.5", "to-fast-properties": "1.0.3" } }, @@ -953,6 +1250,73 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "1.0.1", + "class-utils": "0.3.6", + "component-emitter": "1.2.1", + "define-property": "1.0.0", + "isobject": "3.0.1", + "mixin-deep": "1.3.1", + "pascalcase": "0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, "bcrypt-pbkdf": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", @@ -975,13 +1339,13 @@ "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", "dev": true, "requires": { - "hoek": "4.2.0" + "hoek": "4.2.1" } }, "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { "balanced-match": "1.0.0", @@ -1015,13 +1379,13 @@ } }, "browserslist": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.11.1.tgz", - "integrity": "sha512-Gp4oJOQOby5TpOJJuUtCrGE0KSJOUYVa/I+/3eD/TRWEK8jqZuJPAK1t+VuG6jp0keudrqtxlH4MbYbmylun9g==", + "version": "2.11.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.11.3.tgz", + "integrity": "sha512-yWu5cXT7Av6mVwzWc8lMsJMHWn4xyjSuGYi4IozbVTLUOEYPSagUB8kiMDUHA1fS3zjr8nkxkn9jdvug4BBRmA==", "dev": true, "requires": { - "caniuse-lite": "1.0.30000791", - "electron-to-chromium": "1.3.30" + "caniuse-lite": "1.0.30000828", + "electron-to-chromium": "1.3.42" } }, "bser": { @@ -1039,6 +1403,31 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "1.0.0", + "component-emitter": "1.2.1", + "get-value": "2.0.6", + "has-value": "1.0.0", + "isobject": "3.0.1", + "set-value": "2.0.0", + "to-object-path": "0.3.0", + "union-value": "1.0.0", + "unset-value": "1.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, "cache-point": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/cache-point/-/cache-point-0.4.1.tgz", @@ -1064,9 +1453,9 @@ "optional": true }, "caniuse-lite": { - "version": "1.0.30000791", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000791.tgz", - "integrity": "sha1-jjV0Xv1IOj4ju301CZAybSMZ/BY=", + "version": "1.0.30000828", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000828.tgz", + "integrity": "sha512-v+ySC6Ih8N8CyGZYd4svPipuFIqskKsTOi18chFM0qtu1G8mGuSYajb+h49XDWgmzX8MRDOp1Agw6KQaPUdIhg==", "dev": true }, "caseless": { @@ -1109,11 +1498,40 @@ } }, "ci-info": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.1.2.tgz", - "integrity": "sha512-uTGIPNx/nSpBdsF6xnseRXLLtfr9VLqkz8ZqHXr3Y7b6SftyRxBGjwMtJj1OhNbmlc1wZzLNAlAcvyIiE8a6ZA==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.1.3.tgz", + "integrity": "sha512-SK/846h/Rcy8q9Z9CAwGBLfCJ6EkjJWdpelWDufQpqVDYq2Wnnv8zlSO6AMQap02jvhVruKKpEtQOufo3pFhLg==", "dev": true }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "3.1.0", + "define-property": "0.2.5", + "isobject": "3.0.1", + "static-extend": "0.1.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, "cliui": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", @@ -1157,6 +1575,16 @@ "stream-via": "1.0.4" } }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "1.0.0", + "object-visit": "1.0.1" + } + }, "color-convert": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", @@ -1173,9 +1601,9 @@ "dev": true }, "combined-stream": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", "dev": true, "requires": { "delayed-stream": "1.0.0" @@ -1201,7 +1629,7 @@ "ansi-escape-sequences": "3.0.0", "array-back": "1.0.4", "command-line-args": "4.0.7", - "command-line-usage": "4.0.2", + "command-line-usage": "4.1.0", "typical": "2.6.1" }, "dependencies": { @@ -1217,14 +1645,14 @@ } }, "command-line-usage": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-4.0.2.tgz", - "integrity": "sha512-PpgwSX9SSZZDSTMXmVttJ9w8szzBgMma0bsVpiRfdXljLOBSmJvvxNTAP7twHIsnd6i6jEbcX/JpmAMC+FCbSQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-4.1.0.tgz", + "integrity": "sha512-MxS8Ad995KpdAC0Jopo/ovGIroV/m0KHwzKfXxKag6FHOkGsH8/lv5yjgablcRxCJJC0oJeUMuO/gmaq+Wq46g==", "dev": true, "requires": { "ansi-escape-sequences": "4.0.0", "array-back": "2.0.0", - "table-layout": "0.4.2", + "table-layout": "0.4.3", "typical": "2.6.1" }, "dependencies": { @@ -1240,9 +1668,9 @@ } }, "commander": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", - "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, "common-sequence": { @@ -1251,6 +1679,18 @@ "integrity": "sha1-MOB/P49vf5s97oVPILLTnu4Ibeg=", "dev": true }, + "compare-versions": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.1.0.tgz", + "integrity": "sha512-4hAxDSBypT/yp2ySFD346So6Ragw5xmBn/e/agIGl3bZr6DLUqnoRZPusxKrXdYRZpgexO9daejmIenlq/wrIQ==", + "dev": true + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1274,22 +1714,22 @@ } } }, - "content-type-parser": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.2.tgz", - "integrity": "sha512-lM4l4CnMEwOLHAHr/P6MEZwZFPJFtAAKgL6pogbXmVZggIqXhdB6RbBtPOTsw2FcXwYhehRGERJmRrjOiIB8pQ==", - "dev": true - }, "convert-source-map": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=", "dev": true }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, "core-js": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.3.tgz", - "integrity": "sha1-isw4NFgk8W2DZbfJtCWRaOjtYD4=", + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz", + "integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs=", "dev": true }, "core-util-is": { @@ -1304,7 +1744,7 @@ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true, "requires": { - "lru-cache": "4.1.1", + "lru-cache": "4.1.2", "shebang-command": "1.2.0", "which": "1.3.0" } @@ -1324,7 +1764,7 @@ "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", "dev": true, "requires": { - "hoek": "4.2.0" + "hoek": "4.2.1" } } } @@ -1353,6 +1793,17 @@ "assert-plus": "1.0.0" } }, + "data-urls": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.0.0.tgz", + "integrity": "sha512-ai40PPQR0Fn1lD2PPie79CibnlMN2AYiDhwFX/rZHVsxbs5kNJSjegqXIprhouGXlRdEnfybva7kqRGnB6mypA==", + "dev": true, + "requires": { + "abab": "1.0.4", + "whatwg-mimetype": "2.1.0", + "whatwg-url": "6.4.0" + } + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -1368,6 +1819,12 @@ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", "dev": true }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, "deep-extend": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.0.tgz", @@ -1399,19 +1856,72 @@ "object-keys": "1.0.11" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, - "detect-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", - "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", "dev": true, "requires": { - "repeating": "2.0.1" + "is-descriptor": "1.0.2", + "isobject": "3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true, + "requires": { + "repeating": "2.0.1" } }, "detect-newline": { @@ -1421,23 +1931,23 @@ "dev": true }, "diff": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz", - "integrity": "sha512-QpVuMTEoJMF7cKzi6bvWhRulU1fZqZnvyVQgNhPaxxuTYwyjn/j1v9falseQ/uXWwPnO56RBfwtg4h/EQXmucA==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true }, "dmd": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/dmd/-/dmd-3.0.9.tgz", - "integrity": "sha512-DtNRRDYQU43ilgykkgFY4qA4rc18EGhg64G8XC+f/Li8EOWjHTW9QTbKqb/sbyFUi1+gW6IOGUq+54/crRfmqg==", + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/dmd/-/dmd-3.0.12.tgz", + "integrity": "sha512-79w644JdsB2TthYpVl2bDurX7i9Abaegg2E7X46Ajc135aASTMXxrHzJ9mOa5X5nbmnXwlBYiF68K+1baX+BzQ==", "dev": true, "requires": { "array-back": "2.0.0", "cache-point": "0.4.1", "common-sequence": "1.0.2", - "file-set": "1.1.1", + "file-set": "2.0.0", "handlebars": "4.0.11", - "marked": "0.3.12", + "marked": "0.3.19", "object-get": "2.1.0", "reduce-flatten": "1.0.1", "reduce-unique": "1.0.0", @@ -1477,20 +1987,11 @@ "jsbn": "0.1.1" } }, - "electron-releases": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/electron-releases/-/electron-releases-2.1.0.tgz", - "integrity": "sha512-cyKFD1bTE/UgULXfaueIN1k5EPFzs+FRc/rvCY5tIynefAPqopQEgjr0EzY+U3Dqrk/G4m9tXSPuZ77v6dL/Rw==", - "dev": true - }, "electron-to-chromium": { - "version": "1.3.30", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.30.tgz", - "integrity": "sha512-zx1Prv7kYLfc4OA60FhxGbSo4qrEjgSzpo1/37i7l9ltXPYOoQBtjQxY9KmsgfHnBxHlBGXwLlsbt/gub1w5lw==", - "dev": true, - "requires": { - "electron-releases": "2.1.0" - } + "version": "1.3.42", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.42.tgz", + "integrity": "sha1-lcM78B0MxAVVauyJn+Yf1NduoPk=", + "dev": true }, "error-ex": { "version": "1.3.1", @@ -1502,9 +2003,9 @@ } }, "es-abstract": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.10.0.tgz", - "integrity": "sha512-/uh/DhdqIOSkAWifU+8nG78vlQxdLckUdI/sPgy0VhuXi2qJ7T8czBmqIYtLQVpCIFYafChnsRsB5pyb1JdmCQ==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.11.0.tgz", + "integrity": "sha512-ZnQrE/lXTTQ39ulXZ+J1DTFazV9qBy61x2bY071B+qGco8Z8q1QddsLdt/EF8Ai9hcWH72dWS0kFqXLxOxqslA==", "dev": true, "requires": { "es-to-primitive": "1.1.1", @@ -1532,16 +2033,16 @@ "dev": true }, "escodegen": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz", - "integrity": "sha512-v0MYvNQ32bzwoG2OSFzWAkuahDQHK92JBN0pTAALJ4RIxEZe766QJPDR8Hqy7XNUy5K3fnVL76OqYAdc4TZEIw==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.1.tgz", + "integrity": "sha512-6hTjO1NAWkHnDk3OqQ4YrCuwwmGHL9S3nPlzBOUG/R44rda3wLNrfvQ5fkSGjyhHFKM7ALPKcKGrwvCLe0lC7Q==", "dev": true, "requires": { "esprima": "3.1.3", "estraverse": "4.2.0", "esutils": "2.0.2", "optionator": "0.8.2", - "source-map": "0.5.7" + "source-map": "0.6.1" }, "dependencies": { "esprima": { @@ -1551,9 +2052,9 @@ "dev": true }, "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, "optional": true } @@ -1567,6 +2068,14 @@ "requires": { "acorn": "3.3.0", "acorn-jsx": "3.0.1" + }, + "dependencies": { + "acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "dev": true + } } }, "esprima": { @@ -1636,23 +2145,23 @@ } }, "expect": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-22.1.0.tgz", - "integrity": "sha512-8K+8TjNnZq73KYtqNWKWTbYbN8z4loeL+Pn2bqpmtTdBtLNXJtpz9vkUcQlFsgKMDRA3VM8GXRA6qbV/oBF7Bw==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/expect/-/expect-22.4.3.tgz", + "integrity": "sha512-XcNXEPehqn8b/jm8FYotdX0YrXn36qp4HWlrVT4ktwQas1l1LPxiVWncYnnL2eyMtKAmVIaG0XAp0QlrqJaxaA==", "dev": true, "requires": { - "ansi-styles": "3.2.0", - "jest-diff": "22.1.0", - "jest-get-type": "22.1.0", - "jest-matcher-utils": "22.1.0", - "jest-message-util": "22.1.0", - "jest-regex-util": "22.1.0" + "ansi-styles": "3.2.1", + "jest-diff": "22.4.3", + "jest-get-type": "22.4.3", + "jest-matcher-utils": "22.4.3", + "jest-message-util": "22.4.3", + "jest-regex-util": "22.4.3" }, "dependencies": { "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" @@ -1666,6 +2175,27 @@ "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", "dev": true }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "1.0.0", + "is-extendable": "1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "2.0.4" + } + } + } + }, "extglob": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", @@ -1682,9 +2212,9 @@ "dev": true }, "fast-deep-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", - "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, "fast-json-stable-stringify": { @@ -1709,24 +2239,13 @@ } }, "file-set": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/file-set/-/file-set-1.1.1.tgz", - "integrity": "sha1-0+xwwIDsjxjyBLod4QZ4DJBWkms=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/file-set/-/file-set-2.0.0.tgz", + "integrity": "sha512-cCWXfw+nrYoIoUVmEF7Xsw91lGWuObtSnTEZ7AmdvZou1A/6Xx237HfxdQyC/ayKRvQSMbNOBwg62OjN5JxbXw==", "dev": true, "requires": { - "array-back": "1.0.4", + "array-back": "2.0.0", "glob": "7.1.2" - }, - "dependencies": { - "array-back": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz", - "integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=", - "dev": true, - "requires": { - "typical": "2.6.1" - } - } } }, "filename-regex": { @@ -1816,14 +2335,23 @@ "dev": true }, "form-data": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", - "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", "dev": true, "requires": { "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.17" + "combined-stream": "1.0.6", + "mime-types": "2.1.18" + } + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "0.2.2" } }, "fs-extra": { @@ -1862,7 +2390,7 @@ "dev": true, "optional": true, "requires": { - "nan": "2.8.0", + "nan": "2.10.0", "node-pre-gyp": "0.6.39" }, "dependencies": { @@ -2777,6 +3305,12 @@ "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -2849,6 +3383,21 @@ "uglify-js": "2.8.29" }, "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": "1.0.1" + } + }, "uglify-js": { "version": "2.8.29", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", @@ -2869,6 +3418,19 @@ "optional": true } } + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "optional": true, + "requires": { + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", + "window-size": "0.1.0" + } } } }, @@ -2907,11 +3469,71 @@ } }, "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "2.0.6", + "has-values": "1.0.0", + "isobject": "3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, "hawk": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", @@ -2920,14 +3542,14 @@ "requires": { "boom": "4.3.1", "cryptiles": "3.1.2", - "hoek": "4.2.0", + "hoek": "4.2.1", "sntp": "2.1.0" } }, "hoek": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", - "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", + "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==", "dev": true }, "home-or-tmp": { @@ -2941,9 +3563,9 @@ } }, "hosted-git-info": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.6.0.tgz", + "integrity": "sha512-lIbgIIQA3lz5XaB6vxakj6sDHADJiZadYEJB+FgA+C4nubM1NwcuvUr9EJPmnH1skZqpqUzWborWo8EIUi0Sdw==", "dev": true }, "html-encoding-sniffer": { @@ -2963,7 +3585,7 @@ "requires": { "assert-plus": "1.0.0", "jsprim": "1.4.1", - "sshpk": "1.13.1" + "sshpk": "1.14.1" } }, "iconv-lite": { @@ -3005,9 +3627,9 @@ "dev": true }, "invariant": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", - "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", "dev": true, "requires": { "loose-envify": "1.3.1" @@ -3019,6 +3641,15 @@ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -3052,7 +3683,16 @@ "integrity": "sha512-c7TnwxLePuqIlxHgr7xtxzycJPegNHFuIrBkwbf8hc58//+Op1CqFkyS+xnIMkwn9UsJIwc174BIjkyBmSpjKg==", "dev": true, "requires": { - "ci-info": "1.1.2" + "ci-info": "1.1.3" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" } }, "is-date-object": { @@ -3061,6 +3701,25 @@ "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", "dev": true }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, "is-dotfile": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", @@ -3127,6 +3786,40 @@ "kind-of": "3.2.2" } }, + "is-odd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-2.0.0.tgz", + "integrity": "sha512-OTiixgpZAT1M4NHgS5IguFp/Vz2VI3U7Goh4/HA1adtwyLtSBrxYlcSYkhpAE07s4fKEcjrFxyvtQBND4vFQyQ==", + "dev": true, + "requires": { + "is-number": "4.0.0" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true + } + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, "is-posix-bracket": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", @@ -3172,6 +3865,12 @@ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", "dev": true }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -3200,72 +3899,86 @@ "dev": true }, "istanbul-api": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.2.1.tgz", - "integrity": "sha512-oFCwXvd65amgaPCzqrR+a2XjanS1MvpXN6l/MlMUTv6uiA1NOgGX+I0uyq8Lg3GDxsxPsaP1049krz3hIJ5+KA==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.3.1.tgz", + "integrity": "sha512-duj6AlLcsWNwUpfyfHt0nWIeRiZpuShnP40YTxOGQgtaN8fd6JYSxsvxUphTDy8V5MfDXo4s/xVCIIvVCO808g==", "dev": true, "requires": { "async": "2.6.0", + "compare-versions": "3.1.0", "fileset": "2.0.3", - "istanbul-lib-coverage": "1.1.1", - "istanbul-lib-hook": "1.1.0", - "istanbul-lib-instrument": "1.9.1", - "istanbul-lib-report": "1.1.2", - "istanbul-lib-source-maps": "1.2.2", - "istanbul-reports": "1.1.3", - "js-yaml": "3.10.0", + "istanbul-lib-coverage": "1.2.0", + "istanbul-lib-hook": "1.2.0", + "istanbul-lib-instrument": "1.10.1", + "istanbul-lib-report": "1.1.4", + "istanbul-lib-source-maps": "1.2.4", + "istanbul-reports": "1.3.0", + "js-yaml": "3.11.0", "mkdirp": "0.5.1", "once": "1.4.0" }, "dependencies": { - "async": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", - "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "istanbul-lib-source-maps": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.4.tgz", + "integrity": "sha512-UzuK0g1wyQijiaYQxj/CdNycFhAd2TLtO2obKQMTZrZ1jzEMRY3rvpASEKkaxbRR6brvdovfA03znPa/pXcejg==", "dev": true, "requires": { - "lodash": "4.17.4" + "debug": "3.1.0", + "istanbul-lib-coverage": "1.2.0", + "mkdirp": "0.5.1", + "rimraf": "2.6.2", + "source-map": "0.5.7" } } } }, "istanbul-lib-coverage": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz", - "integrity": "sha512-0+1vDkmzxqJIn5rcoEqapSB4DmPxE31EtI2dF2aCkV5esN9EWHxZ0dwgDClivMXJqE7zaYQxq30hj5L0nlTN5Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.0.tgz", + "integrity": "sha512-GvgM/uXRwm+gLlvkWHTjDAvwynZkL9ns15calTrmhGgowlwJBbWMYzWbKqE2DT6JDP1AFXKa+Zi0EkqNCUqY0A==", "dev": true }, "istanbul-lib-hook": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.1.0.tgz", - "integrity": "sha512-U3qEgwVDUerZ0bt8cfl3dSP3S6opBoOtk3ROO5f2EfBr/SRiD9FQqzwaZBqFORu8W7O0EXpai+k7kxHK13beRg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.2.0.tgz", + "integrity": "sha512-p3En6/oGkFQV55Up8ZPC2oLxvgSxD8CzA0yBrhRZSh3pfv3OFj9aSGVC0yoerAi/O4u7jUVnOGVX1eVFM+0tmQ==", "dev": true, "requires": { "append-transform": "0.4.0" } }, "istanbul-lib-instrument": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz", - "integrity": "sha512-RQmXeQ7sphar7k7O1wTNzVczF9igKpaeGQAG9qR2L+BS4DCJNTI9nytRmIVYevwO0bbq+2CXvJmYDuz0gMrywA==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.10.1.tgz", + "integrity": "sha512-1dYuzkOCbuR5GRJqySuZdsmsNKPL3PTuyPevQfoCXJePT9C8y1ga75neU+Tuy9+yS3G/dgx8wgOmp2KLpgdoeQ==", "dev": true, "requires": { - "babel-generator": "6.26.0", + "babel-generator": "6.26.1", "babel-template": "6.26.0", "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", - "istanbul-lib-coverage": "1.1.1", - "semver": "5.4.1" + "istanbul-lib-coverage": "1.2.0", + "semver": "5.5.0" } }, "istanbul-lib-report": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.2.tgz", - "integrity": "sha512-UTv4VGx+HZivJQwAo1wnRwe1KTvFpfi/NYwN7DcsrdzMXwpRT/Yb6r4SBPoHWj4VuQPakR32g4PUUeyKkdDkBA==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.4.tgz", + "integrity": "sha512-Azqvq5tT0U09nrncK3q82e/Zjkxa4tkFZv7E6VcqP0QCPn6oNljDPfrZEC/umNXds2t7b8sRJfs6Kmpzt8m2kA==", "dev": true, "requires": { - "istanbul-lib-coverage": "1.1.1", + "istanbul-lib-coverage": "1.2.0", "mkdirp": "0.5.1", "path-parse": "1.0.5", "supports-color": "3.2.3" @@ -3289,13 +4002,13 @@ } }, "istanbul-lib-source-maps": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.2.tgz", - "integrity": "sha512-8BfdqSfEdtip7/wo1RnrvLpHVEd8zMZEDmOFEnpC6dg0vXflHt9nvoAyQUzig2uMSXfF2OBEYBV3CVjIL9JvaQ==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.3.tgz", + "integrity": "sha512-fDa0hwU/5sDXwAklXgAoCJCOsFsBplVQ6WBldz5UwaqOzmDhUK4nfuR7/G//G2lERlblUNJB8P6e8cXq3a7MlA==", "dev": true, "requires": { "debug": "3.1.0", - "istanbul-lib-coverage": "1.1.1", + "istanbul-lib-coverage": "1.2.0", "mkdirp": "0.5.1", "rimraf": "2.6.2", "source-map": "0.5.7" @@ -3309,31 +4022,26 @@ "requires": { "ms": "2.0.0" } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true } } }, "istanbul-reports": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.3.tgz", - "integrity": "sha512-ZEelkHh8hrZNI5xDaKwPMFwDsUf5wIEI2bXAFGp1e6deR2mnEKBPhLJEgr4ZBt8Gi6Mj38E/C8kcy9XLggVO2Q==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.3.0.tgz", + "integrity": "sha512-y2Z2IMqE1gefWUaVjrBm0mSKvUkaBy9Vqz8iwr/r40Y9hBbIteH5wqHG/9DLTfJ9xUnUT2j7A3+VVJ6EaYBllA==", "dev": true, "requires": { "handlebars": "4.0.11" } }, "jest": { - "version": "22.1.4", - "resolved": "https://registry.npmjs.org/jest/-/jest-22.1.4.tgz", - "integrity": "sha512-cIPkn+OFGabazPesbhnYkadPftoO2Fo3w84QjeIP+A8eZ5qj7Zs4PuTemAW8StNMxySJr0KPk/LhYG2GUHLexQ==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest/-/jest-22.4.3.tgz", + "integrity": "sha512-FFCdU/pXOEASfHxFDOWUysI/+FFoqiXJADEIXgDKuZyqSmBD3tZ4BEGH7+M79v7czj7bbkhwtd2LaEDcJiM/GQ==", "dev": true, "requires": { - "jest-cli": "22.1.4" + "import-local": "1.0.0", + "jest-cli": "22.4.3" }, "dependencies": { "ansi-regex": { @@ -3343,66 +4051,56 @@ "dev": true }, "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" } }, "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", "dev": true, "requires": { - "ansi-styles": "3.2.0", + "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "cliui": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.0.0.tgz", - "integrity": "sha512-nY3W5Gu2racvdDk//ELReY+dHjb9PlIcVDFXP72nVIhq2Gy3LuVXYwJoPVudwQnv1shtohpgkdCKT2YaKY0CKw==", - "dev": true, - "requires": { - "string-width": "2.1.1", - "strip-ansi": "4.0.0", - "wrap-ansi": "2.1.0" + "supports-color": "5.3.0" } }, "jest-cli": { - "version": "22.1.4", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-22.1.4.tgz", - "integrity": "sha512-p7yOu0Q5uuXb3Q93qEg3LE6eNGgAGueakifxXNEqQx4b0lOl2YlC9t6BLQWNOJ+z42VWK/BIdFjf6lxKcTkjFA==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-22.4.3.tgz", + "integrity": "sha512-IiHybF0DJNqZPsbjn4Cy4vcqcmImpoFwNFnkehzVw8lTUSl4axZh5DHewu5bdpZF2Y5gUqFKYzH0FH4Qx2k+UA==", "dev": true, "requires": { - "ansi-escapes": "3.0.0", - "chalk": "2.3.0", + "ansi-escapes": "3.1.0", + "chalk": "2.3.2", "exit": "0.1.2", "glob": "7.1.2", "graceful-fs": "4.1.11", "import-local": "1.0.0", "is-ci": "1.1.0", - "istanbul-api": "1.2.1", - "istanbul-lib-coverage": "1.1.1", - "istanbul-lib-instrument": "1.9.1", - "istanbul-lib-source-maps": "1.2.2", - "jest-changed-files": "22.1.4", - "jest-config": "22.1.4", - "jest-environment-jsdom": "22.1.4", - "jest-get-type": "22.1.0", - "jest-haste-map": "22.1.0", - "jest-message-util": "22.1.0", - "jest-regex-util": "22.1.0", - "jest-resolve-dependencies": "22.1.0", - "jest-runner": "22.1.4", - "jest-runtime": "22.1.4", - "jest-snapshot": "22.1.2", - "jest-util": "22.1.4", - "jest-worker": "22.1.0", + "istanbul-api": "1.3.1", + "istanbul-lib-coverage": "1.2.0", + "istanbul-lib-instrument": "1.10.1", + "istanbul-lib-source-maps": "1.2.3", + "jest-changed-files": "22.4.3", + "jest-config": "22.4.3", + "jest-environment-jsdom": "22.4.3", + "jest-get-type": "22.4.3", + "jest-haste-map": "22.4.3", + "jest-message-util": "22.4.3", + "jest-regex-util": "22.4.3", + "jest-resolve-dependencies": "22.4.3", + "jest-runner": "22.4.3", + "jest-runtime": "22.4.3", + "jest-snapshot": "22.4.3", + "jest-util": "22.4.3", + "jest-validate": "22.4.3", + "jest-worker": "22.4.3", "micromatch": "2.3.11", "node-notifier": "5.2.1", "realpath-native": "1.0.0", @@ -3424,225 +4122,206 @@ } }, "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - }, - "yargs": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.1.2.tgz", - "integrity": "sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", "dev": true, "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" + "has-flag": "3.0.0" } } } }, "jest-changed-files": { - "version": "22.1.4", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-22.1.4.tgz", - "integrity": "sha512-EpqJhwt+N/wEHRT+5KrjagVrunduOfMgAb7fjjHkXHFCPRZoVZwl896S7krx7txf5hrMNUkpECnOnO2wBgzJCw==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-22.4.3.tgz", + "integrity": "sha512-83Dh0w1aSkUNFhy5d2dvqWxi/y6weDwVVLU6vmK0cV9VpRxPzhTeGimbsbRDSnEoszhF937M4sDLLeS7Cu/Tmw==", "dev": true, "requires": { "throat": "4.1.0" } }, "jest-config": { - "version": "22.1.4", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-22.1.4.tgz", - "integrity": "sha512-ZImFp7STrUDOgQLW5I5UloCiCRMh6HmMIYIoWqaQkxnR5ws7MuZFG/Ns9sZFyfrnyWCvcW91e+XcEfNeoa4Jew==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-22.4.3.tgz", + "integrity": "sha512-KSg3EOToCgkX+lIvenKY7J8s426h6ahXxaUFJxvGoEk0562Z6inWj1TnKoGycTASwiLD+6kSYFALcjdosq9KIQ==", "dev": true, "requires": { - "chalk": "2.3.0", + "chalk": "2.3.2", "glob": "7.1.2", - "jest-environment-jsdom": "22.1.4", - "jest-environment-node": "22.1.4", - "jest-get-type": "22.1.0", - "jest-jasmine2": "22.1.4", - "jest-regex-util": "22.1.0", - "jest-resolve": "22.1.4", - "jest-util": "22.1.4", - "jest-validate": "22.1.2", - "pretty-format": "22.1.0" + "jest-environment-jsdom": "22.4.3", + "jest-environment-node": "22.4.3", + "jest-get-type": "22.4.3", + "jest-jasmine2": "22.4.3", + "jest-regex-util": "22.4.3", + "jest-resolve": "22.4.3", + "jest-util": "22.4.3", + "jest-validate": "22.4.3", + "pretty-format": "22.4.3" }, "dependencies": { "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" } }, "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", "dev": true, "requires": { - "ansi-styles": "3.2.0", + "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" + "supports-color": "5.3.0" } }, "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "3.0.0" } } } }, "jest-diff": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-22.1.0.tgz", - "integrity": "sha512-lowdbU/dzXh+2/MR5QcvU5KPNkO4JdAEYw0PkQCbIQIuy5+g3QZBuVhWh8179Fmpg4CQrz1WgoK/yQHDCHbqqw==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-22.4.3.tgz", + "integrity": "sha512-/QqGvCDP5oZOF6PebDuLwrB2BMD8ffJv6TAGAdEVuDx1+uEgrHpSFrfrOiMRx2eJ1hgNjlQrOQEHetVwij90KA==", "dev": true, "requires": { - "chalk": "2.3.0", - "diff": "3.4.0", - "jest-get-type": "22.1.0", - "pretty-format": "22.1.0" + "chalk": "2.3.2", + "diff": "3.5.0", + "jest-get-type": "22.4.3", + "pretty-format": "22.4.3" }, "dependencies": { "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" } }, "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", "dev": true, "requires": { - "ansi-styles": "3.2.0", + "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" + "supports-color": "5.3.0" } }, "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "3.0.0" } } } }, "jest-docblock": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-22.1.0.tgz", - "integrity": "sha512-/+OGgBVRJb5wCbXrB1LQvibQBz2SdrvDdKRNzY1gL+OISQJZCR9MOewbygdT5rVzbbkfhC4AR2x+qWmNUdJfjw==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-22.4.3.tgz", + "integrity": "sha512-uPKBEAw7YrEMcXueMKZXn/rbMxBiSv48fSqy3uEnmgOlQhSX+lthBqHb1fKWNVmFqAp9E/RsSdBfiV31LbzaOg==", "dev": true, "requires": { "detect-newline": "2.1.0" } }, "jest-environment-jsdom": { - "version": "22.1.4", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-22.1.4.tgz", - "integrity": "sha512-YGqFJzei/kq5BgQ8su7igLoCl34ytUffr5ZoqwLrDzCmXUKyIiuwBFbWe3xFMG/crlDb1emhBXdzWM1yDEDw5Q==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-22.4.3.tgz", + "integrity": "sha512-FviwfR+VyT3Datf13+ULjIMO5CSeajlayhhYQwpzgunswoaLIPutdbrnfUHEMyJCwvqQFaVtTmn9+Y8WCt6n1w==", "dev": true, "requires": { - "jest-mock": "22.1.0", - "jest-util": "22.1.4", - "jsdom": "11.6.0" + "jest-mock": "22.4.3", + "jest-util": "22.4.3", + "jsdom": "11.7.0" } }, "jest-environment-node": { - "version": "22.1.4", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-22.1.4.tgz", - "integrity": "sha512-rQmtzgZVdyCzeXsE8i7Alw2483KSd2PYjssZWZYeNzonN/lBeUjjaOCgLWp6FspBzSTnYF7x6cN4umGZxYAhow==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-22.4.3.tgz", + "integrity": "sha512-reZl8XF6t/lMEuPWwo9OLfttyC26A5AMgDyEQ6DBgZuyfyeNUzYT8BFo6uxCCP/Av/b7eb9fTi3sIHFPBzmlRA==", "dev": true, "requires": { - "jest-mock": "22.1.0", - "jest-util": "22.1.4" + "jest-mock": "22.4.3", + "jest-util": "22.4.3" } }, "jest-get-type": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.1.0.tgz", - "integrity": "sha512-nD97IVOlNP6fjIN5i7j5XRH+hFsHL7VlauBbzRvueaaUe70uohrkz7pL/N8lx/IAwZRTJ//wOdVgh85OgM7g3w==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", + "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", "dev": true }, "jest-haste-map": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-22.1.0.tgz", - "integrity": "sha512-vETdC6GboGlZX6+9SMZkXtYRQSKBbQ47sFF7NGglbMN4eyIZBODply8rlcO01KwBiAeiNCKdjUyfonZzJ93JEg==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-22.4.3.tgz", + "integrity": "sha512-4Q9fjzuPVwnaqGKDpIsCSoTSnG3cteyk2oNVjBX12HHOaF1oxql+uUiqZb5Ndu7g/vTZfdNwwy4WwYogLh29DQ==", "dev": true, "requires": { "fb-watchman": "2.0.0", "graceful-fs": "4.1.11", - "jest-docblock": "22.1.0", - "jest-worker": "22.1.0", + "jest-docblock": "22.4.3", + "jest-serializer": "22.4.3", + "jest-worker": "22.4.3", "micromatch": "2.3.11", - "sane": "2.3.0" + "sane": "2.5.0" } }, "jest-jasmine2": { - "version": "22.1.4", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-22.1.4.tgz", - "integrity": "sha512-+KoRiG4PUwURB7UXei2jzxvbCebhXgTYS+xWl3FsSYUn3flcxdcOgAsFolx31Dkk/B1bVf1HIKt/B6Ubucp9aQ==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-22.4.3.tgz", + "integrity": "sha512-yZCPCJUcEY6R5KJB/VReo1AYI2b+5Ky+C+JA1v34jndJsRcLpU4IZX4rFJn7yDTtdNbO/nNqg+3SDIPNH2ecnw==", "dev": true, "requires": { - "callsites": "2.0.0", - "chalk": "2.3.0", + "chalk": "2.3.2", "co": "4.6.0", - "expect": "22.1.0", + "expect": "22.4.3", "graceful-fs": "4.1.11", "is-generator-fn": "1.0.0", - "jest-diff": "22.1.0", - "jest-matcher-utils": "22.1.0", - "jest-message-util": "22.1.0", - "jest-snapshot": "22.1.2", - "source-map-support": "0.5.2" + "jest-diff": "22.4.3", + "jest-matcher-utils": "22.4.3", + "jest-message-util": "22.4.3", + "jest-snapshot": "22.4.3", + "jest-util": "22.4.3", + "source-map-support": "0.5.4" }, "dependencies": { "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" } }, "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", "dev": true, "requires": { - "ansi-styles": "3.2.0", + "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" + "supports-color": "5.3.0" } }, "source-map": { @@ -3652,219 +4331,220 @@ "dev": true }, "source-map-support": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.2.tgz", - "integrity": "sha512-9zHceZbQwERaMK1MiFguvx1dL9GQPLXInr2D/wUxAsuV6ZKc9F0DHYWeloMcalkYRbtanwqUakoDjvj55cL/4A==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.4.tgz", + "integrity": "sha512-PETSPG6BjY1AHs2t64vS2aqAgu6dMIMXJULWFBGbh2Gr8nVLbCFDo6i/RMMvviIQ2h1Z8+5gQhVKSn2je9nmdg==", "dev": true, "requires": { "source-map": "0.6.1" } }, "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "3.0.0" } } } }, "jest-leak-detector": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-22.1.0.tgz", - "integrity": "sha512-8QsCWkncWAqdvrXN4yXQp9vgWF6CT3RkRey+d06SIHX913uXzAJhJdZyo6eE+uHVYMxUbxqW93npbUFhAR0YxA==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-22.4.3.tgz", + "integrity": "sha512-NZpR/Ls7+ndO57LuXROdgCGz2RmUdC541tTImL9bdUtU3WadgFGm0yV+Ok4Fuia/1rLAn5KaJ+i76L6e3zGJYQ==", "dev": true, "requires": { - "pretty-format": "22.1.0" + "pretty-format": "22.4.3" } }, "jest-matcher-utils": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-22.1.0.tgz", - "integrity": "sha512-Zn1OD9wVjILOdvRxgAnqiCN36OX6KJx+P2FHN+3lzQ0omG2N2OAguxE1QXuJJneG2yndlkXjekXFP254c0cSpw==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-22.4.3.tgz", + "integrity": "sha512-lsEHVaTnKzdAPR5t4B6OcxXo9Vy4K+kRRbG5gtddY8lBEC+Mlpvm1CJcsMESRjzUhzkz568exMV1hTB76nAKbA==", "dev": true, "requires": { - "chalk": "2.3.0", - "jest-get-type": "22.1.0", - "pretty-format": "22.1.0" + "chalk": "2.3.2", + "jest-get-type": "22.4.3", + "pretty-format": "22.4.3" }, "dependencies": { "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" } }, "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", "dev": true, "requires": { - "ansi-styles": "3.2.0", + "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" + "supports-color": "5.3.0" } }, "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "3.0.0" } } } }, "jest-message-util": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-22.1.0.tgz", - "integrity": "sha512-kftcoawOeOVUGuGWmMupJt7FGLK1pqOrh02FlJwtImmPGZ2yTWCTx2D+N/g95qD2jCbQ/ntH1goBixhAIIxL+g==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-22.4.3.tgz", + "integrity": "sha512-iAMeKxhB3Se5xkSjU0NndLLCHtP4n+GtCqV0bISKA5dmOXQfEbdEmYiu2qpnWBDCQdEafNDDU6Q+l6oBMd/+BA==", "dev": true, "requires": { - "@babel/code-frame": "7.0.0-beta.38", - "chalk": "2.3.0", + "@babel/code-frame": "7.0.0-beta.44", + "chalk": "2.3.2", "micromatch": "2.3.11", "slash": "1.0.0", "stack-utils": "1.0.1" }, "dependencies": { "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" } }, "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", "dev": true, "requires": { - "ansi-styles": "3.2.0", + "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" + "supports-color": "5.3.0" } }, "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "3.0.0" } } } }, "jest-mock": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-22.1.0.tgz", - "integrity": "sha512-gL3/C8ds6e1PWiOTsV7sIejPP/ECYQgDbwMzbNCc+ZFPuPH3EpwsVLGmQqPK6okgnDagimbbQnss3kPJ8HCMtA==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-22.4.3.tgz", + "integrity": "sha512-+4R6mH5M1G4NK16CKg9N1DtCaFmuxhcIqF4lQK/Q1CIotqMs/XBemfpDPeVZBFow6iyUNu6EBT9ugdNOTT5o5Q==", "dev": true }, "jest-regex-util": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-22.1.0.tgz", - "integrity": "sha512-on0LqVS6Xeh69sw3d1RukVnur+lVOl3zkmb0Q54FHj9wHoq6dbtWqb3TSlnVUyx36hqjJhjgs/QLqs07Bzu72Q==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-22.4.3.tgz", + "integrity": "sha512-LFg1gWr3QinIjb8j833bq7jtQopiwdAs67OGfkPrvy7uNUbVMfTXXcOKXJaeY5GgjobELkKvKENqq1xrUectWg==", "dev": true }, "jest-resolve": { - "version": "22.1.4", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-22.1.4.tgz", - "integrity": "sha512-/HuCMeiTD6YJ+NF15bU1mal1r7Gov0GJozA7232XiYve7cOOnU2JwXBx3EQmcIuG38uNrRPjtgpiXkBqfnk4Og==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-22.4.3.tgz", + "integrity": "sha512-u3BkD/MQBmwrOJDzDIaxpyqTxYH+XqAXzVJP51gt29H8jpj3QgKof5GGO2uPGKGeA1yTMlpbMs1gIQ6U4vcRhw==", "dev": true, "requires": { "browser-resolve": "1.11.2", - "chalk": "2.3.0" + "chalk": "2.3.2" }, "dependencies": { "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" } }, "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", "dev": true, "requires": { - "ansi-styles": "3.2.0", + "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" + "supports-color": "5.3.0" } }, "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "3.0.0" } } } }, "jest-resolve-dependencies": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-22.1.0.tgz", - "integrity": "sha512-76Ll61bD/Sus8wK8d+lw891EtiBJGJkWG8OuVDTEX0z3z2+jPujvQqSB2eQ+kCHyCsRwJ2PSjhn3UHqae/oEtA==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-22.4.3.tgz", + "integrity": "sha512-06czCMVToSN8F2U4EvgSB1Bv/56gc7MpCftZ9z9fBgUQM7dzHGCMBsyfVA6dZTx8v0FDcnALf7hupeQxaBCvpA==", "dev": true, "requires": { - "jest-regex-util": "22.1.0" + "jest-regex-util": "22.4.3" } }, "jest-runner": { - "version": "22.1.4", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-22.1.4.tgz", - "integrity": "sha512-HAyZ0Q2Fyk7mlbtbSKP75hNs9IP0Md7kzPUN1uNKbvQfZkXA/e7P0ttzAIGQtEbRx656tYwkfWNW+hXvs1i4/g==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-22.4.3.tgz", + "integrity": "sha512-U7PLlQPRlWNbvOHWOrrVay9sqhBJmiKeAdKIkvX4n1G2tsvzLlf77nBD28GL1N6tGv4RmuTfI8R8JrkvCa+IBg==", "dev": true, "requires": { "exit": "0.1.2", - "jest-config": "22.1.4", - "jest-docblock": "22.1.0", - "jest-haste-map": "22.1.0", - "jest-jasmine2": "22.1.4", - "jest-leak-detector": "22.1.0", - "jest-message-util": "22.1.0", - "jest-runtime": "22.1.4", - "jest-util": "22.1.4", - "jest-worker": "22.1.0", + "jest-config": "22.4.3", + "jest-docblock": "22.4.3", + "jest-haste-map": "22.4.3", + "jest-jasmine2": "22.4.3", + "jest-leak-detector": "22.4.3", + "jest-message-util": "22.4.3", + "jest-runtime": "22.4.3", + "jest-util": "22.4.3", + "jest-worker": "22.4.3", "throat": "4.1.0" } }, "jest-runtime": { - "version": "22.1.4", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-22.1.4.tgz", - "integrity": "sha512-r/UjVuQppDRwbUprDlLYdd8MTYY+H8H6BCqRujGjo5/QyIt3b0hppNoOQHF+0bHNtuz/sR9chJ9HJ3A1fiv9Pw==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-22.4.3.tgz", + "integrity": "sha512-Eat/esQjevhx9BgJEC8udye+FfoJ2qvxAZfOAWshYGS22HydHn5BgsvPdTtt9cp0fSl5LxYOFA1Pja9Iz2Zt8g==", "dev": true, "requires": { "babel-core": "6.26.0", - "babel-jest": "22.1.0", - "babel-plugin-istanbul": "4.1.5", - "chalk": "2.3.0", + "babel-jest": "22.4.3", + "babel-plugin-istanbul": "4.1.6", + "chalk": "2.3.2", "convert-source-map": "1.5.1", "exit": "0.1.2", "graceful-fs": "4.1.11", - "jest-config": "22.1.4", - "jest-haste-map": "22.1.0", - "jest-regex-util": "22.1.0", - "jest-resolve": "22.1.4", - "jest-util": "22.1.4", + "jest-config": "22.4.3", + "jest-haste-map": "22.4.3", + "jest-regex-util": "22.4.3", + "jest-resolve": "22.4.3", + "jest-util": "22.4.3", + "jest-validate": "22.4.3", "json-stable-stringify": "1.0.1", "micromatch": "2.3.11", "realpath-native": "1.0.0", @@ -3874,50 +4554,24 @@ "yargs": "10.1.2" }, "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" } }, "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", "dev": true, "requires": { - "ansi-styles": "3.2.0", + "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "cliui": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.0.0.tgz", - "integrity": "sha512-nY3W5Gu2racvdDk//ELReY+dHjb9PlIcVDFXP72nVIhq2Gy3LuVXYwJoPVudwQnv1shtohpgkdCKT2YaKY0CKw==", - "dev": true, - "requires": { - "string-width": "2.1.1", - "strip-ansi": "4.0.0", - "wrap-ansi": "2.1.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" + "supports-color": "5.3.0" } }, "strip-bom": { @@ -3927,174 +4581,167 @@ "dev": true }, "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - }, - "yargs": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.1.2.tgz", - "integrity": "sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", "dev": true, "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" + "has-flag": "3.0.0" } } } }, + "jest-serializer": { + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-22.4.3.tgz", + "integrity": "sha512-uPaUAppx4VUfJ0QDerpNdF43F68eqKWCzzhUlKNDsUPhjOon7ZehR4C809GCqh765FoMRtTVUVnGvIoskkYHiw==", + "dev": true + }, "jest-snapshot": { - "version": "22.1.2", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-22.1.2.tgz", - "integrity": "sha512-45co/M0gTe6Y6yHaJLydEZKHOFpFHESLah40jW35DWd3pd7q188bsi0oUY4Kls7PDXUamvTWuTKTZXCtzwSvCw==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-22.4.3.tgz", + "integrity": "sha512-JXA0gVs5YL0HtLDCGa9YxcmmV2LZbwJ+0MfyXBBc5qpgkEYITQFJP7XNhcHFbUvRiniRpRbGVfJrOoYhhGE0RQ==", "dev": true, "requires": { - "chalk": "2.3.0", - "jest-diff": "22.1.0", - "jest-matcher-utils": "22.1.0", + "chalk": "2.3.2", + "jest-diff": "22.4.3", + "jest-matcher-utils": "22.4.3", "mkdirp": "0.5.1", "natural-compare": "1.4.0", - "pretty-format": "22.1.0" + "pretty-format": "22.4.3" }, "dependencies": { "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" } }, "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", "dev": true, "requires": { - "ansi-styles": "3.2.0", + "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" + "supports-color": "5.3.0" } }, "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "3.0.0" } } } }, "jest-util": { - "version": "22.1.4", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-22.1.4.tgz", - "integrity": "sha512-zM29idoVBPvmpsGubS7YmywVyPe4/m1wE2YhmKp0vVmrQmuby7ObuMqabp82EYlM0Rdp4GNEtaDamW9jg8lgTg==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-22.4.3.tgz", + "integrity": "sha512-rfDfG8wyC5pDPNdcnAlZgwKnzHvZDu8Td2NJI/jAGKEGxJPYiE4F0ss/gSAkG4778Y23Hvbz+0GMrDJTeo7RjQ==", "dev": true, "requires": { "callsites": "2.0.0", - "chalk": "2.3.0", + "chalk": "2.3.2", "graceful-fs": "4.1.11", "is-ci": "1.1.0", - "jest-message-util": "22.1.0", - "jest-validate": "22.1.2", - "mkdirp": "0.5.1" + "jest-message-util": "22.4.3", + "mkdirp": "0.5.1", + "source-map": "0.6.1" }, "dependencies": { "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" } }, "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", "dev": true, "requires": { - "ansi-styles": "3.2.0", + "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" + "supports-color": "5.3.0" } }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "3.0.0" } } } }, "jest-validate": { - "version": "22.1.2", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-22.1.2.tgz", - "integrity": "sha512-IjvMsV7GW5ghg5PTQvU23zJqTBmnq10eY+4n47awUeXYEGH27N+JajFPOg6tsN+OYvEPsohPquKoqQ5XBVs/ow==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-22.4.3.tgz", + "integrity": "sha512-CfFM18W3GSP/xgmA4UouIx0ljdtfD2mjeBC6c89Gg17E44D4tQhAcTrZmf9djvipwU30kSTnk6CzcxdCCeSXfA==", "dev": true, "requires": { - "chalk": "2.3.0", - "jest-get-type": "22.1.0", + "chalk": "2.3.2", + "jest-config": "22.4.3", + "jest-get-type": "22.4.3", "leven": "2.1.0", - "pretty-format": "22.1.0" + "pretty-format": "22.4.3" }, "dependencies": { "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" } }, "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", "dev": true, "requires": { - "ansi-styles": "3.2.0", + "ansi-styles": "3.2.1", "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" + "supports-color": "5.3.0" } }, "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", "dev": true, "requires": { - "has-flag": "2.0.0" + "has-flag": "3.0.0" } } } }, "jest-worker": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-22.1.0.tgz", - "integrity": "sha512-ezLueYAQowk5N6g2J7bNZfq4NWZvMNB5Qd24EmOZLcM5SXTdiFvxykZIoNiMj9C98cCbPaojX8tfR7b1LJwNig==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-22.4.3.tgz", + "integrity": "sha512-B1ucW4fI8qVAuZmicFxI1R3kr2fNeYJyvIQ1rKcuLYnenFV5K5aMbxFj6J0i00Ju83S8jP2d7Dz14+AvbIHRYQ==", "dev": true, "requires": { "merge-stream": "1.0.1" @@ -4107,12 +4754,12 @@ "dev": true }, "js-yaml": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", - "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.11.0.tgz", + "integrity": "sha512-saJstZWv7oNeOyBh3+Dx1qWzhW0+e6/8eDzo7p5rDFqxntSztloLtuKu+Ejhtq82jsilwOIZYsCz+lIjthg1Hw==", "dev": true, "requires": { - "argparse": "1.0.9", + "argparse": "1.0.10", "esprima": "4.0.0" } }, @@ -4141,7 +4788,7 @@ "espree": "3.1.7", "js2xmlparser": "1.0.0", "klaw": "1.3.1", - "marked": "0.3.12", + "marked": "0.3.19", "mkdirp": "0.5.1", "requizzle": "0.2.1", "strip-json-comments": "2.0.1", @@ -4175,6 +4822,16 @@ "typical": "2.6.1" } }, + "file-set": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/file-set/-/file-set-1.1.1.tgz", + "integrity": "sha1-0+xwwIDsjxjyBLod4QZ4DJBWkms=", + "dev": true, + "requires": { + "array-back": "1.0.4", + "glob": "7.1.2" + } + }, "walk-back": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/walk-back/-/walk-back-2.0.1.tgz", @@ -4218,52 +4875,44 @@ "array-back": "2.0.0", "command-line-tool": "0.7.0", "config-master": "3.1.0", - "dmd": "3.0.9", + "dmd": "3.0.12", "jsdoc-api": "3.0.0", "jsdoc-parse": "3.0.1", "walk-back": "3.0.0" } }, "jsdom": { - "version": "11.6.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.6.0.tgz", - "integrity": "sha512-4lMxDCiQYK7qfVi9fKhDf2PpvXXeH/KAmcH6o0Ga7fApi8+lTBxRqGHWZ9B11SsK/pxQKOtsw413utw0M+hUrg==", + "version": "11.7.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.7.0.tgz", + "integrity": "sha512-9NzSc4Iz4gN9p4uoPbBUzro21QdgL32swaWIaWS8eEVQ2I69fRJAy/MKyvlEIk0V7HtKgfMbbOKyTZUrzR2Hsw==", "dev": true, "requires": { "abab": "1.0.4", - "acorn": "5.3.0", + "acorn": "5.5.3", "acorn-globals": "4.1.0", "array-equal": "1.0.0", - "browser-process-hrtime": "0.1.2", - "content-type-parser": "1.0.2", "cssom": "0.3.2", "cssstyle": "0.2.37", + "data-urls": "1.0.0", "domexception": "1.0.1", - "escodegen": "1.9.0", + "escodegen": "1.9.1", "html-encoding-sniffer": "1.0.2", - "left-pad": "1.2.0", - "nwmatcher": "1.4.3", + "left-pad": "1.3.0", + "nwmatcher": "1.4.4", "parse5": "4.0.0", "pn": "1.1.0", - "request": "2.83.0", + "request": "2.85.0", "request-promise-native": "1.0.5", "sax": "1.2.4", "symbol-tree": "3.2.2", - "tough-cookie": "2.3.3", + "tough-cookie": "2.3.4", "w3c-hr-time": "1.0.1", "webidl-conversions": "4.0.2", "whatwg-encoding": "1.0.3", + "whatwg-mimetype": "2.1.0", "whatwg-url": "6.4.0", - "ws": "4.0.0", + "ws": "4.1.0", "xml-name-validator": "3.0.0" - }, - "dependencies": { - "acorn": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz", - "integrity": "sha512-Yej+zOJ1Dm/IMZzzj78OntP/r3zHEaKcyNoU2lAaxPtrseM6rF0xwqoz5Q5ysAiED9hTjI2hgtvLXitlCN1/Ug==", - "dev": true - } } }, "jsesc": { @@ -4367,9 +5016,9 @@ } }, "left-pad": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.2.0.tgz", - "integrity": "sha1-0wpzxrggHY99jnlWupYWCHpo4O4=", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz", + "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==", "dev": true }, "leven": { @@ -4412,9 +5061,9 @@ } }, "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", + "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==", "dev": true }, "lodash.omit": { @@ -4457,9 +5106,9 @@ } }, "lru-cache": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.2.tgz", + "integrity": "sha512-wgeVXhrDwAWnIF/yZARsFnMBtdFXOg1b8RIrhilp+0iDYN4mdQcNZElDZ0e4B64BhaxeQ5zN7PMyvu7we1kPeQ==", "dev": true, "requires": { "pseudomap": "1.0.2", @@ -4475,10 +5124,25 @@ "tmpl": "1.0.4" } }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "1.0.1" + } + }, "marked": { - "version": "0.3.12", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.12.tgz", - "integrity": "sha512-k4NaW+vS7ytQn6MgJn3fYpQt20/mOgYM5Ft9BYMfQJDz2QT6yEeS9XJ8k2Nw8JTeWK/znPPW2n3UJGzyYEiMoA==", + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz", + "integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==", "dev": true }, "mem": { @@ -4487,7 +5151,7 @@ "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true, "requires": { - "mimic-fn": "1.1.0" + "mimic-fn": "1.2.0" } }, "merge": { @@ -4502,7 +5166,7 @@ "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", "dev": true, "requires": { - "readable-stream": "2.3.3" + "readable-stream": "2.3.6" } }, "micromatch": { @@ -4527,24 +5191,24 @@ } }, "mime-db": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", - "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", "dev": true }, "mime-types": { - "version": "2.1.17", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", - "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", "dev": true, "requires": { - "mime-db": "1.30.0" + "mime-db": "1.33.0" } }, "mimic-fn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", - "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", "dev": true }, "minimatch": { @@ -4553,15 +5217,36 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.8" + "brace-expansion": "1.1.11" } }, "minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "1.0.2", + "is-extendable": "1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "2.0.4" + } + } + } + }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -4569,14 +5254,6 @@ "dev": true, "requires": { "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } } }, "mkdirp2": { @@ -4592,12 +5269,52 @@ "dev": true }, "nan": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz", - "integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=", + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", "dev": true, "optional": true }, + "nanomatch": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.9.tgz", + "integrity": "sha512-n8R9bS8yQ6eSXaV6jHUpKzD8gLsin02w1HSFiegwrs9E098Ylhw5jdyKPaYqvHknHaSCKTPp7C8dGCQ0q9koXA==", + "dev": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "fragment-cache": "0.2.1", + "is-odd": "2.0.0", + "is-windows": "1.0.2", + "kind-of": "6.0.2", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -4617,7 +5334,7 @@ "dev": true, "requires": { "growly": "1.3.0", - "semver": "5.4.1", + "semver": "5.5.0", "shellwords": "0.1.1", "which": "1.3.0" } @@ -4628,10 +5345,10 @@ "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", "dev": true, "requires": { - "hosted-git-info": "2.5.0", + "hosted-git-info": "2.6.0", "is-builtin-module": "1.0.0", - "semver": "5.4.1", - "validate-npm-package-license": "3.0.1" + "semver": "5.5.0", + "validate-npm-package-license": "3.0.3" } }, "normalize-path": { @@ -4659,9 +5376,9 @@ "dev": true }, "nwmatcher": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz", - "integrity": "sha512-IKdSTiDWCarf2JTS5e9e2+5tPZGdkRJ79XjYV0pzK8Q9BpsFyBq1RGKxzs7Q8UBushGw7m6TzVKz6fcY99iSWw==", + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.4.tgz", + "integrity": "sha512-3iuY4N5dhgMpCUrOVnuAdGrgxVqV2cJpM+XNccjR2DKOB1RUP0aA+wGXEiNziG/UKboFyGBIoKOaNlJxx8bciQ==", "dev": true }, "oauth-sign": { @@ -4676,6 +5393,28 @@ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "0.1.1", + "define-property": "0.2.5", + "kind-of": "3.2.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + } + } + }, "object-get": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/object-get/-/object-get-2.1.0.tgz", @@ -4694,6 +5433,23 @@ "integrity": "sha1-d9qIJ/Bz0BHJ4bFz+JV4FHAkZ4U=", "dev": true }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, "object.getownpropertydescriptors": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", @@ -4701,7 +5457,7 @@ "dev": true, "requires": { "define-properties": "1.1.2", - "es-abstract": "1.10.0" + "es-abstract": "1.11.0" } }, "object.omit": { @@ -4714,6 +5470,23 @@ "is-extendable": "0.1.1" } }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -4729,7 +5502,7 @@ "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", "dev": true, "requires": { - "minimist": "0.0.10", + "minimist": "0.0.8", "wordwrap": "0.0.3" } }, @@ -4835,6 +5608,12 @@ "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==", "dev": true }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -4912,6 +5691,12 @@ "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", "dev": true }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -4925,13 +5710,13 @@ "dev": true }, "pretty-format": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-22.1.0.tgz", - "integrity": "sha512-0HHR5hCmjDGU4sez3w5zRDAAwn7V0vT4SgPiYPZ1XDm5sT3Icb+Bh+fsOP3+Y3UwPjMr7TbRj+L7eQyMkPAxAw==", + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-22.4.3.tgz", + "integrity": "sha512-S4oT9/sT6MN7/3COoOy+ZJeA92VmOnveLHgrwBE3Z1W5N9S2A1QGNYiE1z75DAENbJrXXUb+OWXhpJcg05QKQQ==", "dev": true, "requires": { "ansi-regex": "3.0.0", - "ansi-styles": "3.2.0" + "ansi-styles": "3.2.1" }, "dependencies": { "ansi-regex": { @@ -4941,9 +5726,9 @@ "dev": true }, "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "1.9.1" @@ -4958,9 +5743,9 @@ "dev": true }, "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "dev": true }, "pseudomap": { @@ -4970,9 +5755,9 @@ "dev": true }, "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", + "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=", "dev": true }, "qs": { @@ -5065,17 +5850,17 @@ } }, "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { "core-util-is": "1.0.2", "inherits": "2.0.3", "isarray": "1.0.0", - "process-nextick-args": "1.0.7", + "process-nextick-args": "2.0.0", "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", + "string_decoder": "1.1.1", "util-deprecate": "1.0.2" } }, @@ -5171,6 +5956,16 @@ "is-equal-shallow": "0.1.3" } }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "3.0.2", + "safe-regex": "1.1.0" + } + }, "regexpu-core": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", @@ -5233,31 +6028,31 @@ } }, "request": { - "version": "2.83.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", - "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", + "version": "2.85.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz", + "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", "dev": true, "requires": { "aws-sign2": "0.7.0", - "aws4": "1.6.0", + "aws4": "1.7.0", "caseless": "0.12.0", - "combined-stream": "1.0.5", + "combined-stream": "1.0.6", "extend": "3.0.1", "forever-agent": "0.6.1", - "form-data": "2.3.1", + "form-data": "2.3.2", "har-validator": "5.0.3", "hawk": "6.0.2", "http-signature": "1.2.0", "is-typedarray": "1.0.0", "isstream": "0.1.2", "json-stringify-safe": "5.0.1", - "mime-types": "2.1.17", + "mime-types": "2.1.18", "oauth-sign": "0.8.2", "performance-now": "2.1.0", "qs": "6.5.1", "safe-buffer": "5.1.1", "stringstream": "0.0.5", - "tough-cookie": "2.3.3", + "tough-cookie": "2.3.4", "tunnel-agent": "0.6.0", "uuid": "3.2.1" } @@ -5268,7 +6063,7 @@ "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", "dev": true, "requires": { - "lodash": "4.17.4" + "lodash": "4.17.5" } }, "request-promise-native": { @@ -5279,7 +6074,7 @@ "requires": { "request-promise-core": "1.1.1", "stealthy-require": "1.1.1", - "tough-cookie": "2.3.3" + "tough-cookie": "2.3.4" } }, "require-directory": { @@ -5332,6 +6127,18 @@ "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", "dev": true }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, "right-align": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", @@ -5357,119 +6164,543 @@ "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", "dev": true }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "0.1.15" + } + }, "sane": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/sane/-/sane-2.3.0.tgz", - "integrity": "sha512-6GB9zPCsqJqQPAGcvEkUPijM1ZUFI+A/DrscL++dXO3Ltt5q5mPDayGxZtr3cBRkrbb4akbwszVVkTIFefEkcg==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/sane/-/sane-2.5.0.tgz", + "integrity": "sha512-glfKd7YH4UCrh/7dD+UESsr8ylKWRE7UQPoXuz28FgmcF0ViJQhCTCCZHICRKxf8G8O1KdLEn20dcICK54c7ew==", "dev": true, "requires": { - "anymatch": "1.3.2", + "anymatch": "2.0.0", "exec-sh": "0.2.1", "fb-watchman": "2.0.0", "fsevents": "1.1.3", - "minimatch": "3.0.4", + "micromatch": "3.1.10", "minimist": "1.2.0", "walker": "1.0.7", "watch": "0.18.0" }, "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", "dev": true - } - } - }, - "sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", - "dev": true - }, - "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", - "dev": true - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "shellwords": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", - "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true - }, - "sntp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", - "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", - "dev": true, - "requires": { - "hoek": "4.2.0" - } - }, - "sort-array": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/sort-array/-/sort-array-2.0.0.tgz", - "integrity": "sha1-OKnG2if9fRR7QuYFVPKBGHtN9HI=", - "dev": true, - "requires": { - "array-back": "1.0.4", - "object-get": "2.1.0", - "typical": "2.6.1" - }, - "dependencies": { - "array-back": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz", - "integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=", - "dev": true, - "requires": { + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "1.1.0", + "array-unique": "0.3.2", + "extend-shallow": "2.0.1", + "fill-range": "4.0.0", + "isobject": "3.0.1", + "repeat-element": "1.1.2", + "snapdragon": "0.8.2", + "snapdragon-node": "2.1.1", + "split-string": "3.1.0", + "to-regex": "3.0.2" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "posix-character-classes": "0.1.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "0.3.2", + "define-property": "1.0.0", + "expand-brackets": "2.1.4", + "extend-shallow": "2.0.1", + "fragment-cache": "0.2.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-number": "3.0.0", + "repeat-string": "1.6.1", + "to-regex-range": "2.1.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "braces": "2.3.2", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "extglob": "2.0.4", + "fragment-cache": "0.2.1", + "kind-of": "6.0.2", + "nanomatch": "1.2.9", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, + "semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "split-string": "3.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shellwords": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "0.11.2", + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "map-cache": "0.2.2", + "source-map": "0.5.7", + "source-map-resolve": "0.5.1", + "use": "3.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "1.0.0", + "isobject": "3.0.1", + "snapdragon-util": "3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "sntp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "dev": true, + "requires": { + "hoek": "4.2.1" + } + }, + "sort-array": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/sort-array/-/sort-array-2.0.0.tgz", + "integrity": "sha1-OKnG2if9fRR7QuYFVPKBGHtN9HI=", + "dev": true, + "requires": { + "array-back": "1.0.4", + "object-get": "2.1.0", + "typical": "2.6.1" + }, + "dependencies": { + "array-back": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz", + "integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=", + "dev": true, + "requires": { "typical": "2.6.1" } } } }, "source-map": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", - "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.1.tgz", + "integrity": "sha512-0KW2wvzfxm8NCTb30z0LMNyPqWCdDGE2viwzUaucqJdkTRXtZiSY3I+2A6nVAjmdOy0I4gU8DwnVVGsk9jvP2A==", "dev": true, "requires": { - "amdefine": "1.0.1" + "atob": "2.1.0", + "decode-uri-component": "0.2.0", + "resolve-url": "0.2.1", + "source-map-url": "0.4.0", + "urix": "0.1.0" } }, "source-map-support": { @@ -5479,37 +6710,55 @@ "dev": true, "requires": { "source-map": "0.5.7" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } } }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, "spdx-correct": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", - "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", + "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", "dev": true, "requires": { - "spdx-license-ids": "1.2.2" + "spdx-expression-parse": "3.0.0", + "spdx-license-ids": "3.0.0" } }, - "spdx-expression-parse": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", - "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", + "spdx-exceptions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", + "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", "dev": true }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "2.1.0", + "spdx-license-ids": "3.0.0" + } + }, "spdx-license-ids": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", - "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", + "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", "dev": true }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "3.0.2" + } + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -5517,9 +6766,9 @@ "dev": true }, "sshpk": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", - "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", + "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", "dev": true, "requires": { "asn1": "0.2.3", @@ -5538,6 +6787,27 @@ "integrity": "sha1-1PM6tU6OOHeLDKXP07OvsS22hiA=", "dev": true }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "0.2.5", + "object-copy": "0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + } + } + }, "stealthy-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", @@ -5625,9 +6895,9 @@ } }, "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { "safe-buffer": "5.1.1" @@ -5682,9 +6952,9 @@ "dev": true }, "table-layout": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-0.4.2.tgz", - "integrity": "sha512-tygyl5+eSHj4chpq5Zfy6cpc7MOUBClAW9ozghFH7hg9bAUzShOYn+/vUzTRkKOSLJWKfgYtP2tAU2c0oAD8eg==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-0.4.3.tgz", + "integrity": "sha512-MIhflPM38ejKrFwWwC3P9x3eHvMo5G5AmNo29Qtz2HpBl5KD2GCcmOErjgNtUQLv/qaqVDagfJY3rJLPDvEgLg==", "dev": true, "requires": { "array-back": "2.0.0", @@ -5707,16 +6977,292 @@ "dev": true }, "test-exclude": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.1.1.tgz", - "integrity": "sha512-35+Asrsk3XHJDBgf/VRFexPgh3UyETv8IAn/LRTiZjVy6rjPVqdEk8dJcJYBzl1w0XCJM48lvTy8SfEsCWS4nA==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.2.1.tgz", + "integrity": "sha512-qpqlP/8Zl+sosLxBcVKl9vYy26T9NPalxSzzCP/OY6K7j938ui2oKgo+kRZYfxAeIpLqpbVnsHq1tyV70E4lWQ==", "dev": true, "requires": { "arrify": "1.0.1", - "micromatch": "2.3.11", + "micromatch": "3.1.10", "object-assign": "4.1.1", "read-pkg-up": "1.0.1", "require-main-filename": "1.0.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "1.1.0", + "array-unique": "0.3.2", + "extend-shallow": "2.0.1", + "fill-range": "4.0.0", + "isobject": "3.0.1", + "repeat-element": "1.1.2", + "snapdragon": "0.8.2", + "snapdragon-node": "2.1.1", + "split-string": "3.1.0", + "to-regex": "3.0.2" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "posix-character-classes": "0.1.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "0.3.2", + "define-property": "1.0.0", + "expand-brackets": "2.1.4", + "extend-shallow": "2.0.1", + "fragment-cache": "0.2.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-number": "3.0.0", + "repeat-string": "1.6.1", + "to-regex-range": "2.1.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "braces": "2.3.2", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "extglob": "2.0.4", + "fragment-cache": "0.2.1", + "kind-of": "6.0.2", + "nanomatch": "1.2.9", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + } + } } }, "test-value": { @@ -5758,13 +7304,63 @@ "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", "dev": true }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "regex-not": "1.0.2", + "safe-regex": "1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "3.0.0", + "repeat-string": "1.6.1" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + } + } + }, "tough-cookie": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", - "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", "dev": true, "requires": { "punycode": "1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } } }, "tr46": { @@ -5774,14 +7370,6 @@ "dev": true, "requires": { "punycode": "2.1.0" - }, - "dependencies": { - "punycode": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", - "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=", - "dev": true - } } }, "trim-right": { @@ -5790,6 +7378,81 @@ "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", "dev": true }, + "tslib": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", + "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", + "dev": true + }, + "tslint": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.9.1.tgz", + "integrity": "sha1-ElX4ej/1frCw4fDmEKi0dIBGya4=", + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "builtin-modules": "1.1.1", + "chalk": "2.3.2", + "commander": "2.15.1", + "diff": "3.5.0", + "glob": "7.1.2", + "js-yaml": "3.11.0", + "minimatch": "3.0.4", + "resolve": "1.7.1", + "semver": "5.5.0", + "tslib": "1.9.0", + "tsutils": "2.26.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz", + "integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.3.0" + } + }, + "resolve": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", + "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } + }, + "supports-color": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz", + "integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } + } + } + }, + "tsutils": { + "version": "2.26.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.26.1.tgz", + "integrity": "sha512-bnm9bcjOqOr1UljleL94wVCDlpa6KjfGaTkefeLch4GRafgDkROxPizbB/FxTEdI++5JqhxczRy/Qub0syNqZA==", + "dev": true, + "requires": { + "tslib": "1.9.0" + } + }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -5816,9 +7479,9 @@ } }, "typescript": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.2.tgz", - "integrity": "sha1-PFtv1/beCRQmkCfwPAlGdY92c6Q=", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.8.1.tgz", + "integrity": "sha512-Ao/f6d/4EPLq0YwzsQz8iXflezpTkQzqAyenTiw4kCUGr1uPiFLC3+fZ+gMZz6eeI/qdRUqvC+HxIJzUAzEFdg==", "dev": true }, "typical": { @@ -5828,15 +7491,21 @@ "dev": true }, "uglify-es": { - "version": "3.3.8", - "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.8.tgz", - "integrity": "sha512-j8li0jWcAN6yBuAVYFZEFyYINZAm4WEdMwkA6qXFi4TLrze3Mp0Le7QjW6LR9HQjQJ2zRa9VgnFLs3PatijWOw==", + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.10.tgz", + "integrity": "sha512-rPzPisCzW68Okj1zNrfa2dR9uEm43SevDmpR6FChoZABFk9dANGnzzBMgHYUXI3609//63fnVkyQ1SQmAMyjww==", "dev": true, "requires": { - "commander": "2.13.0", + "commander": "2.14.1", "source-map": "0.6.1" }, "dependencies": { + "commander": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.14.1.tgz", + "integrity": "sha512-+YR16o3rK53SmWHU3rEM3tPAh2rwb1yPcQX5irVn7mb0gXbwuCCrnkbV5+PBfETdfg1vui07nM6PCG1zndcjQw==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -5846,12 +7515,12 @@ } }, "uglify-js": { - "version": "3.3.8", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.8.tgz", - "integrity": "sha512-X0jAGtpSZRtd4RhbVNuGHyjZNa/h2MrVkKrR3Ew5iL2MJw6d7FmBke+fhVCALWySv1ygHnjjROG1KI1FAPvddw==", + "version": "3.3.21", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.21.tgz", + "integrity": "sha512-uy82472lH8tshK3jS3c5IFb5MmNKd/5qyBd0ih8sM42L3jWvxnE339U9gZU1zufnLVs98Stib9twq8dLm2XYCA==", "dev": true, "requires": { - "commander": "2.13.0", + "commander": "2.15.1", "source-map": "0.6.1" }, "dependencies": { @@ -5870,12 +7539,6 @@ "dev": true, "optional": true }, - "ultron": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==", - "dev": true - }, "underscore": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", @@ -5899,12 +7562,116 @@ } } }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "3.1.0", + "get-value": "2.0.6", + "is-extendable": "0.1.1", + "set-value": "0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "to-object-path": "0.3.0" + } + } + } + }, "universalify": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.1.tgz", "integrity": "sha1-+nG63UQ3r0wUiEHjs7Fl+enlkLc=", "dev": true }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "0.3.1", + "isobject": "3.0.1" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "2.0.6", + "has-values": "0.1.4", + "isobject": "2.1.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "use": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.0.tgz", + "integrity": "sha512-6UJEQM/L+mzC3ZJNM56Q4DFGLX/evKGRg15UJHGB9X5j5Z3AFbgZvjUh2yq/UJUY4U5dh7Fal++XbNg1uzpRAw==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + }, + "dependencies": { + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -5928,13 +7695,13 @@ "dev": true }, "validate-npm-package-license": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", - "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz", + "integrity": "sha512-63ZOUnL4SIXj4L0NixR3L1lcjO38crAbgrTpl28t8jjrfuiOBL5Iygm+60qPs/KsZGzPNg6Smnc/oY16QTjF0g==", "dev": true, "requires": { - "spdx-correct": "1.0.2", - "spdx-expression-parse": "1.0.4" + "spdx-correct": "3.0.0", + "spdx-expression-parse": "3.0.0" } }, "verror": { @@ -6005,6 +7772,12 @@ "iconv-lite": "0.4.19" } }, + "whatwg-mimetype": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.1.0.tgz", + "integrity": "sha512-FKxhYLytBQiUKjkYteN71fAUA3g6KpNXoho1isLiLSB3N1G4F35Q5vUxWfKFhBwi5IWF27VE6WxhrnnC+m0Mew==", + "dev": true + }, "whatwg-url": { "version": "6.4.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.4.0.tgz", @@ -6104,14 +7877,13 @@ } }, "ws": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-4.0.0.tgz", - "integrity": "sha512-QYslsH44bH8O7/W2815u5DpnCpXWpEK44FmaHffNwgJI4JMaSZONgPBTOfrxJ29mXKbXak+LsJ2uAkDTYq2ptQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-4.1.0.tgz", + "integrity": "sha512-ZGh/8kF9rrRNffkLFV4AzhvooEclrOH0xaugmqGsIfFgOE/pIz4fMc4Ef+5HSQqTEug2S9JZIWDR47duDSLfaA==", "dev": true, "requires": { "async-limiter": "1.0.0", - "safe-buffer": "5.1.1", - "ultron": "1.1.1" + "safe-buffer": "5.1.1" } }, "xml-name-validator": { @@ -6133,16 +7905,51 @@ "dev": true }, "yargs": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "version": "10.1.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.1.2.tgz", + "integrity": "sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig==", "dev": true, - "optional": true, "requires": { - "camelcase": "1.2.1", - "cliui": "2.1.0", + "cliui": "4.0.0", "decamelize": "1.2.0", - "window-size": "0.1.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" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "cliui": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.0.0.tgz", + "integrity": "sha512-nY3W5Gu2racvdDk//ELReY+dHjb9PlIcVDFXP72nVIhq2Gy3LuVXYwJoPVudwQnv1shtohpgkdCKT2YaKY0CKw==", + "dev": true, + "requires": { + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "wrap-ansi": "2.1.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } } }, "yargs-parser": { diff --git a/package.json b/package.json index a162ff24..199844fa 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,8 @@ "common", "prototype", "array", + "all", + "any", "isInstance", "range", "repeat", @@ -106,19 +108,34 @@ "doc": "tsc && jsdoc2md es6/*.js es6/**/*.js es6/**/**/*.js --example-lang javascript > API.md", "build": "node scripts/build.js", "prepare": "npm run build && npm test", + "lint": "tslint -p tsconfig.json -c tslint.json --exclude '**/*.d.ts'", "test": "jest" }, "devDependencies": { - "@types/node": "^9.3.0", + "@types/jest": "^22.2.3", + "@types/node": "^9.6.4", "babel-core": "^6.26.0", "babel-preset-env": "^1.6.1", "fs-extra": "^5.0.0", "fs-readdir-recursive": "^1.1.0", - "jest": "^22.1.4", + "jest": "^22.4.3", "jsdoc-to-markdown": "^3.0.4", "rimraf": "^2.6.2", - "typescript": "^2.6.2", - "uglify-es": "^3.3.8", - "uglify-js": "^3.3.8" + "tslint": "^5.9.1", + "typescript": "^2.8.1", + "uglify-es": "^3.3.10", + "uglify-js": "^3.3.21" + }, + "jest": { + "moduleFileExtensions": [ + "ts", + "js" + ], + "transform": { + "^.+\\.ts$": "/scripts/preprocessor.js" + }, + "testMatch": [ + "/lib/**/test\\.(ts|js)" + ] } } diff --git a/scripts/preprocessor.js b/scripts/preprocessor.js new file mode 100644 index 00000000..02759447 --- /dev/null +++ b/scripts/preprocessor.js @@ -0,0 +1,10 @@ +const tsc = require('typescript'); +const tsConfig = require('../tsconfig.json'); + +module.exports = { + process(src, path) { + if (path.endsWith('.ts')) return tsc.transpile(src, tsConfig.compilerOptions, path, []); + + return src; + }, +}; diff --git a/tsconfig.json b/tsconfig.json index 9f66f081..217818cc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,9 +3,15 @@ "compilerOptions": { "module": "commonjs", "target": "es6", - "rootDir": "./lib", - "outDir": "./es6", + "rootDir": "lib", + "outDir": "es6", "declaration": true, "strict": true - } + }, + "include": [ + "lib/**/*" + ], + "exclude": [ + "**/test.ts" + ] } diff --git a/tslint.json b/tslint.json new file mode 100644 index 00000000..1b154ac4 --- /dev/null +++ b/tslint.json @@ -0,0 +1,70 @@ +{ + "defaultSeverity": "error", + "extends": [ + "tslint:recommended" + ], + "jsRules": {}, + "rules": { + "ordered-imports": false, + "no-namespace": false, + "no-internal-module": false, + "interface-name": [ + true, + "never-prefix" + ], + "no-empty-interface": false, + "member-access": [ + true, + "no-public" + ], + "object-literal-sort-keys": false, + "variable-name": [ + true, + "ban-keywords", + "check-format", + "allow-pascal-case", + "allow-leading-underscore" + ], + "no-angle-bracket-type-assertion": false, + "no-shadowed-variable": false, + "member-ordering": [ + true, + { + "order": [ + "private-static-field", + "public-static-field", + "private-instance-field", + "public-instance-field", + "private-constructor", + "public-constructor", + "protected-instance-method", + "private-instance-method", + "public-instance-method" + ] + } + ], + "no-console": false, + "no-empty": false, + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-module", + "check-separator", + "check-rest-spread", + "check-type", + "check-type-operator", + "check-preblock" + ], + "forin": false, + "curly": [ + true, + "as-needed" + ], + "unified-signatures": false, + "prefer-for-of": false, + "no-bitwise": false + }, + "rulesDirectory": [] +} From 6d0fb0566cd2893e87d62aa8994430066f47ebb2 Mon Sep 17 00:00:00 2001 From: Ardalan Amini Date: Fri, 13 Apr 2018 02:59:19 +0430 Subject: [PATCH 2/5] Update README --- README.md | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d1199040..d1cc83ac 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,43 @@ npm version + + typescript version + + + package quality + + + npm downloads + npm monthly downloads - - github stars + + open issues + + + closed issues tested with jest + + known vulnerabilities + + + dependencies status + + + pull requests - tested with jest + license + + + github stars + + + github stars
From 0f67c4342d0b944df015a790f577372dc2ff7d0d Mon Sep 17 00:00:00 2001 From: Ardalan Amini Date: Fri, 13 Apr 2018 03:25:13 +0430 Subject: [PATCH 3/5] some improvements --- CHANGELOG.md | 2 +- README.md | 8 ++++++++ lib/array/compact/index.ts | 12 +++++++----- lib/array/compact/method.ts | 3 +++ lib/array/compact/test.js | 7 ------- lib/array/compact/test.ts | 8 ++++++++ lib/array/contains/index.ts | 12 +++++++----- lib/array/contains/method.ts | 3 +++ lib/array/contains/{test.js => test.ts} | 8 ++++---- lib/array/count/index.ts | 12 +++++++----- lib/array/count/method.ts | 3 +++ lib/array/count/{test.js => test.ts} | 12 ++++++------ lib/array/countBy/index.ts | 16 +++++++--------- lib/array/countBy/method.ts | 9 +++++++++ lib/array/countBy/test.js | 11 ----------- lib/array/countBy/test.ts | 11 +++++++++++ lib/array/crossJoin/index.ts | 23 +++++++---------------- lib/array/crossJoin/method.ts | 16 ++++++++++++++++ lib/array/crossJoin/test.js | 7 ------- lib/array/crossJoin/test.ts | 7 +++++++ package.json | 1 + 21 files changed, 115 insertions(+), 76 deletions(-) create mode 100644 lib/array/compact/method.ts delete mode 100644 lib/array/compact/test.js create mode 100644 lib/array/compact/test.ts create mode 100644 lib/array/contains/method.ts rename lib/array/contains/{test.js => test.ts} (51%) create mode 100644 lib/array/count/method.ts rename lib/array/count/{test.js => test.ts} (51%) create mode 100644 lib/array/countBy/method.ts delete mode 100644 lib/array/countBy/test.js create mode 100644 lib/array/countBy/test.ts create mode 100644 lib/array/crossJoin/method.ts delete mode 100644 lib/array/crossJoin/test.js create mode 100644 lib/array/crossJoin/test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 78758782..6868cc0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,10 +12,10 @@ - function `merge` renamed into `$merge` - function `size` renamed into `$size` - `String.prototype` - - function `pluralize` improved - function `base64` added - function `base64Decode` added - function `map` added + - function `pluralize` improved - some general enhancements diff --git a/README.md b/README.md index d1cc83ac..aefc5a51 100644 --- a/README.md +++ b/README.md @@ -81,4 +81,12 @@ require('prototyped.js/dist/string/words'); console.log('hello world!'.words()); // ['hello', 'world'] ``` +even better, just import the method you want + +```javascript +const words = require('prototyped.js/dist/string/words/method'); + +console.log(words('hello world!')); // ['hello', 'world'] +``` + All documents are available at [API.md](https://github.com/ardalanamini/prototyped.js/blob/master/API.md) diff --git a/lib/array/compact/index.ts b/lib/array/compact/index.ts index 77e61e8e..8d52a527 100644 --- a/lib/array/compact/index.ts +++ b/lib/array/compact/index.ts @@ -1,8 +1,10 @@ -export { } +import * as method from "./method"; + +export { }; declare global { interface Array { - compact(): Array + compact(): T[]; } } @@ -13,6 +15,6 @@ declare global { * @example * [0, 1, false, 2, '', 3, 'a', 'e' * 23, NaN, 's', 34].compact(); // [ 1, 2, 3, 'a', 's', 34 ] */ -Array.prototype.compact = function(): Array { - return this.filter(Boolean) -} +Array.prototype.compact = function() { + return method(this); +}; diff --git a/lib/array/compact/method.ts b/lib/array/compact/method.ts new file mode 100644 index 00000000..70859b7e --- /dev/null +++ b/lib/array/compact/method.ts @@ -0,0 +1,3 @@ +const method = (arr: any[]) => arr.filter(Boolean); + +export = method; diff --git a/lib/array/compact/test.js b/lib/array/compact/test.js deleted file mode 100644 index a37ca23e..00000000 --- a/lib/array/compact/test.js +++ /dev/null @@ -1,7 +0,0 @@ -require('../../../es6/array/compact') - -describe("Array.prototype.compact", () => { - test("[0,1,false,2,'',3,'a','e' * 23,NaN,'s',34].compact() returns [1,2,3,'a','s',34]", () => { - expect([0,1,false,2,'',3,'a','e' * 23,NaN,'s',34].compact()).toEqual([1,2,3,'a','s',34]) - }) -}) diff --git a/lib/array/compact/test.ts b/lib/array/compact/test.ts new file mode 100644 index 00000000..78af3921 --- /dev/null +++ b/lib/array/compact/test.ts @@ -0,0 +1,8 @@ +import "./index"; + +describe("Array.prototype.compact", () => { + test("[0,1,false,2,\"\",3,\"a\",\"e\" * 23,NaN,\"s\",34].compact() returns [1,2,3,\"a\",\"s\",34]", () => { + expect([0, 1, false, 2, "", 3, "a", "e" as any * 23, NaN, "s", 34].compact()) + .toEqual([1, 2, 3, "a", "s", 34]); + }); +}); diff --git a/lib/array/contains/index.ts b/lib/array/contains/index.ts index 2a863537..3dfb4f54 100644 --- a/lib/array/contains/index.ts +++ b/lib/array/contains/index.ts @@ -1,8 +1,10 @@ -export { } +import * as method from "./method"; + +export { }; declare global { interface Array { - contains(value: any): boolean + contains(value: any): boolean; } } @@ -14,6 +16,6 @@ declare global { * @example * [1, 2, 3].contains(2); // true */ -Array.prototype.contains = function(value: any): boolean { - return this.indexOf(value) !== -1 -} +Array.prototype.contains = function(value) { + return method(this, value); +}; diff --git a/lib/array/contains/method.ts b/lib/array/contains/method.ts new file mode 100644 index 00000000..fc71c339 --- /dev/null +++ b/lib/array/contains/method.ts @@ -0,0 +1,3 @@ +const method = (arr: any[], value: any) => arr.indexOf(value) !== -1; + +export = method; diff --git a/lib/array/contains/test.js b/lib/array/contains/test.ts similarity index 51% rename from lib/array/contains/test.js rename to lib/array/contains/test.ts index aa41e098..eb1264c5 100644 --- a/lib/array/contains/test.js +++ b/lib/array/contains/test.ts @@ -1,7 +1,7 @@ -require('../../../es6/array/contains') +import "./index"; describe("Array.prototype.contains", () => { test("[1, 2, 3].contains(2) returns true", () => { - expect([1, 2, 3].contains(2)).toBe(true) - }) -}) + expect([1, 2, 3].contains(2)).toBe(true); + }); +}); diff --git a/lib/array/count/index.ts b/lib/array/count/index.ts index 51ac9a83..cccf5230 100644 --- a/lib/array/count/index.ts +++ b/lib/array/count/index.ts @@ -1,8 +1,10 @@ -export { } +import * as method from "./method"; + +export { }; declare global { interface Array { - count(value?: any): number + count(value?: T): number; } } @@ -15,6 +17,6 @@ declare global { * [1, 1, 2, 1, 2, 3].count(); // 6 * [1, 1, 2, 1, 2, 3].count(1); // 3 */ -Array.prototype.count = function(value: any): number { - return value ? this.reduce((a, v) => (v === value ? a + 1 : a + 0), 0) : this.length -} +Array.prototype.count = function(value) { + return method(this, value); +}; diff --git a/lib/array/count/method.ts b/lib/array/count/method.ts new file mode 100644 index 00000000..29e9e452 --- /dev/null +++ b/lib/array/count/method.ts @@ -0,0 +1,3 @@ +const method = (arr: any[], value: any) => value ? arr.reduce((a, v) => (v === value ? a + 1 : a + 0), 0) : arr.length; + +export = method; diff --git a/lib/array/count/test.js b/lib/array/count/test.ts similarity index 51% rename from lib/array/count/test.js rename to lib/array/count/test.ts index 585d935e..8607feb1 100644 --- a/lib/array/count/test.js +++ b/lib/array/count/test.ts @@ -1,11 +1,11 @@ -require('../../../es6/array/count') +import "./index"; describe("Array.prototype.count", () => { test("[1, 1, 2, 1, 2, 3].count() returns 6", () => { - expect([1, 1, 2, 1, 2, 3].count()).toBe(6) - }) + expect([1, 1, 2, 1, 2, 3].count()).toBe(6); + }); test("[1, 1, 2, 1, 2, 3].count(1) returns 3", () => { - expect([1, 1, 2, 1, 2, 3].count(1)).toBe(3) - }) -}) + expect([1, 1, 2, 1, 2, 3].count(1)).toBe(3); + }); +}); diff --git a/lib/array/countBy/index.ts b/lib/array/countBy/index.ts index fbfb4c5d..60d47bb0 100644 --- a/lib/array/countBy/index.ts +++ b/lib/array/countBy/index.ts @@ -1,8 +1,10 @@ -export { } +import * as method from "./method"; + +export { }; declare global { interface Array { - countBy(fn: string | (() => any)): { [key: string]: any } + countBy(fn: string | ((value: any) => any)): { [key: string]: any }; } } @@ -15,10 +17,6 @@ declare global { * [6.1, 4.2, 6.3].countBy(Math.floor); // {4: 1, 6: 2} * ['one', 'two', 'three'].countBy('length'); // {3: 2, 5: 1} */ -Array.prototype.countBy = function(fn: string | (() => any)): { [key: string]: any } { - return this.map(typeof fn === 'function' ? fn : (val) => val[fn]).reduce((acc: { [key: string]: any }, val: string, i) => { - acc[val] = (acc[val] || 0) + 1 - - return acc - }, {}) - } +Array.prototype.countBy = function(fn) { + return method(this, fn); +}; diff --git a/lib/array/countBy/method.ts b/lib/array/countBy/method.ts new file mode 100644 index 00000000..10c60c82 --- /dev/null +++ b/lib/array/countBy/method.ts @@ -0,0 +1,9 @@ +const method = (arr: any[], fn: string | ((value: any) => any)) => arr.map( + typeof fn === "function" ? fn : (val) => val[fn], +).reduce((acc: { [key: string]: any }, val: string, i) => { + acc[val] = (acc[val] || 0) + 1; + + return acc; +}, {}); + +export = method; diff --git a/lib/array/countBy/test.js b/lib/array/countBy/test.js deleted file mode 100644 index 45ecee9e..00000000 --- a/lib/array/countBy/test.js +++ /dev/null @@ -1,11 +0,0 @@ -require('../../../es6/array/countBy') - -describe("Array.prototype.countBy", () => { - test('[6.1, 4.2, 6.3].countBy(Math.floor) returns {4: 1, 6: 2}', () => { - expect([6.1, 4.2, 6.3].countBy(Math.floor)).toEqual({4: 1, 6: 2}) - }) - - test("['one', 'two', 'three'].countBy('length') returns {3: 2, 5: 1}", () => { - expect(['one', 'two', 'three'].countBy('length')).toEqual({3: 2, 5: 1}) - }) -}) diff --git a/lib/array/countBy/test.ts b/lib/array/countBy/test.ts new file mode 100644 index 00000000..b675494a --- /dev/null +++ b/lib/array/countBy/test.ts @@ -0,0 +1,11 @@ +import "./index"; + +describe("Array.prototype.countBy", () => { + test("[6.1, 4.2, 6.3].countBy(Math.floor) returns {4: 1, 6: 2}", () => { + expect([6.1, 4.2, 6.3].countBy(Math.floor)).toEqual({4: 1, 6: 2}); + }); + + test("[\"one\", \"two\", \"three\"].countBy(\"length\") returns {3: 2, 5: 1}", () => { + expect(["one", "two", "three"].countBy("length")).toEqual({3: 2, 5: 1}); + }); +}); diff --git a/lib/array/crossJoin/index.ts b/lib/array/crossJoin/index.ts index 19a4344f..211bdfee 100644 --- a/lib/array/crossJoin/index.ts +++ b/lib/array/crossJoin/index.ts @@ -1,8 +1,10 @@ -export { } +import * as method from "./method"; + +export { }; declare global { interface Array { - crossJoin(array: Array): Array<[T, any]> + crossJoin(array: any[]): Array<[T, any]>; } } @@ -14,17 +16,6 @@ declare global { * @example * [1, 2].crossJoin(['a', 'b']); // [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']] */ -Array.prototype.crossJoin = function(array: Array): Array<[any, any]> { - let joined: Array<[any, any]> = [] - - this.map((item) => { - array.map((value) => { - joined.push([ - item, - value - ]) - }) - }) - - return joined -} +Array.prototype.crossJoin = function(array) { + return method(this, array); +}; diff --git a/lib/array/crossJoin/method.ts b/lib/array/crossJoin/method.ts new file mode 100644 index 00000000..568a8825 --- /dev/null +++ b/lib/array/crossJoin/method.ts @@ -0,0 +1,16 @@ +const method = (arr: any[], arr2: any[]) => { + const joined: Array<[any, any]> = []; + + arr.map((item) => { + arr2.map((value) => { + joined.push([ + item, + value, + ]); + }); + }); + + return joined; +}; + +export = method; diff --git a/lib/array/crossJoin/test.js b/lib/array/crossJoin/test.js deleted file mode 100644 index 2fac37db..00000000 --- a/lib/array/crossJoin/test.js +++ /dev/null @@ -1,7 +0,0 @@ -require('../../../es6/array/crossJoin') - -describe("Array.prototype.crossJoin", () => { - test("[1, 2].crossJoin(['a', 'b']); returns [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]", () => { - expect([1, 2].crossJoin(['a', 'b'])).toEqual([[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]) - }) -}) diff --git a/lib/array/crossJoin/test.ts b/lib/array/crossJoin/test.ts new file mode 100644 index 00000000..690646a1 --- /dev/null +++ b/lib/array/crossJoin/test.ts @@ -0,0 +1,7 @@ +import "./index"; + +describe("Array.prototype.crossJoin", () => { + test("[1, 2].crossJoin([\"a\", \"b\"]); returns [[1, \"a\"], [1, \"b\"], [2, \"a\"], [2, \"b\"]]", () => { + expect([1, 2].crossJoin(["a", "b"])).toEqual([[1, "a"], [1, "b"], [2, "a"], [2, "b"]]); + }); +}); diff --git a/package.json b/package.json index 199844fa..6ee13df7 100644 --- a/package.json +++ b/package.json @@ -100,6 +100,7 @@ "size" ], "main": "dist/index.js", + "types": "dist/index.d.js", "files": [ "dist", "es6" From b5b453a35f16f11dacc96b09ed4c8495b1b19198 Mon Sep 17 00:00:00 2001 From: Ardalan Amini Date: Fri, 13 Apr 2018 23:18:47 +0430 Subject: [PATCH 4/5] Update Version --- CHANGELOG.md | 5 +- README.md | 8 ++ lib/array/all/index.ts | 2 - lib/array/any/index.ts | 2 - lib/array/append/index.ts | 2 - lib/array/average/index.ts | 2 - lib/array/average/method.ts | 14 +--- lib/array/chunk/index.ts | 2 - lib/array/clone/index.ts | 2 - lib/array/compact/index.ts | 2 - lib/array/contains/index.ts | 2 - lib/array/count/index.ts | 2 - lib/array/countBy/index.ts | 2 - lib/array/crossJoin/index.ts | 2 - lib/array/deepFlatten/index.ts | 12 ++- lib/array/deepFlatten/method.ts | 3 + lib/array/deepFlatten/{test.js => test.ts} | 8 +- lib/array/diff/index.ts | 14 ++-- lib/array/diff/method.ts | 9 +++ lib/array/diff/{test.js => test.ts} | 13 ++-- lib/array/distinct/index.ts | 10 +-- lib/array/distinct/method.ts | 3 + lib/array/distinct/{test.js => test.ts} | 8 +- lib/array/everyNth/index.ts | 10 +-- lib/array/everyNth/method.ts | 3 + lib/array/everyNth/{test.js => test.ts} | 8 +- lib/array/first/index.ts | 10 +-- lib/array/first/method.ts | 3 + lib/array/first/{test.js => test.ts} | 8 +- lib/array/flatten/index.ts | 15 ++-- lib/array/flatten/method.ts | 5 ++ lib/array/flatten/{test.js => test.ts} | 12 +-- lib/array/get/index.ts | 12 ++- lib/array/get/method.ts | 7 ++ lib/array/get/test.js | 11 --- lib/array/get/test.ts | 11 +++ lib/array/groupBy/index.ts | 14 ++-- lib/array/groupBy/method.ts | 9 +++ lib/array/groupBy/test.js | 11 --- lib/array/groupBy/test.ts | 13 ++++ lib/array/implode/index.ts | 19 ++--- lib/array/implode/method.ts | 11 +++ lib/array/implode/test.js | 7 -- lib/array/implode/test.ts | 11 +++ lib/array/index.ts | 82 ++++++++++---------- lib/array/indexOfAll/index.ts | 14 ++-- lib/array/indexOfAll/method.ts | 9 +++ lib/array/indexOfAll/{test.js => test.ts} | 12 +-- lib/array/initial/index.ts | 10 +-- lib/array/initial/method.ts | 3 + lib/array/initial/{test.js => test.ts} | 8 +- lib/array/intersect/index.ts | 12 ++- lib/array/intersect/method.ts | 7 ++ lib/array/intersect/{test.js => test.ts} | 8 +- lib/array/isInstance/index.ts | 6 +- lib/array/isInstance/method.ts | 3 + lib/array/isInstance/{test.js => test.ts} | 12 +-- lib/array/last/index.ts | 10 +-- lib/array/last/method.ts | 3 + lib/array/last/{test.js => test.ts} | 8 +- lib/array/max/index.ts | 26 ++----- lib/array/max/method.ts | 21 +++++ lib/array/max/test.js | 15 ---- lib/array/max/test.ts | 15 ++++ lib/array/median/index.ts | 38 ++------- lib/array/median/method.ts | 31 ++++++++ lib/array/median/test.js | 11 --- lib/array/median/test.ts | 11 +++ lib/array/min/index.ts | 26 ++----- lib/array/min/method.ts | 21 +++++ lib/array/min/test.js | 15 ---- lib/array/min/test.ts | 15 ++++ lib/array/pad/index.ts | 18 ++--- lib/array/pad/method.ts | 13 ++++ lib/array/pad/{test.js => test.ts} | 12 +-- lib/array/partition/index.ts | 21 +++-- lib/array/partition/method.ts | 11 +++ lib/array/partition/test.js | 7 -- lib/array/partition/test.ts | 10 +++ lib/array/pluck/index.ts | 16 ++-- lib/array/pluck/method.ts | 11 +++ lib/array/pluck/test.js | 11 --- lib/array/pluck/test.ts | 13 ++++ lib/array/prepend/index.ts | 14 ++-- lib/array/prepend/method.ts | 9 +++ lib/array/prepend/{test.js => test.ts} | 16 ++-- lib/array/pull/index.ts | 15 ++-- lib/array/pull/method.ts | 9 +++ lib/array/pull/test.js | 13 ---- lib/array/pull/test.ts | 16 ++++ lib/array/range/index.ts | 9 ++- lib/array/range/method.ts | 5 ++ lib/array/range/test.js | 15 ---- lib/array/range/test.ts | 15 ++++ lib/array/repeat/index.ts | 6 +- lib/array/repeat/method.ts | 3 + lib/array/repeat/test.js | 7 -- lib/array/repeat/test.ts | 7 ++ lib/array/sample/index.ts | 10 +-- lib/array/sample/method.ts | 5 ++ lib/array/sample/test.js | 7 -- lib/array/sample/test.ts | 7 ++ lib/array/shuffle/index.ts | 21 ++--- lib/array/shuffle/method.ts | 12 +++ lib/array/shuffle/{test.js => test.ts} | 8 +- lib/array/sum/index.ts | 44 ++++------- lib/array/sum/method.ts | 18 +++++ lib/array/sum/test.js | 15 ---- lib/array/sum/test.ts | 15 ++++ lib/array/tail/index.ts | 10 +-- lib/array/tail/method.ts | 3 + lib/array/tail/{test.js => test.ts} | 8 +- lib/array/union/index.ts | 10 +-- lib/array/union/method.ts | 3 + lib/array/union/{test.js => test.ts} | 8 +- lib/array/zip/index.ts | 16 ++-- lib/array/zip/method.ts | 9 +++ lib/array/zip/test.js | 11 --- lib/array/zip/test.ts | 11 +++ lib/array/zipObject/index.ts | 10 +-- lib/array/zipObject/method.ts | 5 ++ lib/array/zipObject/test.js | 11 --- lib/array/zipObject/test.ts | 11 +++ lib/boolean/index.ts | 2 +- lib/boolean/isInstance/index.ts | 6 +- lib/boolean/isInstance/method.ts | 3 + lib/boolean/isInstance/test.js | 13 ---- lib/boolean/isInstance/test.ts | 13 ++++ lib/date/index.ts | 2 +- lib/date/isInstance/index.ts | 6 +- lib/date/isInstance/method.ts | 3 + lib/date/isInstance/test.js | 13 ---- lib/date/isInstance/test.ts | 13 ++++ lib/function/cache/index.ts | 27 ++----- lib/function/cache/method.ts | 16 ++++ lib/function/cache/test.ts | 8 ++ lib/function/defer/index.ts | 10 +-- lib/function/defer/method.ts | 4 + lib/function/index.ts | 8 +- lib/function/isInstance/index.ts | 7 +- lib/function/isInstance/method.ts | 4 + lib/function/isInstance/{test.js => test.ts} | 12 +-- lib/function/once/index.ts | 16 ++-- lib/function/once/method.ts | 10 +++ lib/index.ts | 16 ++-- lib/math/average/index.ts | 10 +-- lib/math/average/method.ts | 5 ++ lib/math/average/{test.js => test.ts} | 8 +- lib/math/factorial/index.ts | 6 +- lib/math/factorial/method.ts | 3 + lib/math/factorial/{test.js => test.ts} | 8 +- lib/math/fibonacci/index.ts | 9 +-- lib/math/fibonacci/method.ts | 6 ++ lib/math/fibonacci/{test.js => test.ts} | 8 +- lib/math/gcd/index.ts | 10 +-- lib/math/gcd/method.ts | 7 ++ lib/math/gcd/{test.js => test.ts} | 8 +- lib/math/index.ts | 14 ++-- lib/math/isEven/index.ts | 7 +- lib/math/isEven/method.ts | 3 + lib/math/isEven/{test.js => test.ts} | 8 +- lib/math/isPrime/index.ts | 12 +-- lib/math/isPrime/method.ts | 10 +++ lib/math/isPrime/{test.js => test.ts} | 8 +- lib/math/lcm/index.ts | 12 +-- lib/math/lcm/method.ts | 9 +++ lib/math/lcm/{test.js => test.ts} | 8 +- lib/number/index.ts | 2 +- lib/number/isInstance/index.ts | 6 +- lib/number/isInstance/method.ts | 3 + lib/number/isInstance/test.js | 13 ---- lib/number/isInstance/test.ts | 13 ++++ lib/object/index.ts | 14 ++-- lib/object/invert/index.ts | 19 ++--- lib/object/invert/method.ts | 9 +++ lib/object/invert/test.js | 8 -- lib/object/invert/test.ts | 8 ++ lib/object/isInstance/index.ts | 6 +- lib/object/isInstance/method.ts | 3 + lib/object/isInstance/test.js | 11 --- lib/object/isInstance/test.ts | 11 +++ lib/object/lowerCaseKeys/index.ts | 21 ++--- lib/object/lowerCaseKeys/method.ts | 9 +++ lib/object/lowerCaseKeys/test.js | 7 -- lib/object/lowerCaseKeys/test.ts | 8 ++ lib/object/map/index.ts | 24 +++--- lib/object/map/method.ts | 9 +++ lib/object/map/test.js | 7 -- lib/object/map/test.ts | 11 +++ lib/object/mapKeys/index.ts | 20 ++--- lib/object/mapKeys/method.ts | 9 +++ lib/object/mapKeys/{test.js => test.ts} | 8 +- lib/object/merge/index.ts | 27 ++----- lib/object/merge/method.ts | 15 ++++ lib/object/merge/test.js | 8 -- lib/object/merge/test.ts | 11 +++ lib/object/size/index.ts | 13 ++-- lib/object/size/method.ts | 3 + lib/object/size/{test.js => test.ts} | 8 +- lib/object/utils.ts | 14 ++-- lib/string/base64/index.ts | 10 +-- lib/string/base64/method.ts | 3 + lib/string/base64/test.js | 8 -- lib/string/base64/test.ts | 8 ++ lib/string/base64Decode/index.ts | 12 +-- lib/string/base64Decode/method.ts | 3 + lib/string/base64Decode/test.js | 8 -- lib/string/base64Decode/test.ts | 8 ++ lib/string/camelCase/index.ts | 23 +++--- lib/string/camelCase/method.ts | 9 +++ lib/string/camelCase/test.js | 23 ------ lib/string/camelCase/test.ts | 24 ++++++ lib/string/capitalize/index.ts | 12 ++- lib/string/capitalize/method.ts | 7 ++ lib/string/capitalize/test.js | 13 ---- lib/string/capitalize/test.ts | 13 ++++ lib/string/chars/index.ts | 12 +-- lib/string/chars/method.ts | 3 + lib/string/chars/test.js | 8 -- lib/string/chars/test.ts | 8 ++ lib/string/contains/index.ts | 12 ++- lib/string/contains/method.ts | 7 ++ lib/string/contains/test.js | 13 ---- lib/string/contains/test.ts | 13 ++++ lib/string/decapitalize/index.ts | 12 ++- lib/string/decapitalize/method.ts | 7 ++ lib/string/decapitalize/test.js | 13 ---- lib/string/decapitalize/test.ts | 13 ++++ lib/string/humanize/index.ts | 15 ++-- lib/string/humanize/method.ts | 5 ++ lib/string/humanize/test.js | 8 -- lib/string/humanize/test.ts | 11 +++ lib/string/index.ts | 38 ++++----- lib/string/isInstance/index.ts | 8 +- lib/string/isInstance/method.ts | 3 + lib/string/isInstance/test.js | 13 ---- lib/string/isInstance/test.ts | 13 ++++ lib/string/kebabCase/index.ts | 26 +++---- lib/string/kebabCase/method.ts | 5 ++ lib/string/kebabCase/test.js | 28 ------- lib/string/kebabCase/test.ts | 32 ++++++++ lib/string/lines/index.ts | 10 +-- lib/string/lines/method.ts | 3 + lib/string/lines/test.js | 8 -- lib/string/lines/test.ts | 9 +++ lib/string/map/index.ts | 6 +- lib/string/map/method.ts | 8 +- lib/string/map/test.js | 8 -- lib/string/map/test.ts | 8 ++ lib/string/mask/index.ts | 10 +-- lib/string/mask/method.ts | 3 + lib/string/mask/test.js | 18 ----- lib/string/mask/test.ts | 18 +++++ lib/string/pluralize/index.ts | 8 +- lib/string/pluralize/method.ts | 4 +- lib/string/pluralize/test.js | 23 ------ lib/string/pluralize/test.ts | 23 ++++++ lib/string/reverse/index.ts | 12 +-- lib/string/reverse/method.ts | 3 + lib/string/reverse/test.js | 8 -- lib/string/reverse/test.ts | 8 ++ lib/string/snakeCase/index.ts | 20 +++-- lib/string/snakeCase/method.ts | 5 ++ lib/string/snakeCase/test.js | 28 ------- lib/string/snakeCase/test.ts | 34 ++++++++ lib/string/swapCase/index.ts | 10 +-- lib/string/swapCase/method.ts | 3 + lib/string/swapCase/test.js | 8 -- lib/string/swapCase/test.ts | 8 ++ lib/string/truncate/index.ts | 12 ++- lib/string/truncate/method.ts | 7 ++ lib/string/truncate/test.js | 13 ---- lib/string/truncate/test.ts | 13 ++++ lib/string/words/index.ts | 10 +-- lib/string/words/method.ts | 3 + lib/string/words/test.js | 13 ---- lib/string/words/test.ts | 13 ++++ package-lock.json | 8 +- package.json | 8 +- 279 files changed, 1667 insertions(+), 1387 deletions(-) create mode 100644 lib/array/deepFlatten/method.ts rename lib/array/deepFlatten/{test.js => test.ts} (50%) create mode 100644 lib/array/diff/method.ts rename lib/array/diff/{test.js => test.ts} (65%) create mode 100644 lib/array/distinct/method.ts rename lib/array/distinct/{test.js => test.ts} (50%) create mode 100644 lib/array/everyNth/method.ts rename lib/array/everyNth/{test.js => test.ts} (68%) create mode 100644 lib/array/first/method.ts rename lib/array/first/{test.js => test.ts} (52%) create mode 100644 lib/array/flatten/method.ts rename lib/array/flatten/{test.js => test.ts} (66%) create mode 100644 lib/array/get/method.ts delete mode 100644 lib/array/get/test.js create mode 100644 lib/array/get/test.ts create mode 100644 lib/array/groupBy/method.ts delete mode 100644 lib/array/groupBy/test.js create mode 100644 lib/array/groupBy/test.ts create mode 100644 lib/array/implode/method.ts delete mode 100644 lib/array/implode/test.js create mode 100644 lib/array/implode/test.ts create mode 100644 lib/array/indexOfAll/method.ts rename lib/array/indexOfAll/{test.js => test.ts} (50%) create mode 100644 lib/array/initial/method.ts rename lib/array/initial/{test.js => test.ts} (51%) create mode 100644 lib/array/intersect/method.ts rename lib/array/intersect/{test.js => test.ts} (50%) create mode 100644 lib/array/isInstance/method.ts rename lib/array/isInstance/{test.js => test.ts} (50%) create mode 100644 lib/array/last/method.ts rename lib/array/last/{test.js => test.ts} (52%) create mode 100644 lib/array/max/method.ts delete mode 100644 lib/array/max/test.js create mode 100644 lib/array/max/test.ts create mode 100644 lib/array/median/method.ts delete mode 100644 lib/array/median/test.js create mode 100644 lib/array/median/test.ts create mode 100644 lib/array/min/method.ts delete mode 100644 lib/array/min/test.js create mode 100644 lib/array/min/test.ts create mode 100644 lib/array/pad/method.ts rename lib/array/pad/{test.js => test.ts} (50%) create mode 100644 lib/array/partition/method.ts delete mode 100644 lib/array/partition/test.js create mode 100644 lib/array/partition/test.ts create mode 100644 lib/array/pluck/method.ts delete mode 100644 lib/array/pluck/test.js create mode 100644 lib/array/pluck/test.ts create mode 100644 lib/array/prepend/method.ts rename lib/array/prepend/{test.js => test.ts} (50%) create mode 100644 lib/array/pull/method.ts delete mode 100644 lib/array/pull/test.js create mode 100644 lib/array/pull/test.ts create mode 100644 lib/array/range/method.ts delete mode 100644 lib/array/range/test.js create mode 100644 lib/array/range/test.ts create mode 100644 lib/array/repeat/method.ts delete mode 100644 lib/array/repeat/test.js create mode 100644 lib/array/repeat/test.ts create mode 100644 lib/array/sample/method.ts delete mode 100644 lib/array/sample/test.js create mode 100644 lib/array/sample/test.ts create mode 100644 lib/array/shuffle/method.ts rename lib/array/shuffle/{test.js => test.ts} (76%) create mode 100644 lib/array/sum/method.ts delete mode 100644 lib/array/sum/test.js create mode 100644 lib/array/sum/test.ts create mode 100644 lib/array/tail/method.ts rename lib/array/tail/{test.js => test.ts} (51%) create mode 100644 lib/array/union/method.ts rename lib/array/union/{test.js => test.ts} (50%) create mode 100644 lib/array/zip/method.ts delete mode 100644 lib/array/zip/test.js create mode 100644 lib/array/zip/test.ts create mode 100644 lib/array/zipObject/method.ts delete mode 100644 lib/array/zipObject/test.js create mode 100644 lib/array/zipObject/test.ts create mode 100644 lib/boolean/isInstance/method.ts delete mode 100644 lib/boolean/isInstance/test.js create mode 100644 lib/boolean/isInstance/test.ts create mode 100644 lib/date/isInstance/method.ts delete mode 100644 lib/date/isInstance/test.js create mode 100644 lib/date/isInstance/test.ts create mode 100644 lib/function/cache/method.ts create mode 100644 lib/function/cache/test.ts create mode 100644 lib/function/defer/method.ts create mode 100644 lib/function/isInstance/method.ts rename lib/function/isInstance/{test.js => test.ts} (71%) create mode 100644 lib/function/once/method.ts create mode 100644 lib/math/average/method.ts rename lib/math/average/{test.js => test.ts} (66%) create mode 100644 lib/math/factorial/method.ts rename lib/math/factorial/{test.js => test.ts} (64%) create mode 100644 lib/math/fibonacci/method.ts rename lib/math/fibonacci/{test.js => test.ts} (61%) create mode 100644 lib/math/gcd/method.ts rename lib/math/gcd/{test.js => test.ts} (68%) create mode 100644 lib/math/isEven/method.ts rename lib/math/isEven/{test.js => test.ts} (62%) create mode 100644 lib/math/isPrime/method.ts rename lib/math/isPrime/{test.js => test.ts} (63%) create mode 100644 lib/math/lcm/method.ts rename lib/math/lcm/{test.js => test.ts} (64%) create mode 100644 lib/number/isInstance/method.ts delete mode 100644 lib/number/isInstance/test.js create mode 100644 lib/number/isInstance/test.ts create mode 100644 lib/object/invert/method.ts delete mode 100644 lib/object/invert/test.js create mode 100644 lib/object/invert/test.ts create mode 100644 lib/object/isInstance/method.ts delete mode 100644 lib/object/isInstance/test.js create mode 100644 lib/object/isInstance/test.ts create mode 100644 lib/object/lowerCaseKeys/method.ts delete mode 100644 lib/object/lowerCaseKeys/test.js create mode 100644 lib/object/lowerCaseKeys/test.ts create mode 100644 lib/object/map/method.ts delete mode 100644 lib/object/map/test.js create mode 100644 lib/object/map/test.ts create mode 100644 lib/object/mapKeys/method.ts rename lib/object/mapKeys/{test.js => test.ts} (74%) create mode 100644 lib/object/merge/method.ts delete mode 100644 lib/object/merge/test.js create mode 100644 lib/object/merge/test.ts create mode 100644 lib/object/size/method.ts rename lib/object/size/{test.js => test.ts} (72%) create mode 100644 lib/string/base64/method.ts delete mode 100644 lib/string/base64/test.js create mode 100644 lib/string/base64/test.ts create mode 100644 lib/string/base64Decode/method.ts delete mode 100644 lib/string/base64Decode/test.js create mode 100644 lib/string/base64Decode/test.ts create mode 100644 lib/string/camelCase/method.ts delete mode 100644 lib/string/camelCase/test.js create mode 100644 lib/string/camelCase/test.ts create mode 100644 lib/string/capitalize/method.ts delete mode 100644 lib/string/capitalize/test.js create mode 100644 lib/string/capitalize/test.ts create mode 100644 lib/string/chars/method.ts delete mode 100644 lib/string/chars/test.js create mode 100644 lib/string/chars/test.ts create mode 100644 lib/string/contains/method.ts delete mode 100644 lib/string/contains/test.js create mode 100644 lib/string/contains/test.ts create mode 100644 lib/string/decapitalize/method.ts delete mode 100644 lib/string/decapitalize/test.js create mode 100644 lib/string/decapitalize/test.ts create mode 100644 lib/string/humanize/method.ts delete mode 100644 lib/string/humanize/test.js create mode 100644 lib/string/humanize/test.ts create mode 100644 lib/string/isInstance/method.ts delete mode 100644 lib/string/isInstance/test.js create mode 100644 lib/string/isInstance/test.ts create mode 100644 lib/string/kebabCase/method.ts delete mode 100644 lib/string/kebabCase/test.js create mode 100644 lib/string/kebabCase/test.ts create mode 100644 lib/string/lines/method.ts delete mode 100644 lib/string/lines/test.js create mode 100644 lib/string/lines/test.ts delete mode 100644 lib/string/map/test.js create mode 100644 lib/string/map/test.ts create mode 100644 lib/string/mask/method.ts delete mode 100644 lib/string/mask/test.js create mode 100644 lib/string/mask/test.ts delete mode 100644 lib/string/pluralize/test.js create mode 100644 lib/string/pluralize/test.ts create mode 100644 lib/string/reverse/method.ts delete mode 100644 lib/string/reverse/test.js create mode 100644 lib/string/reverse/test.ts create mode 100644 lib/string/snakeCase/method.ts delete mode 100644 lib/string/snakeCase/test.js create mode 100644 lib/string/snakeCase/test.ts create mode 100644 lib/string/swapCase/method.ts delete mode 100644 lib/string/swapCase/test.js create mode 100644 lib/string/swapCase/test.ts create mode 100644 lib/string/truncate/method.ts delete mode 100644 lib/string/truncate/test.js create mode 100644 lib/string/truncate/test.ts create mode 100644 lib/string/words/method.ts delete mode 100644 lib/string/words/test.js create mode 100644 lib/string/words/test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 6868cc0e..5dd51b8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [next](https://github.com/ardalanamini/prototyped.js/releases/tag/next) *(2018-__-__)* +## [v0.5.0](https://github.com/ardalanamini/prototyped.js/releases/tag/v0.5.0) *(2018-04-13)* **Implemented enhancements:** - `Array.prototype` - function `all` added @@ -18,6 +18,9 @@ - function `pluralize` improved - some general enhancements +**Fixed bugs:** +- typescript usage + ## [v0.4.0](https://github.com/ardalanamini/prototyped.js/releases/tag/v0.4.0) *(2018-01-28)* **Implemented enhancements:** diff --git a/README.md b/README.md index aefc5a51..8f56140a 100644 --- a/README.md +++ b/README.md @@ -90,3 +90,11 @@ console.log(words('hello world!')); // ['hello', 'world'] ``` All documents are available at [API.md](https://github.com/ardalanamini/prototyped.js/blob/master/API.md) + +## Support + +If my work helps you, please consider + + + Buy Me A Coffee + diff --git a/lib/array/all/index.ts b/lib/array/all/index.ts index dd8806ef..cebd2743 100644 --- a/lib/array/all/index.ts +++ b/lib/array/all/index.ts @@ -1,7 +1,5 @@ import * as method from "./method"; -export {}; - declare global { interface Array { all(fn?: (value: T, index: number, array: T[]) => boolean): boolean; diff --git a/lib/array/any/index.ts b/lib/array/any/index.ts index e7275106..8ff0dc1a 100644 --- a/lib/array/any/index.ts +++ b/lib/array/any/index.ts @@ -1,7 +1,5 @@ import * as method from "./method"; -export { }; - declare global { interface Array { any(fn?: (value: T, index: number, array: T[]) => boolean): boolean; diff --git a/lib/array/append/index.ts b/lib/array/append/index.ts index 5d7ac264..b3cfcfa8 100644 --- a/lib/array/append/index.ts +++ b/lib/array/append/index.ts @@ -1,7 +1,5 @@ import * as method from "./method"; -export { }; - declare global { interface Array { append(value: T): void; diff --git a/lib/array/average/index.ts b/lib/array/average/index.ts index 1be9270a..e306f505 100644 --- a/lib/array/average/index.ts +++ b/lib/array/average/index.ts @@ -1,7 +1,5 @@ import * as method from "./method"; -export { }; - declare global { interface Array { average(key?: string): number; diff --git a/lib/array/average/method.ts b/lib/array/average/method.ts index fa2589d5..6e0c9f42 100644 --- a/lib/array/average/method.ts +++ b/lib/array/average/method.ts @@ -1,15 +1,5 @@ -const method = (arr: any[], key?: string) => { - if (key) { - const keys = key.split("."); +import * as sum from "../sum/method"; - return arr.map((item) => { - keys.map((k) => item = (item && item[k]) || 0); - - return item; - }).reduce((acc, val) => acc + val, 0) / arr.length; - } - - return arr.reduce((acc, val) => acc + val, 0) / arr.length; -}; +const method = (arr: any[], key?: string) => sum(arr, key) / arr.length; export = method; diff --git a/lib/array/chunk/index.ts b/lib/array/chunk/index.ts index 2202e02f..e0222ccb 100644 --- a/lib/array/chunk/index.ts +++ b/lib/array/chunk/index.ts @@ -1,7 +1,5 @@ import * as method from "./method"; -export { }; - declare global { interface Array { chunk(size: number): T[][]; diff --git a/lib/array/clone/index.ts b/lib/array/clone/index.ts index fe247767..d06cb17f 100644 --- a/lib/array/clone/index.ts +++ b/lib/array/clone/index.ts @@ -1,7 +1,5 @@ import * as method from "./method"; -export { }; - declare global { interface Array { clone(): T[]; diff --git a/lib/array/compact/index.ts b/lib/array/compact/index.ts index 8d52a527..04b275b3 100644 --- a/lib/array/compact/index.ts +++ b/lib/array/compact/index.ts @@ -1,7 +1,5 @@ import * as method from "./method"; -export { }; - declare global { interface Array { compact(): T[]; diff --git a/lib/array/contains/index.ts b/lib/array/contains/index.ts index 3dfb4f54..55c2580e 100644 --- a/lib/array/contains/index.ts +++ b/lib/array/contains/index.ts @@ -1,7 +1,5 @@ import * as method from "./method"; -export { }; - declare global { interface Array { contains(value: any): boolean; diff --git a/lib/array/count/index.ts b/lib/array/count/index.ts index cccf5230..d245b72b 100644 --- a/lib/array/count/index.ts +++ b/lib/array/count/index.ts @@ -1,7 +1,5 @@ import * as method from "./method"; -export { }; - declare global { interface Array { count(value?: T): number; diff --git a/lib/array/countBy/index.ts b/lib/array/countBy/index.ts index 60d47bb0..39fb430d 100644 --- a/lib/array/countBy/index.ts +++ b/lib/array/countBy/index.ts @@ -1,7 +1,5 @@ import * as method from "./method"; -export { }; - declare global { interface Array { countBy(fn: string | ((value: any) => any)): { [key: string]: any }; diff --git a/lib/array/crossJoin/index.ts b/lib/array/crossJoin/index.ts index 211bdfee..5a0d6b24 100644 --- a/lib/array/crossJoin/index.ts +++ b/lib/array/crossJoin/index.ts @@ -1,7 +1,5 @@ import * as method from "./method"; -export { }; - declare global { interface Array { crossJoin(array: any[]): Array<[T, any]>; diff --git a/lib/array/deepFlatten/index.ts b/lib/array/deepFlatten/index.ts index e60721c8..acbe9e87 100644 --- a/lib/array/deepFlatten/index.ts +++ b/lib/array/deepFlatten/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - deepFlatten(): Array + deepFlatten(): any[]; } } @@ -13,8 +13,6 @@ declare global { * @example * [1, [2], [[3], 4], 5].deepFlatten(); // [1,2,3,4,5] */ -Array.prototype.deepFlatten = function(): Array { - const _deepFlatten: (arr: Array) => Array = (arr) => [].concat(...arr.map(v => (Array.isArray(v) ? _deepFlatten(v) : v))) - - return _deepFlatten(this) -} +Array.prototype.deepFlatten = function() { + return method(this); +}; diff --git a/lib/array/deepFlatten/method.ts b/lib/array/deepFlatten/method.ts new file mode 100644 index 00000000..ddbf1007 --- /dev/null +++ b/lib/array/deepFlatten/method.ts @@ -0,0 +1,3 @@ +const method = (arr: any[]): any[] => [].concat(...arr.map((v) => (Array.isArray(v) ? method(v) : v))); + +export = method; diff --git a/lib/array/deepFlatten/test.js b/lib/array/deepFlatten/test.ts similarity index 50% rename from lib/array/deepFlatten/test.js rename to lib/array/deepFlatten/test.ts index c052832d..903957c2 100644 --- a/lib/array/deepFlatten/test.js +++ b/lib/array/deepFlatten/test.ts @@ -1,7 +1,7 @@ -require('../../../es6/array/deepFlatten') +import "./index"; describe("Array.prototype.deepFlatten", () => { test("[1, [2], [[3], 4], 5].deepFlatten() returns [1,2,3,4,5]", () => { - expect([1, [2], [[3], 4], 5].deepFlatten()).toEqual([1,2,3,4,5]) - }) -}) + expect([1, [2], [[3], 4], 5].deepFlatten()).toEqual([1, 2, 3, 4, 5]); + }); +}); diff --git a/lib/array/diff/index.ts b/lib/array/diff/index.ts index 6558a98b..d9036072 100644 --- a/lib/array/diff/index.ts +++ b/lib/array/diff/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - diff(array: Array, comp?: (a: T, b: any) => boolean): Array + diff(array: any[], comp?: (a: T, b: any) => boolean): T[]; } } @@ -17,10 +17,6 @@ declare global { * [1, 2, 3].diff([1, 2, 4]); // [3] * [1, 1.2, 1.5, 3, 0].diff([1.9, 3, 0], (a, b) => Math.round(a) === Math.round(b)); // [1, 1.2] */ -Array.prototype.diff = function(array: Array, comp?: (a: any, b: any) => boolean): Array { - if (comp) return this.filter((a) => array.findIndex((b) => comp(a, b)) === -1) - - const set = new Set(array) - - return this.filter((item: any) => !set.has(item)) -} +Array.prototype.diff = function(array, comp) { + return method(this, array, comp); +}; diff --git a/lib/array/diff/method.ts b/lib/array/diff/method.ts new file mode 100644 index 00000000..8269b4bf --- /dev/null +++ b/lib/array/diff/method.ts @@ -0,0 +1,9 @@ +const method = (arr: any[], array: any[], comp?: (a: any, b: any) => boolean): any[] => { + if (comp) return arr.filter((a) => array.findIndex((b) => comp(a, b)) === -1); + + const set = new Set(array); + + return arr.filter((item: any) => !set.has(item)); +}; + +export = method; diff --git a/lib/array/diff/test.js b/lib/array/diff/test.ts similarity index 65% rename from lib/array/diff/test.js rename to lib/array/diff/test.ts index 0015bb08..d5266ab9 100644 --- a/lib/array/diff/test.js +++ b/lib/array/diff/test.ts @@ -1,11 +1,12 @@ -require('../../../es6/array/diff') +import "./index"; describe("Array.prototype.diff", () => { test("[1, 2, 3].diff([1, 2, 4]) returns [3]", () => { - expect([1, 2, 3].diff([1, 2, 4])).toEqual([3]) - }) + expect([1, 2, 3].diff([1, 2, 4])).toEqual([3]); + }); test("[1, 1.2, 1.5, 3, 0].diff([1.9, 3, 0], (a, b) => Math.round(a) === Math.round(b)) returns [1, 1.2]", () => { - expect([1, 1.2, 1.5, 3, 0].diff([1.9, 3, 0], (a, b) => Math.round(a) === Math.round(b))).toEqual([1, 1.2]) - }) -}) + expect([1, 1.2, 1.5, 3, 0].diff([1.9, 3, 0], (a, b) => Math.round(a) === Math.round(b))) + .toEqual([1, 1.2]); + }); +}); diff --git a/lib/array/distinct/index.ts b/lib/array/distinct/index.ts index 23a1451c..30eb1995 100644 --- a/lib/array/distinct/index.ts +++ b/lib/array/distinct/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - distinct(): Array + distinct(): T[]; } } @@ -13,6 +13,6 @@ declare global { * @example * [1, 2, 2, 3, 4, 4, 5].distinct(); // [1,2,3,4,5] */ -Array.prototype.distinct = function(): Array { - return [...new Set(this)] -} +Array.prototype.distinct = function() { + return method(this); +}; diff --git a/lib/array/distinct/method.ts b/lib/array/distinct/method.ts new file mode 100644 index 00000000..a6665744 --- /dev/null +++ b/lib/array/distinct/method.ts @@ -0,0 +1,3 @@ +const method = (arr: any[]) => [...new Set(arr)]; + +export = method; diff --git a/lib/array/distinct/test.js b/lib/array/distinct/test.ts similarity index 50% rename from lib/array/distinct/test.js rename to lib/array/distinct/test.ts index 5f16e717..5a1c0a01 100644 --- a/lib/array/distinct/test.js +++ b/lib/array/distinct/test.ts @@ -1,7 +1,7 @@ -require('../../../es6/array/distinct') +import "./index"; describe("Array.prototype.distinct", () => { test("[1, 2, 2, 3, 4, 4, 5].distinct() returns [1,2,3,4,5]", () => { - expect([1, 2, 2, 3, 4, 4, 5].distinct()).toEqual([1,2,3,4,5]) - }) -}) + expect([1, 2, 2, 3, 4, 4, 5].distinct()).toEqual([1, 2, 3, 4, 5]); + }); +}); diff --git a/lib/array/everyNth/index.ts b/lib/array/everyNth/index.ts index f6e2994a..ba9bcfd3 100644 --- a/lib/array/everyNth/index.ts +++ b/lib/array/everyNth/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - everyNth(nth: number): Array + everyNth(nth: number): T[]; } } @@ -13,6 +13,6 @@ declare global { * @example * [1, 2, 3, 4, 5, 6].everyNth(2); // [ 2, 4, 6 ] */ -Array.prototype.everyNth = function(nth: number): Array { - return this.filter((e, i) => i % nth === nth - 1) -} +Array.prototype.everyNth = function(nth) { + return method(this, nth); +}; diff --git a/lib/array/everyNth/method.ts b/lib/array/everyNth/method.ts new file mode 100644 index 00000000..9e1273a9 --- /dev/null +++ b/lib/array/everyNth/method.ts @@ -0,0 +1,3 @@ +const method = (arr: any[], nth: number) => arr.filter((e, i) => i % nth === nth - 1); + +export = method; diff --git a/lib/array/everyNth/test.js b/lib/array/everyNth/test.ts similarity index 68% rename from lib/array/everyNth/test.js rename to lib/array/everyNth/test.ts index f0220719..516ff312 100644 --- a/lib/array/everyNth/test.js +++ b/lib/array/everyNth/test.ts @@ -1,8 +1,8 @@ -require('../../../es6/array/everyNth') +import "./index"; describe("Array.prototype.everyNth", () => { test("[1, 2, 3, 4, 5, 6].everyNth() returns [ 2, 4, 6 ]", () => { expect([1, 2, 3, 4, 5, 6].everyNth(2)) - .toEqual([2,4,6]) - }) -}) + .toEqual([2, 4, 6]); + }); +}); diff --git a/lib/array/first/index.ts b/lib/array/first/index.ts index 6d05ba73..13b51bf7 100644 --- a/lib/array/first/index.ts +++ b/lib/array/first/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - first(): T + first(): T; } } @@ -13,6 +13,6 @@ declare global { * @example * [1, 2, 3].first(); // 1 */ -Array.prototype.first = function(): any { - return this[0] -} +Array.prototype.first = function() { + return method(this); +}; diff --git a/lib/array/first/method.ts b/lib/array/first/method.ts new file mode 100644 index 00000000..2a6f1876 --- /dev/null +++ b/lib/array/first/method.ts @@ -0,0 +1,3 @@ +const method = (arr: any[]) => arr[0]; + +export = method; diff --git a/lib/array/first/test.js b/lib/array/first/test.ts similarity index 52% rename from lib/array/first/test.js rename to lib/array/first/test.ts index 670e9336..d5a24fd6 100644 --- a/lib/array/first/test.js +++ b/lib/array/first/test.ts @@ -1,7 +1,7 @@ -require('../../../es6/array/first') +import "./index"; describe("Array.prototype.first", () => { test("[1, 2, 3].first() returns 1", () => { - expect([1,2,3].first()).toBe(1) - }) -}) + expect([1, 2, 3].first()).toBe(1); + }); +}); diff --git a/lib/array/flatten/index.ts b/lib/array/flatten/index.ts index 2accee35..6ca1f56d 100644 --- a/lib/array/flatten/index.ts +++ b/lib/array/flatten/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - flatten(depth?: number): Array + flatten(depth?: number): any[]; } } @@ -15,11 +15,6 @@ declare global { * [1, [2], 3, 4].flatten(); // [1, 2, 3, 4] * [1, [2, [3, [4, 5], 6], 7], 8].flatten(2); // [1, 2, 3, [4, 5], 6, 7, 8] */ -Array.prototype.flatten = function(depth = 1): Array { - const _flatten: (arr: Array, depth?: number) => Array = (arr, depth = 1) => - depth != 1 - ? arr.reduce((a, v) => a.concat(Array.isArray(v) ? _flatten(v, depth - 1) : v), []) - : arr.reduce((a, v) => a.concat(v), []) - - return _flatten(this, depth) -} +Array.prototype.flatten = function(depth) { + return method(this, depth); +}; diff --git a/lib/array/flatten/method.ts b/lib/array/flatten/method.ts new file mode 100644 index 00000000..78dfd857 --- /dev/null +++ b/lib/array/flatten/method.ts @@ -0,0 +1,5 @@ +const method = (arr: any[], depth: number = 1): any[] => depth !== 1 ? + arr.reduce((a, v) => a.concat(Array.isArray(v) ? method(v, depth - 1) : v), []) : + arr.reduce((a, v) => a.concat(v), []); + +export = method; diff --git a/lib/array/flatten/test.js b/lib/array/flatten/test.ts similarity index 66% rename from lib/array/flatten/test.js rename to lib/array/flatten/test.ts index 8921c7c9..242718e0 100644 --- a/lib/array/flatten/test.js +++ b/lib/array/flatten/test.ts @@ -1,11 +1,11 @@ -require('../../../es6/array/flatten') +import "./index"; describe("Array.prototype.flatten", () => { test("[1, [2], 3, 4].flatten() returns [1, 2, 3, 4]", () => { - expect([1, [2], 3, 4].flatten()).toEqual([1, 2, 3, 4]) - }) + expect([1, [2], 3, 4].flatten()).toEqual([1, 2, 3, 4]); + }); test("[1, [2, [3, [4, 5], 6], 7], 8].flatten(2) returns [1, 2, 3, [4, 5], 6, 7, 8]", () => { - expect([1, [2, [3, [4, 5], 6], 7], 8].flatten(2)).toEqual([1, 2, 3, [4, 5], 6, 7, 8]) - }) -}) + expect([1, [2, [3, [4, 5], 6], 7], 8].flatten(2)).toEqual([1, 2, 3, [4, 5], 6, 7, 8]); + }); +}); diff --git a/lib/array/get/index.ts b/lib/array/get/index.ts index 01146ba3..031e4d8c 100644 --- a/lib/array/get/index.ts +++ b/lib/array/get/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - get(index: number, def?: any): any + get(index: number, def?: any): T | null; } } @@ -16,8 +16,6 @@ declare global { * [1, 2, 3].get(0, 'default value'); // 1 * [1, 2, 3].get(4, 0); // 0 */ -Array.prototype.get = function(index: number, def = undefined): any { - if (index >= this.length) return def - - return this[index] -} +Array.prototype.get = function(index, def) { + return method(this, index, def); +}; diff --git a/lib/array/get/method.ts b/lib/array/get/method.ts new file mode 100644 index 00000000..808a4003 --- /dev/null +++ b/lib/array/get/method.ts @@ -0,0 +1,7 @@ +const method = (arr: any[], index: number, def = null): any => { + if (index >= arr.length) return def; + + return arr[index]; +}; + +export = method; diff --git a/lib/array/get/test.js b/lib/array/get/test.js deleted file mode 100644 index d2aa2cf7..00000000 --- a/lib/array/get/test.js +++ /dev/null @@ -1,11 +0,0 @@ -require('../../../es6/array/get') - -describe("Array.prototype.get", () => { - test("[1, 2, 3].get(0, 'default value') returns 1", () => { - expect([1, 2, 3].get(0, 'default value')).toBe(1) - }) - - test("[1, 2, 3].get(4, -10) returns 0", () => { - expect([1, 2, 3].get(4, -10)).toBe(-10) - }) -}) diff --git a/lib/array/get/test.ts b/lib/array/get/test.ts new file mode 100644 index 00000000..bd3a17b7 --- /dev/null +++ b/lib/array/get/test.ts @@ -0,0 +1,11 @@ +import "./index"; + +describe("Array.prototype.get", () => { + test("[1, 2, 3].get(0, \"default value\") returns 1", () => { + expect([1, 2, 3].get(0, "default value")).toBe(1); + }); + + test("[1, 2, 3].get(4, -10) returns 0", () => { + expect([1, 2, 3].get(4, -10)).toBe(-10); + }); +}); diff --git a/lib/array/groupBy/index.ts b/lib/array/groupBy/index.ts index 09737dac..31fe2b45 100644 --- a/lib/array/groupBy/index.ts +++ b/lib/array/groupBy/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - groupBy(fn: string | (() => any)): { [key: string]: Array } + groupBy(fn: string | ((item: any, index: number, array: any[]) => any)): { [key: string]: T[] }; } } @@ -15,10 +15,6 @@ declare global { * [6.1, 4.2, 6.3].groupBy(Math.floor); // {4: [4.2], 6: [6.1, 6.3]} * ['one', 'two', 'three'].groupBy('length'); // {3: ['one', 'two'], 5: ['three']} */ -Array.prototype.groupBy = function(fn: string | (() => any)): { [key: string]: any } { - return this.map(typeof fn === 'function' ? fn : val => val[fn]).reduce((acc, val, i) => { - acc[val] = (acc[val] || []).concat(this[i]) - - return acc - }, {}) -} +Array.prototype.groupBy = function(fn) { + return method(this, fn); +}; diff --git a/lib/array/groupBy/method.ts b/lib/array/groupBy/method.ts new file mode 100644 index 00000000..07b537ca --- /dev/null +++ b/lib/array/groupBy/method.ts @@ -0,0 +1,9 @@ +const method = (arr: any[], fn: string | ((item: any, index: number, array: any[]) => any)): { [key: string]: any } => { + return arr.map(typeof fn === "function" ? fn : (val) => val[fn]).reduce((acc, val, i) => { + acc[val] = (acc[val] || []).concat(arr[i]); + + return acc; + }, {}); +}; + +export = method; diff --git a/lib/array/groupBy/test.js b/lib/array/groupBy/test.js deleted file mode 100644 index ce1a8962..00000000 --- a/lib/array/groupBy/test.js +++ /dev/null @@ -1,11 +0,0 @@ -require('../../../es6/array/groupBy') - -describe("Array.prototype.groupBy", () => { - test("[6.1, 4.2, 6.3].groupBy(Math.floor) returns {4: [4.2], 6: [6.1, 6.3]}", () => { - expect([6.1, 4.2, 6.3].groupBy(Math.floor)).toEqual({4: [4.2], 6: [6.1, 6.3]}) - }) - - test("['one', 'two', 'three'].groupBy('length') returns {3: ['one', 'two'], 5: ['three']}", () => { - expect(['one', 'two', 'three'].groupBy('length')).toEqual({3: ['one', 'two'], 5: ['three']}) - }) -}) diff --git a/lib/array/groupBy/test.ts b/lib/array/groupBy/test.ts new file mode 100644 index 00000000..a5d9b116 --- /dev/null +++ b/lib/array/groupBy/test.ts @@ -0,0 +1,13 @@ +import "./index"; + +describe("Array.prototype.groupBy", () => { + test("[6.1, 4.2, 6.3].groupBy(Math.floor) returns {4: [4.2], 6: [6.1, 6.3]}", () => { + expect([6.1, 4.2, 6.3].groupBy(Math.floor)) + .toEqual({ 4: [4.2], 6: [6.1, 6.3] }); + }); + + test("[\"one\", \"two\", \"three\"].groupBy(\"length\") returns {3: [\"one\", \"two\"], 5: [\"three\"]}", () => { + expect(["one", "two", "three"].groupBy("length")) + .toEqual({ 3: ["one", "two"], 5: ["three"] }); + }); +}); diff --git a/lib/array/implode/index.ts b/lib/array/implode/index.ts index 828ad294..1ecae9b4 100644 --- a/lib/array/implode/index.ts +++ b/lib/array/implode/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - implode(key: string, separator?: string): string + implode(key: string, separator?: string): string; } } @@ -15,15 +15,6 @@ declare global { * @example * [{a: {b: 'first'}}, {a: {b: 'second'}}, {a: {b: 'third'}}].implode('a.b', ', '); // 'first, second, third' */ -Array.prototype.implode = function(key: string, separator = ', '): string { - let keys = key.split('.') - let array: Array = [] - - this.map((item) => { - keys.map((k) => item = item && item[k] || undefined) - - array.push(item) - }) - - return array.filter(Boolean).join(separator) -} +Array.prototype.implode = function(key, separator) { + return method(this, key, separator); +}; diff --git a/lib/array/implode/method.ts b/lib/array/implode/method.ts new file mode 100644 index 00000000..98c068e1 --- /dev/null +++ b/lib/array/implode/method.ts @@ -0,0 +1,11 @@ +const method = (arr: any[], key: string, separator = ", "): string => { + const keys = key.split("."); + + return arr.map((item) => { + keys.map((k) => item = item && item[k] || undefined); + + return item; + }).filter(Boolean).join(separator); +}; + +export = method; diff --git a/lib/array/implode/test.js b/lib/array/implode/test.js deleted file mode 100644 index be17173e..00000000 --- a/lib/array/implode/test.js +++ /dev/null @@ -1,7 +0,0 @@ -require('../../../es6/array/implode') - -describe("Array.prototype.implode", () => { - test("[{a: {b: 'first'}}, {a: {b: 'second'}}, {a: {b: 'third'}}].implode('a.b', ', ') returns 'first, second, third'", () => { - expect([{a: {b: 'first'}}, {a: {b: 'second'}}, {a: {b: 'third'}}].implode('a.b', ', ')).toBe('first, second, third') - }) -}) diff --git a/lib/array/implode/test.ts b/lib/array/implode/test.ts new file mode 100644 index 00000000..c3c54cde --- /dev/null +++ b/lib/array/implode/test.ts @@ -0,0 +1,11 @@ +import "./index"; + +describe("Array.prototype.implode", () => { + test( + "[{a: {b: \"first\"}}, {a: {b: \"second\"}}, {a: {b: \"third\"}}].implode(\"a.b\", \", \")" + + " returns \"first, second, third\"", + () => { + expect([{ a: { b: "first" } }, { a: { b: "second" } }, { a: { b: "third" } }].implode("a.b", ", ")) + .toBe("first, second, third"); + }); +}); diff --git a/lib/array/index.ts b/lib/array/index.ts index 3594ae16..73204336 100644 --- a/lib/array/index.ts +++ b/lib/array/index.ts @@ -1,42 +1,44 @@ /** @namespace Array */ -import './append' -import './average' -import './chunk' -import './clone' -import './compact' -import './contains' -import './count' -import './countBy' -import './crossJoin' -import './deepFlatten' -import './diff' -import './distinct' -import './everyNth' -import './first' -import './flatten' -import './get' -import './groupBy' -import './implode' -import './indexOfAll' -import './initial' -import './intersect' -import './isInstance' -import './last' -import './max' -import './median' -import './min' -import './pad' -import './partition' -import './pluck' -import './prepend' -import './pull' -import './range' -import './repeat' -import './sample' -import './shuffle' -import './sum' -import './tail' -import './union' -import './zip' -import './zipObject' +import "./all"; +import "./any"; +import "./append"; +import "./average"; +import "./chunk"; +import "./clone"; +import "./compact"; +import "./contains"; +import "./count"; +import "./countBy"; +import "./crossJoin"; +import "./deepFlatten"; +import "./diff"; +import "./distinct"; +import "./everyNth"; +import "./first"; +import "./flatten"; +import "./get"; +import "./groupBy"; +import "./implode"; +import "./indexOfAll"; +import "./initial"; +import "./intersect"; +import "./isInstance"; +import "./last"; +import "./max"; +import "./median"; +import "./min"; +import "./pad"; +import "./partition"; +import "./pluck"; +import "./prepend"; +import "./pull"; +import "./range"; +import "./repeat"; +import "./sample"; +import "./shuffle"; +import "./sum"; +import "./tail"; +import "./union"; +import "./zip"; +import "./zipObject"; diff --git a/lib/array/indexOfAll/index.ts b/lib/array/indexOfAll/index.ts index ac442434..75ede1ca 100644 --- a/lib/array/indexOfAll/index.ts +++ b/lib/array/indexOfAll/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - indexOfAll(value: any): Array + indexOfAll(value: any): number[]; } } @@ -15,10 +15,6 @@ declare global { * [1, 2, 3, 1, 2, 3].indexOfAll(1); // [0,3] * [1, 2, 3].indexOfAll(4); // [] */ -Array.prototype.indexOfAll = function(value: any): Array { - let indices: Array = [] - - this.forEach((item, index) => item === value && indices.push(index)) - - return indices -} +Array.prototype.indexOfAll = function(value) { + return method(this, value); +}; diff --git a/lib/array/indexOfAll/method.ts b/lib/array/indexOfAll/method.ts new file mode 100644 index 00000000..6f610313 --- /dev/null +++ b/lib/array/indexOfAll/method.ts @@ -0,0 +1,9 @@ +const method = (arr: any[], value: any): number[] => { + const indices: number[] = []; + + arr.forEach((item, index) => item === value && indices.push(index)); + + return indices; +}; + +export = method; diff --git a/lib/array/indexOfAll/test.js b/lib/array/indexOfAll/test.ts similarity index 50% rename from lib/array/indexOfAll/test.js rename to lib/array/indexOfAll/test.ts index dd80bc9b..7f358d2f 100644 --- a/lib/array/indexOfAll/test.js +++ b/lib/array/indexOfAll/test.ts @@ -1,11 +1,11 @@ -require('../../../es6/array/indexOfAll') +import "./index"; describe("Array.prototype.indexOfAll", () => { test("[1, 2, 3, 1, 2, 3].indexOfAll(1) returns [0,3]", () => { - expect([1, 2, 3, 1, 2, 3].indexOfAll(1)).toEqual([0,3]) - }) + expect([1, 2, 3, 1, 2, 3].indexOfAll(1)).toEqual([0, 3]); + }); test("[1, 2, 3].indexOfAll(4) returns []", () => { - expect([1, 2, 3].indexOfAll(4)).toEqual([]) - }) -}) + expect([1, 2, 3].indexOfAll(4)).toEqual([]); + }); +}); diff --git a/lib/array/initial/index.ts b/lib/array/initial/index.ts index 6ca75628..9a61220e 100644 --- a/lib/array/initial/index.ts +++ b/lib/array/initial/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - initial(): Array + initial(): T[]; } } @@ -13,6 +13,6 @@ declare global { * @example * [1, 2, 3].initial(); // [1, 2] */ -Array.prototype.initial = function(): Array { - return this.slice(0, -1) -} +Array.prototype.initial = function() { + return method(this); +}; diff --git a/lib/array/initial/method.ts b/lib/array/initial/method.ts new file mode 100644 index 00000000..ad248004 --- /dev/null +++ b/lib/array/initial/method.ts @@ -0,0 +1,3 @@ +const method = (arr: any[]) => arr.slice(0, -1); + +export = method; diff --git a/lib/array/initial/test.js b/lib/array/initial/test.ts similarity index 51% rename from lib/array/initial/test.js rename to lib/array/initial/test.ts index 818a1ebf..e54cbd49 100644 --- a/lib/array/initial/test.js +++ b/lib/array/initial/test.ts @@ -1,7 +1,7 @@ -require('../../../es6/array/initial') +import "./index"; describe("Array.prototype.initial", () => { test("[1, 2, 3].initial() returns [1, 2]", () => { - expect([1,2,3].initial()).toEqual([1, 2]) - }) -}) + expect([1, 2, 3].initial()).toEqual([1, 2]); + }); +}); diff --git a/lib/array/intersect/index.ts b/lib/array/intersect/index.ts index b6dbe496..17df5aad 100644 --- a/lib/array/intersect/index.ts +++ b/lib/array/intersect/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - intersect(array: Array): Array + intersect(array: any[]): T[]; } } @@ -14,8 +14,6 @@ declare global { * @example * [1, 2, 3].intersect([4, 3, 2]); // [2,3] */ -Array.prototype.intersect = function(array: Array): Array { - const set = new Set(array) - - return this.filter(item => set.has(item)) -} +Array.prototype.intersect = function(array) { + return method(this, array); +}; diff --git a/lib/array/intersect/method.ts b/lib/array/intersect/method.ts new file mode 100644 index 00000000..27ad37c8 --- /dev/null +++ b/lib/array/intersect/method.ts @@ -0,0 +1,7 @@ +const method = (arr: any[], array: any[]): any[] => { + const set = new Set(array); + + return arr.filter((item) => set.has(item)); +}; + +export = method; diff --git a/lib/array/intersect/test.js b/lib/array/intersect/test.ts similarity index 50% rename from lib/array/intersect/test.js rename to lib/array/intersect/test.ts index fd9fe70b..dae0894c 100644 --- a/lib/array/intersect/test.js +++ b/lib/array/intersect/test.ts @@ -1,7 +1,7 @@ -require('../../../es6/array/intersect') +import "./index"; describe("Array.prototype.intersect", () => { test("[1, 2, 3].intersect([4, 3, 2]) returns [2,3]", () => { - expect([1, 2, 3].intersect([4, 3, 2])).toEqual([2,3]) - }) -}) + expect([1, 2, 3].intersect([4, 3, 2])).toEqual([2, 3]); + }); +}); diff --git a/lib/array/isInstance/index.ts b/lib/array/isInstance/index.ts index 8526470b..5182985e 100644 --- a/lib/array/isInstance/index.ts +++ b/lib/array/isInstance/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface ArrayConstructor { - isInstance(arg: any): arg is Array + isInstance(arg: any): arg is any[]; } } @@ -15,4 +15,4 @@ declare global { * Array.isInstance(2); // false * Array.isInstance([7, 3]); // true */ -Array.isInstance = Array.isArray +Array.isInstance = method; diff --git a/lib/array/isInstance/method.ts b/lib/array/isInstance/method.ts new file mode 100644 index 00000000..82d40d32 --- /dev/null +++ b/lib/array/isInstance/method.ts @@ -0,0 +1,3 @@ +const method = Array.isArray; + +export = method; diff --git a/lib/array/isInstance/test.js b/lib/array/isInstance/test.ts similarity index 50% rename from lib/array/isInstance/test.js rename to lib/array/isInstance/test.ts index 82dd25ca..498eba13 100644 --- a/lib/array/isInstance/test.js +++ b/lib/array/isInstance/test.ts @@ -1,11 +1,11 @@ -require('../../../es6/array/isInstance') +import "./index"; describe("Array.isInstance", () => { test("Array.isInstance(2) returns false", () => { - expect(Array.isInstance(2)).toBe(false) - }) + expect(Array.isInstance(2)).toBe(false); + }); test("Array.isInstance([7, 3]) returns true", () => { - expect(Array.isInstance([7, 3])).toBe(true) - }) -}) + expect(Array.isInstance([7, 3])).toBe(true); + }); +}); diff --git a/lib/array/last/index.ts b/lib/array/last/index.ts index a5759a81..6d6297b4 100644 --- a/lib/array/last/index.ts +++ b/lib/array/last/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - last(): T + last(): T; } } @@ -13,6 +13,6 @@ declare global { * @example * [1, 2, 3].last(); // 3 */ -Array.prototype.last = function(): any { - return this[this.length - 1] -} +Array.prototype.last = function() { + return method(this); +}; diff --git a/lib/array/last/method.ts b/lib/array/last/method.ts new file mode 100644 index 00000000..e6b04fba --- /dev/null +++ b/lib/array/last/method.ts @@ -0,0 +1,3 @@ +const method = (arr: any[]) => arr[arr.length - 1]; + +export = method; diff --git a/lib/array/last/test.js b/lib/array/last/test.ts similarity index 52% rename from lib/array/last/test.js rename to lib/array/last/test.ts index 51b71f89..2369b0a9 100644 --- a/lib/array/last/test.js +++ b/lib/array/last/test.ts @@ -1,7 +1,7 @@ -require('../../../es6/array/last') +import "./index"; describe("Array.prototype.last", () => { test("[1, 2, 3].last() returns 3", () => { - expect([1,2,3].last()).toBe(3) - }) -}) + expect([1, 2, 3].last()).toBe(3); + }); +}); diff --git a/lib/array/max/index.ts b/lib/array/max/index.ts index 635fa148..5e9df30a 100644 --- a/lib/array/max/index.ts +++ b/lib/array/max/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - max(key?: string): number + max(key?: string): number; } } @@ -16,22 +16,6 @@ declare global { * [{a: 1}, {a: 2}, {a: 3}].max('a'); // 3 * [{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].max('a.b'); // 3 */ -Array.prototype.max = function(key?: string): number { - let max: number = -Infinity - - if (key) { - let keys = key.split('.') - - this.map((item) => { - keys.map((k) => item = item && item[k] || 0) - - max = Math.max(item, max) - }) - - return max - } - - this.map((number) => max = Math.max(number, max)) - - return max -} +Array.prototype.max = function(key) { + return method(this, key); +}; diff --git a/lib/array/max/method.ts b/lib/array/max/method.ts new file mode 100644 index 00000000..68903f77 --- /dev/null +++ b/lib/array/max/method.ts @@ -0,0 +1,21 @@ +const method = (arr: any[], key?: string): number => { + let max: number = -Infinity; + + if (key) { + const keys = key.split("."); + + arr.map((item) => { + keys.map((k) => item = (item && item[k]) || 0); + + max = Math.max(item, max); + }); + + return max; + } + + arr.map((num) => max = Math.max(num, max)); + + return max; +}; + +export = method; diff --git a/lib/array/max/test.js b/lib/array/max/test.js deleted file mode 100644 index 74ed3dca..00000000 --- a/lib/array/max/test.js +++ /dev/null @@ -1,15 +0,0 @@ -require('../../../es6/array/max') - -describe("Array.prototype.max", () => { - test("[1, 2, 3].max() returns 3", () => { - expect([1, 2, 3].max()).toBe(3) - }) - - test("[{a: 1}, {a: 2}, {a: 3}].max('a') returns 3", () => { - expect([{a: 1}, {a: 2}, {a: 3}].max('a')).toBe(3) - }) - - test("[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].max('a.b') returns 3", () => { - expect([{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].max('a.b')).toBe(3) - }) -}) diff --git a/lib/array/max/test.ts b/lib/array/max/test.ts new file mode 100644 index 00000000..46e47a25 --- /dev/null +++ b/lib/array/max/test.ts @@ -0,0 +1,15 @@ +import "./index"; + +describe("Array.prototype.max", () => { + test("[1, 2, 3].max() returns 3", () => { + expect([1, 2, 3].max()).toBe(3); + }); + + test("[{a: 1}, {a: 2}, {a: 3}].max(\"a\") returns 3", () => { + expect([{ a: 1 }, { a: 2 }, { a: 3 }].max("a")).toBe(3); + }); + + test("[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].max(\"a.b\") returns 3", () => { + expect([{ a: { b: 1 } }, { a: { b: 2 } }, { a: { b: 3 } }].max("a.b")).toBe(3); + }); +}); diff --git a/lib/array/median/index.ts b/lib/array/median/index.ts index 1476f2da..1fc4c957 100644 --- a/lib/array/median/index.ts +++ b/lib/array/median/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - median(key?: string): number + median(key?: string): number; } } @@ -14,34 +14,6 @@ declare global { * [1, 1, 2, 4].median(); // 1.5 * [{foo: 10}, {foo: 10}, {foo: 20}, {foo: 40}].median('foo'); // 15 */ -Array.prototype.median = function(key?: string): number { - let array = this - - array.sort((a, b) => a - b) - - let half = Math.floor(array.length / 2) - - if (key) { - let keys = key.split('.') - - if (array.length % 2) { - let value = array[half] - - keys.map((k) => value = value && value[k] || value) - - return value - } - - let value1 = array[half - 1] - let value2 = array[half] - - keys.map((k) => value1 = value1 && value1[k] || value1) - keys.map((k) => value2 = value2 && value2[k] || value2) - - return (value1 + value2) / 2 - } - - if (array.length % 2) return array[half] - - return (array[half - 1] + array[half]) / 2 -} +Array.prototype.median = function(key) { + return method(this, key); +}; diff --git a/lib/array/median/method.ts b/lib/array/median/method.ts new file mode 100644 index 00000000..247f1a3f --- /dev/null +++ b/lib/array/median/method.ts @@ -0,0 +1,31 @@ +const method = (arr: any[], key?: string): number => { + arr.sort((a, b) => a - b); + + const half = Math.floor(arr.length / 2); + + if (key) { + const keys = key.split("."); + + if (arr.length % 2) { + let value = arr[half]; + + keys.map((k) => value = (value && value[k]) || value); + + return value; + } + + let value1 = arr[half - 1]; + let value2 = arr[half]; + + keys.map((k) => value1 = (value1 && value1[k]) || value1); + keys.map((k) => value2 = (value2 && value2[k]) || value2); + + return (value1 + value2) / 2; + } + + if (arr.length % 2) return arr[half]; + + return (arr[half - 1] + arr[half]) / 2; +}; + +export = method; diff --git a/lib/array/median/test.js b/lib/array/median/test.js deleted file mode 100644 index 989d8947..00000000 --- a/lib/array/median/test.js +++ /dev/null @@ -1,11 +0,0 @@ -require('../../../es6/array/median') - -describe("Array.prototype.median", () => { - test("[1, 1, 2, 4].median() returns 1.5", () => { - expect([1, 1, 2, 4].median()).toBe(1.5) - }) - - test("[{foo: 10}, {foo: 10}, {foo: 20}, {foo: 40}].median('foo') returns 15", () => { - expect([{foo: 10}, {foo: 10}, {foo: 20}, {foo: 40}].median('foo')).toBe(15) - }) -}) diff --git a/lib/array/median/test.ts b/lib/array/median/test.ts new file mode 100644 index 00000000..9d625525 --- /dev/null +++ b/lib/array/median/test.ts @@ -0,0 +1,11 @@ +import "./index"; + +describe("Array.prototype.median", () => { + test("[1, 1, 2, 4].median() returns 1.5", () => { + expect([1, 1, 2, 4].median()).toBe(1.5); + }); + + test("[{foo: 10}, {foo: 10}, {foo: 20}, {foo: 40}].median(\"foo\") returns 15", () => { + expect([{ foo: 10 }, { foo: 10 }, { foo: 20 }, { foo: 40 }].median("foo")).toBe(15); + }); +}); diff --git a/lib/array/min/index.ts b/lib/array/min/index.ts index 52bc33b0..2ac8b58b 100644 --- a/lib/array/min/index.ts +++ b/lib/array/min/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - min(key?: string): number + min(key?: string): number; } } @@ -16,22 +16,6 @@ declare global { * [{a: 1}, {a: 2}, {a: 3}].min('a'); // 1 * [{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].min('a.b'); // 1 */ -Array.prototype.min = function(key?: string): number { - let min: number = +Infinity - - if (key) { - let keys = key.split('.') - - this.map((item) => { - keys.map((k) => item = item && item[k] || 0) - - min = Math.min(item, min) - }) - - return min - } - - this.map((number) => min = Math.min(number, min)) - - return min -} +Array.prototype.min = function(key) { + return method(this, key); +}; diff --git a/lib/array/min/method.ts b/lib/array/min/method.ts new file mode 100644 index 00000000..07fa8091 --- /dev/null +++ b/lib/array/min/method.ts @@ -0,0 +1,21 @@ +const method = (arr: any[], key?: string): number => { + let min: number = +Infinity; + + if (key) { + const keys = key.split("."); + + arr.map((item) => { + keys.map((k) => item = item && item[k] || 0); + + min = Math.min(item, min); + }); + + return min; + } + + arr.map((num) => min = Math.min(num, min)); + + return min; +}; + +export = method; diff --git a/lib/array/min/test.js b/lib/array/min/test.js deleted file mode 100644 index 945feb0c..00000000 --- a/lib/array/min/test.js +++ /dev/null @@ -1,15 +0,0 @@ -require('../../../es6/array/min') - -describe("Array.prototype.min", () => { - test("[1, 2, 3].min() returns 1", () => { - expect([1, 2, 3].min()).toBe(1) - }) - - test("[{a: 1}, {a: 2}, {a: 3}].min('a') returns 1", () => { - expect([{a: 1}, {a: 2}, {a: 3}].min('a')).toBe(1) - }) - - test("[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].min('a.b') returns 1", () => { - expect([{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].min('a.b')).toBe(1) - }) -}) diff --git a/lib/array/min/test.ts b/lib/array/min/test.ts new file mode 100644 index 00000000..ad01f6d5 --- /dev/null +++ b/lib/array/min/test.ts @@ -0,0 +1,15 @@ +import "./index"; + +describe("Array.prototype.min", () => { + test("[1, 2, 3].min() returns 1", () => { + expect([1, 2, 3].min()).toBe(1); + }); + + test("[{a: 1}, {a: 2}, {a: 3}].min(\"a\") returns 1", () => { + expect([{ a: 1 }, { a: 2 }, { a: 3 }].min("a")).toBe(1); + }); + + test("[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].min(\"a.b\") returns 1", () => { + expect([{ a: { b: 1 } }, { a: { b: 2 } }, { a: { b: 3 } }].min("a.b")).toBe(1); + }); +}); diff --git a/lib/array/pad/index.ts b/lib/array/pad/index.ts index 3c9690d8..08cccee1 100644 --- a/lib/array/pad/index.ts +++ b/lib/array/pad/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - pad(size: number, value?: any): Array + pad(size: number, value?: any): any[]; } } @@ -16,14 +16,6 @@ declare global { * [1, 2, 3].pad(5, 0); // [1, 2, 3, 0, 0] * [1, 2, 3].pad(-5, 0); // [0, 0, 1, 2, 3] */ -Array.prototype.pad = function(size: number, value: any = 0): Array { - let s = Math.abs(size) - - if (s <= this.length) return this - - let array = Array(s - this.length).fill(value) - - if (size < 0) return array.concat(this) - - return this.concat(array) -} +Array.prototype.pad = function(size, value) { + return method(this, size, value); +}; diff --git a/lib/array/pad/method.ts b/lib/array/pad/method.ts new file mode 100644 index 00000000..05ec639d --- /dev/null +++ b/lib/array/pad/method.ts @@ -0,0 +1,13 @@ +const method = (arr: any[], size: number, value: any = 0): any[] => { + const s = Math.abs(size); + + if (s <= arr.length) return arr; + + const array = Array(s - arr.length).fill(value); + + if (size < 0) return array.concat(arr); + + return arr.concat(array); +}; + +export = method; diff --git a/lib/array/pad/test.js b/lib/array/pad/test.ts similarity index 50% rename from lib/array/pad/test.js rename to lib/array/pad/test.ts index a3c50483..78f06b65 100644 --- a/lib/array/pad/test.js +++ b/lib/array/pad/test.ts @@ -1,11 +1,11 @@ -require('../../../es6/array/pad') +import "./index"; describe("Array.prototype.pad", () => { test("[1, 2, 3].pad(5, 0) returns [1, 2, 3, 0, 0]", () => { - expect([1, 2, 3].pad(5, 0)).toEqual([1, 2, 3, 0, 0]) - }) + expect([1, 2, 3].pad(5, 0)).toEqual([1, 2, 3, 0, 0]); + }); test("[1, 2, 3].pad(-5, 0) returns [0, 0, 1, 2, 3]", () => { - expect([1, 2, 3].pad(-5, 0)).toEqual([0, 0, 1, 2, 3]) - }) -}) + expect([1, 2, 3].pad(-5, 0)).toEqual([0, 0, 1, 2, 3]); + }); +}); diff --git a/lib/array/partition/index.ts b/lib/array/partition/index.ts index b9366ee2..0c0c341e 100644 --- a/lib/array/partition/index.ts +++ b/lib/array/partition/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - partition(fn: (value: T, index: number, array: Array) => boolean): [Array, Array] + partition(fn: (value: T, index: number, array: any[]) => boolean): [T[], any[]]; } } @@ -13,14 +13,11 @@ declare global { * @returns {Array} * @example * const users = [{ user: 'barney', age: 36, active: false }, { user: 'fred', age: 40, active: true }]; - * users.partition(o => o.active); // [[{ 'user': 'fred', 'age': 40, 'active': true }],[{ 'user': 'barney', 'age': 36, 'active': false }]] + * users.partition(o => o.active); // [ + * [{ 'user': 'fred', 'age': 40, 'active': true }], + * [{ 'user': 'barney', 'age': 36, 'active': false }] + * ] */ -Array.prototype.partition = function(fn: (value: any, index: number, array: Array) => boolean): [Array, Array] { - return this.reduce( - (acc, val, i, arr) => { - acc[fn(val, i, arr) ? 0 : 1].push(val); - return acc; - }, - [[], []] - ) -} +Array.prototype.partition = function(fn) { + return method(this, fn); +}; diff --git a/lib/array/partition/method.ts b/lib/array/partition/method.ts new file mode 100644 index 00000000..b4949829 --- /dev/null +++ b/lib/array/partition/method.ts @@ -0,0 +1,11 @@ +const method = (arr: any[], fn: (value: any, index: number, array: any[]) => boolean): [any[], any[]] => { + return arr.reduce( + (acc, val, i, arr) => { + acc[fn(val, i, arr) ? 0 : 1].push(val); + return acc; + }, + [[], []], + ); +}; + +export = method; diff --git a/lib/array/partition/test.js b/lib/array/partition/test.js deleted file mode 100644 index a5e59eb8..00000000 --- a/lib/array/partition/test.js +++ /dev/null @@ -1,7 +0,0 @@ -require('../../../es6/array/partition') - -describe("Array.prototype.partition", () => { - test("[{ user: 'barney', active: false }, { user: 'fred', active: true }].partition(o => o.active) returns [[{ 'user': 'fred', 'active': true }],[{ 'user': 'barney', 'active': false }]]", () => { - expect([{ user: 'barney', active: false }, { user: 'fred', active: true }].partition(o => o.active)).toEqual([[{ 'user': 'fred', 'active': true }],[{ 'user': 'barney', 'active': false }]]) - }) -}) diff --git a/lib/array/partition/test.ts b/lib/array/partition/test.ts new file mode 100644 index 00000000..6deaa133 --- /dev/null +++ b/lib/array/partition/test.ts @@ -0,0 +1,10 @@ +import "./index"; + +describe("Array.prototype.partition", () => { + test( + "[{ user: \"barney\", active: false }, { user: \"fred\", active: true }].partition(o => o.active) returns " + + "[[{ user: \"fred\", active: true }],[{ user: \"barney\", active: false }]]", () => { + expect([{ user: "barney", active: false }, { user: "fred", active: true }].partition((o) => o.active)) + .toEqual([[{ user: "fred", active: true }], [{ user: "barney", active: false }]]); + }); +}); diff --git a/lib/array/pluck/index.ts b/lib/array/pluck/index.ts index 7b92ae99..8b79c84f 100644 --- a/lib/array/pluck/index.ts +++ b/lib/array/pluck/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - pluck(key: string): Array + pluck(key: string): any[]; } } @@ -15,12 +15,6 @@ declare global { * [{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].pluck('a'); // [{b: 1}, {b: 2}, {b: 3}] * [{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].pluck('a.b'); // [1, 2, 3] */ -Array.prototype.pluck = function(key: string): Array { - let keys = key.split('.') - - return this.map((item) => { - keys.map((k) => item = item && item[k] || undefined) - - return item - }) -} +Array.prototype.pluck = function(key) { + return method(this, key); +}; diff --git a/lib/array/pluck/method.ts b/lib/array/pluck/method.ts new file mode 100644 index 00000000..b7eecab6 --- /dev/null +++ b/lib/array/pluck/method.ts @@ -0,0 +1,11 @@ +const method = (arr: any[], key: string): any[] => { + const keys = key.split("."); + + return arr.map((item) => { + keys.map((k) => item = (item && item[k]) || undefined); + + return item; + }); +}; + +export = method; diff --git a/lib/array/pluck/test.js b/lib/array/pluck/test.js deleted file mode 100644 index 785a145f..00000000 --- a/lib/array/pluck/test.js +++ /dev/null @@ -1,11 +0,0 @@ -require('../../../es6/array/pluck') - -describe("Array.prototype.pluck", () => { - test("[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].pluck('a') returns [{b: 1}, {b: 2}, {b: 3}]", () => { - expect([{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].pluck('a')).toEqual([{b: 1}, {b: 2}, {b: 3}]) - }) - - test("[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].pluck('a.b') returns [1, 2, 3]", () => { - expect([{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].pluck('a.b')).toEqual([1, 2, 3]) - }) -}) diff --git a/lib/array/pluck/test.ts b/lib/array/pluck/test.ts new file mode 100644 index 00000000..3b55d3dc --- /dev/null +++ b/lib/array/pluck/test.ts @@ -0,0 +1,13 @@ +import "./index"; + +describe("Array.prototype.pluck", () => { + test("[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].pluck(\"a\") returns [{b: 1}, {b: 2}, {b: 3}]", () => { + expect([{ a: { b: 1 } }, { a: { b: 2 } }, { a: { b: 3 } }].pluck("a")) + .toEqual([{ b: 1 }, { b: 2 }, { b: 3 }]); + }); + + test("[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].pluck(\"a.b\") returns [1, 2, 3]", () => { + expect([{ a: { b: 1 } }, { a: { b: 2 } }, { a: { b: 3 } }].pluck("a.b")) + .toEqual([1, 2, 3]); + }); +}); diff --git a/lib/array/prepend/index.ts b/lib/array/prepend/index.ts index 5e8e3656..6db3e14e 100644 --- a/lib/array/prepend/index.ts +++ b/lib/array/prepend/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - prepend(value?: any): void + prepend(value?: any): void; } } @@ -14,10 +14,6 @@ declare global { * var myArray = [1, 2, 3] * myArray.prepend(0); // myArray => [0, 1, 2, 3] */ -Array.prototype.prepend = function(value: any): void { - let array = [...this] - - this.length = 0 - - this.push(...[value].concat(array)) -} +Array.prototype.prepend = function(value) { + return method(this, value); +}; diff --git a/lib/array/prepend/method.ts b/lib/array/prepend/method.ts new file mode 100644 index 00000000..f6910611 --- /dev/null +++ b/lib/array/prepend/method.ts @@ -0,0 +1,9 @@ +const method = (arr: any[], value: any): void => { + const array = [...arr]; + + arr.length = 0; + + arr.push(...[value].concat(array)); +}; + +export = method; diff --git a/lib/array/prepend/test.js b/lib/array/prepend/test.ts similarity index 50% rename from lib/array/prepend/test.js rename to lib/array/prepend/test.ts index f7a67144..c6fe8942 100644 --- a/lib/array/prepend/test.js +++ b/lib/array/prepend/test.ts @@ -1,11 +1,13 @@ -require('../../../es6/array/prepend') +import "./index"; describe("Array.prototype.prepend", () => { test("myArray = [1, 2, 3] & myArray.prepend(0) results myArray to be [0, 1, 2, 3]", () => { expect((() => { - let myArray = [1, 2, 3] - myArray.prepend(0) - return myArray - })()).toEqual([0, 1, 2, 3]) - }) -}) + const myArray = [1, 2, 3]; + + myArray.prepend(0); + + return myArray; + })()).toEqual([0, 1, 2, 3]); + }); +}); diff --git a/lib/array/pull/index.ts b/lib/array/pull/index.ts index 5476d4f5..ea49562b 100644 --- a/lib/array/pull/index.ts +++ b/lib/array/pull/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - pull(...args: Array): void + pull(...args: T[]): void; } } @@ -14,11 +14,6 @@ declare global { * let myArray = ['a', 'b', 'c', 'a', 'b', 'c']; * myArray.pull('a', 'c'); // myArray = [ 'b', 'b' ]; */ -Array.prototype.pull = function(...args: Array): void { - let argState = Array.isArray(args[0]) ? args[0] : args - let pulled = this.filter((value: any) => !argState.includes(value)) - - this.length = 0 - - pulled.forEach((value) => this.push(value)) -} +Array.prototype.pull = function(...args) { + return method(this, ...args); +}; diff --git a/lib/array/pull/method.ts b/lib/array/pull/method.ts new file mode 100644 index 00000000..2f88d525 --- /dev/null +++ b/lib/array/pull/method.ts @@ -0,0 +1,9 @@ +const method = (arr: any[], ...args: any[]): void => { + const pulled = arr.filter((value: any) => !(Array.isArray(args[0]) ? args[0] : args).includes(value)); + + arr.length = 0; + + pulled.forEach((value) => arr.push(value)); +}; + +export = method; diff --git a/lib/array/pull/test.js b/lib/array/pull/test.js deleted file mode 100644 index f1479804..00000000 --- a/lib/array/pull/test.js +++ /dev/null @@ -1,13 +0,0 @@ -require('../../../es6/array/pull') - -describe("Array.prototype.pull", () => { - test("myArray = ['a', 'b', 'c', 'a', 'b', 'c'] & myArray.pull('a', 'c') results myArray to be [ 'b', 'b' ]", () => { - expect((() => { - let myArray = ['a', 'b', 'c', 'a', 'b', 'c'] - - myArray.pull('a', 'c') - - return myArray - })()).toEqual([ 'b', 'b' ]) - }) -}) diff --git a/lib/array/pull/test.ts b/lib/array/pull/test.ts new file mode 100644 index 00000000..83c936b8 --- /dev/null +++ b/lib/array/pull/test.ts @@ -0,0 +1,16 @@ +import "./index"; + +describe("Array.prototype.pull", () => { + test( + "myArray = [\"a\", \"b\", \"c\", \"a\", \"b\", \"c\"] & myArray.pull(\"a\", \"c\") results " + + "myArray to be [ \"b\", \"b\" ]", + () => { + expect((() => { + const myArray = ["a", "b", "c", "a", "b", "c"]; + + myArray.pull("a", "c"); + + return myArray; + })()).toEqual(["b", "b"]); + }); +}); diff --git a/lib/array/range/index.ts b/lib/array/range/index.ts index dde8dff0..b6756a74 100644 --- a/lib/array/range/index.ts +++ b/lib/array/range/index.ts @@ -1,13 +1,14 @@ -export { } +import * as method from "./method"; declare global { interface ArrayConstructor { - range(end: number, start?: number, step?: number): Array + range(end: number, start?: number, step?: number): number[]; } } /** - * Initializes an array containing the numbers in the specified range where start and end are inclusive with there common difference step + * Initializes an array containing the numbers in the specified range where start + * and end are inclusive with there common difference step * @memberof Array * @param {number} end * @param {number} [start=0] @@ -18,4 +19,4 @@ declare global { * Array.range(7, 3); // [3,4,5,6,7] * Array.range(9, 0, 2); // [0,2,4,6,8] */ -Array.range = (end: number, start = 0, step = 1): Array => Array.from({ length: Math.ceil((end + 1 - start) / step) }).map((v, i) => i * step + start) +Array.range = method; diff --git a/lib/array/range/method.ts b/lib/array/range/method.ts new file mode 100644 index 00000000..24f6380a --- /dev/null +++ b/lib/array/range/method.ts @@ -0,0 +1,5 @@ +const method = (end: number, start: number = 0, step: number = 1): number[] => Array.from({ + length: Math.ceil((end + 1 - start) / step), +}).map((v, i) => i * step + start); + +export = method; diff --git a/lib/array/range/test.js b/lib/array/range/test.js deleted file mode 100644 index be2ab87e..00000000 --- a/lib/array/range/test.js +++ /dev/null @@ -1,15 +0,0 @@ -require('../../../es6/array/range') - -describe("Array.range", () => { - test("Array.range(5) returns [0,1,2,3,4,5]", () => { - expect(Array.range(5)).toEqual([0,1,2,3,4,5]) - }) - - test("Array.range(7, 3) returns [3,4,5,6,7]", () => { - expect(Array.range(7, 3)).toEqual([3,4,5,6,7]) - }) - - test("Array.range(9, 0, 2) returns [0,2,4,6,8]", () => { - expect(Array.range(9, 0, 2)).toEqual([0,2,4,6,8]) - }) -}) diff --git a/lib/array/range/test.ts b/lib/array/range/test.ts new file mode 100644 index 00000000..1c2e5cda --- /dev/null +++ b/lib/array/range/test.ts @@ -0,0 +1,15 @@ +import "./index"; + +describe("Array.range", () => { + test("Array.range(5) returns [0,1,2,3,4,5]", () => { + expect(Array.range(5)).toEqual([0, 1, 2, 3, 4, 5]); + }); + + test("Array.range(7, 3) returns [3,4,5,6,7]", () => { + expect(Array.range(7, 3)).toEqual([3, 4, 5, 6, 7]); + }); + + test("Array.range(9, 0, 2) returns [0,2,4,6,8]", () => { + expect(Array.range(9, 0, 2)).toEqual([0, 2, 4, 6, 8]); + }); +}); diff --git a/lib/array/repeat/index.ts b/lib/array/repeat/index.ts index c14d428e..096f6bc4 100644 --- a/lib/array/repeat/index.ts +++ b/lib/array/repeat/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface ArrayConstructor { - repeat(n: number, value?: any): Array + repeat(n: number, value?: any): any[]; } } @@ -15,4 +15,4 @@ declare global { * @example * Array.repeat(5, 2); // [2,2,2,2,2] */ -Array.repeat = (n: number, value = 0): Array => Array(n).fill(value) +Array.repeat = method; diff --git a/lib/array/repeat/method.ts b/lib/array/repeat/method.ts new file mode 100644 index 00000000..855079ef --- /dev/null +++ b/lib/array/repeat/method.ts @@ -0,0 +1,3 @@ +const method = (n: number, value = 0): any[] => Array(n).fill(value); + +export = method; diff --git a/lib/array/repeat/test.js b/lib/array/repeat/test.js deleted file mode 100644 index beda9140..00000000 --- a/lib/array/repeat/test.js +++ /dev/null @@ -1,7 +0,0 @@ -require('../../../es6/array/repeat') - -describe("Array.repeat", () => { - test("Array.repeat(5, 2) returns [2,2,2,2,2]", () => { - expect(Array.repeat(5, 2)).toEqual([2,2,2,2,2]) - }) -}) diff --git a/lib/array/repeat/test.ts b/lib/array/repeat/test.ts new file mode 100644 index 00000000..469d8344 --- /dev/null +++ b/lib/array/repeat/test.ts @@ -0,0 +1,7 @@ +import "./index"; + +describe("Array.repeat", () => { + test("Array.repeat(5, 2) returns [2,2,2,2,2]", () => { + expect(Array.repeat(5, 2)).toEqual([2, 2, 2, 2, 2]); + }); +}); diff --git a/lib/array/sample/index.ts b/lib/array/sample/index.ts index f4f605a0..e24f4aa6 100644 --- a/lib/array/sample/index.ts +++ b/lib/array/sample/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - sample(): T + sample(): T; } } @@ -13,6 +13,6 @@ declare global { * @example * [3, 7, 9, 11].sample(); // 9 */ -Array.prototype.sample = function(): any { - return this[Math.floor(Math.random() * this.length)] -} +Array.prototype.sample = function() { + return method(this); +}; diff --git a/lib/array/sample/method.ts b/lib/array/sample/method.ts new file mode 100644 index 00000000..19d6f3ed --- /dev/null +++ b/lib/array/sample/method.ts @@ -0,0 +1,5 @@ +const method = (arr: any[]): any => { + return arr[Math.floor(Math.random() * arr.length)]; +}; + +export = method; diff --git a/lib/array/sample/test.js b/lib/array/sample/test.js deleted file mode 100644 index 9723e27f..00000000 --- a/lib/array/sample/test.js +++ /dev/null @@ -1,7 +0,0 @@ -require('../../../es6/array/sample') - -describe("Array.prototype.sample", () => { - test("['a', 'b', 'c', 'd'].sample() returns 'a' or 'b' or 'c' or 'd'", () => { - expect(['a', 'b', 'c', 'd'].sample()).toMatch(/[abcd]/) - }) -}) diff --git a/lib/array/sample/test.ts b/lib/array/sample/test.ts new file mode 100644 index 00000000..53628a49 --- /dev/null +++ b/lib/array/sample/test.ts @@ -0,0 +1,7 @@ +import "./index"; + +describe("Array.prototype.sample", () => { + test("[\"a\", \"b\", \"c\", \"d\"].sample() returns \"a\" or \"b\" or \"c\" or \"d\"", () => { + expect(["a", "b", "c", "d"].sample()).toMatch(/[abcd]/); + }); +}); diff --git a/lib/array/shuffle/index.ts b/lib/array/shuffle/index.ts index bbe88596..d3541cbb 100644 --- a/lib/array/shuffle/index.ts +++ b/lib/array/shuffle/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - shuffle(): Array + shuffle(): T[]; } } @@ -14,17 +14,6 @@ declare global { * const foo = [1, 2, 3]; * foo.shuffle(); // [2,3,1], foo = [1,2,3] */ -Array.prototype.shuffle = function(): Array { - const _shuffle = ([...arr]) => { - let m = arr.length - - while (m) { - const i = Math.floor(Math.random() * m--); - [arr[m], arr[i]] = [arr[i], arr[m]]; - } - - return arr - } - - return _shuffle(this) -} +Array.prototype.shuffle = function() { + return method(this); +}; diff --git a/lib/array/shuffle/method.ts b/lib/array/shuffle/method.ts new file mode 100644 index 00000000..0375394f --- /dev/null +++ b/lib/array/shuffle/method.ts @@ -0,0 +1,12 @@ +const method = (arr: any[]) => { + let m = arr.length; + + while (m) { + const i = Math.floor(Math.random() * m--); + [arr[m], arr[i]] = [arr[i], arr[m]]; + } + + return arr; +}; + +export = method; diff --git a/lib/array/shuffle/test.js b/lib/array/shuffle/test.ts similarity index 76% rename from lib/array/shuffle/test.js rename to lib/array/shuffle/test.ts index 443337ab..d0a0c711 100644 --- a/lib/array/shuffle/test.js +++ b/lib/array/shuffle/test.ts @@ -1,7 +1,7 @@ -require('../../../es6/array/shuffle') +import "./index"; describe("Array.prototype.shuffle", () => { test("[1, 2, 3].shuffle() returns somthing like [2,3,1]", () => { - expect([1, 2, 3].shuffle()).toEqual(expect.arrayContaining([2,3,1])) - }) -}) + expect([1, 2, 3].shuffle()).toEqual(expect.arrayContaining([2, 3, 1])); + }); +}); diff --git a/lib/array/sum/index.ts b/lib/array/sum/index.ts index 3d8918f6..eb3f0938 100644 --- a/lib/array/sum/index.ts +++ b/lib/array/sum/index.ts @@ -1,37 +1,21 @@ -export { } +import * as method from "./method"; declare global { interface Array { - sum(key?: string): number + sum(key?: string): number; } } /** -* Returns the minimum value of a given key -* @memberof Array -* @param {String} [key] -* @returns {number} -* @example -* [1, 2, 3].sum(); // 6 -* [{a: 1}, {a: 2}, {a: 3}].sum('a'); // 6 -* [{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].sum('a.b'); // 6 -*/ -Array.prototype.sum = function(key?: string): number { - let sum = 0 - - if (key) { - let keys = key.split('.') - - this.map((item) => { - keys.map((k) => item = item && item[k] || 0) - - sum += item - }) - - return sum - } - - this.map((number) => sum += number) - - return sum -} + * Returns the minimum value of a given key + * @memberof Array + * @param {String} [key] + * @returns {number} + * @example + * [1, 2, 3].sum(); // 6 + * [{a: 1}, {a: 2}, {a: 3}].sum('a'); // 6 + * [{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].sum('a.b'); // 6 + */ +Array.prototype.sum = function(key) { + return method(this, key); +}; diff --git a/lib/array/sum/method.ts b/lib/array/sum/method.ts new file mode 100644 index 00000000..64cc22c2 --- /dev/null +++ b/lib/array/sum/method.ts @@ -0,0 +1,18 @@ +const method = (arr: any[], key?: string): number => { + if (key) { + const keys = key.split("."); + let sum = 0; + + arr.map((item) => { + keys.map((k) => item = (item && item[k]) || 0); + + sum += item; + }); + + return sum; + } + + return arr.reduce((acc, val) => acc + val, 0); +}; + +export = method; diff --git a/lib/array/sum/test.js b/lib/array/sum/test.js deleted file mode 100644 index 8574b83e..00000000 --- a/lib/array/sum/test.js +++ /dev/null @@ -1,15 +0,0 @@ -require('../../../es6/array/sum') - -describe("Array.prototype.sum", () => { - test("[1, 2, 3].sum() returns 6", () => { - expect([1, 2, 3].sum()).toBe(6) - }) - - test("[{a: 1}, {a: 2}, {a: 3}].sum('a') returns 6", () => { - expect([{a: 1}, {a: 2}, {a: 3}].sum('a')).toBe(6) - }) - - test("[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].sum('a.b') returns 6", () => { - expect([{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].sum('a.b')).toBe(6) - }) -}) diff --git a/lib/array/sum/test.ts b/lib/array/sum/test.ts new file mode 100644 index 00000000..ce24f56b --- /dev/null +++ b/lib/array/sum/test.ts @@ -0,0 +1,15 @@ +import "./index"; + +describe("Array.prototype.sum", () => { + test("[1, 2, 3].sum() returns 6", () => { + expect([1, 2, 3].sum()).toBe(6); + }); + + test("[{a: 1}, {a: 2}, {a: 3}].sum(\"a\") returns 6", () => { + expect([{ a: 1 }, { a: 2 }, { a: 3 }].sum("a")).toBe(6); + }); + + test("[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].sum(\"a.b\") returns 6", () => { + expect([{ a: { b: 1 } }, { a: { b: 2 } }, { a: { b: 3 } }].sum("a.b")).toBe(6); + }); +}); diff --git a/lib/array/tail/index.ts b/lib/array/tail/index.ts index e3728162..a88656ba 100644 --- a/lib/array/tail/index.ts +++ b/lib/array/tail/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - tail(): Array + tail(): T[]; } } @@ -13,6 +13,6 @@ declare global { * @example * [1, 2, 3].tail(); // [2, 3] */ -Array.prototype.tail = function(): Array { - return this.length > 1 ? this.slice(1) : [] -} +Array.prototype.tail = function() { + return method(this); +}; diff --git a/lib/array/tail/method.ts b/lib/array/tail/method.ts new file mode 100644 index 00000000..305bb576 --- /dev/null +++ b/lib/array/tail/method.ts @@ -0,0 +1,3 @@ +const method = (arr: any[]): any[] => arr.length > 1 ? arr.slice(1) : []; + +export = method; diff --git a/lib/array/tail/test.js b/lib/array/tail/test.ts similarity index 51% rename from lib/array/tail/test.js rename to lib/array/tail/test.ts index dab4beed..6cd1b8ee 100644 --- a/lib/array/tail/test.js +++ b/lib/array/tail/test.ts @@ -1,7 +1,7 @@ -require('../../../es6/array/tail') +import "./index"; describe("Array.prototype.tail", () => { test("[1, 2, 3].tail() returns [2, 3]", () => { - expect([1,2,3].tail()).toEqual([2, 3]) - }) -}) + expect([1, 2, 3].tail()).toEqual([2, 3]); + }); +}); diff --git a/lib/array/union/index.ts b/lib/array/union/index.ts index f922e15b..53c995fb 100644 --- a/lib/array/union/index.ts +++ b/lib/array/union/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - union(array: Array): Array + union(array: T[]): T[]; } } @@ -14,6 +14,6 @@ declare global { * @example * [1, 2, 3].union([4, 3, 2]); // [1,2,3,4] */ -Array.prototype.union = function(array: Array): Array { - return Array.from(new Set([...this, ...array])) -} +Array.prototype.union = function(array) { + return method(this, array); +}; diff --git a/lib/array/union/method.ts b/lib/array/union/method.ts new file mode 100644 index 00000000..74ca385d --- /dev/null +++ b/lib/array/union/method.ts @@ -0,0 +1,3 @@ +const method = (arr: any[], array: any[]): any[] => Array.from(new Set([...arr, ...array])); + +export = method; diff --git a/lib/array/union/test.js b/lib/array/union/test.ts similarity index 50% rename from lib/array/union/test.js rename to lib/array/union/test.ts index bd58065e..ae7d49f1 100644 --- a/lib/array/union/test.js +++ b/lib/array/union/test.ts @@ -1,7 +1,7 @@ -require('../../../es6/array/union') +import "./index"; describe("Array.prototype.union", () => { test("[1, 2, 3].union([4, 3, 2]) returns [1,2,3,4]", () => { - expect([1, 2, 3].union([4, 3, 2])).toEqual([1,2,3,4]) - }) -}) + expect([1, 2, 3].union([4, 3, 2])).toEqual([1, 2, 3, 4]); + }); +}); diff --git a/lib/array/zip/index.ts b/lib/array/zip/index.ts index f70b7aa0..9bcf35eb 100644 --- a/lib/array/zip/index.ts +++ b/lib/array/zip/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - zip(...arrays: Array>): Array> + zip(...arrays: any[][]): any[][]; } } @@ -15,12 +15,6 @@ declare global { * ['a', 'b'].zip([1, 2], [true, false]); // [['a', 1, true], ['b', 2, false]] * ['a'].zip([1, 2], [true, false]); // [['a', 1, true], [undefined, 2, false]] */ -Array.prototype.zip = function(...arrays: Array>): Array> { - arrays = [this, ...arrays] - - const maxLength = Math.max(...arrays.map(x => x.length)) - - return Array.from({ length: maxLength }).map((_, i) => { - return Array.from({ length: arrays.length }, (_, k) => arrays[k][i]); - }) -} +Array.prototype.zip = function(...arrays) { + return method(this, ...arrays); +}; diff --git a/lib/array/zip/method.ts b/lib/array/zip/method.ts new file mode 100644 index 00000000..b587fa16 --- /dev/null +++ b/lib/array/zip/method.ts @@ -0,0 +1,9 @@ +const method = (arr: any[], ...arrays: any[][]): any[][] => { + arrays = [arr, ...arrays]; + + return Array.from({ length: Math.max(...arrays.map((x) => x.length)) }).map((_, i) => { + return Array.from({ length: arrays.length }, (_, k) => arrays[k][i]); + }); +}; + +export = method; diff --git a/lib/array/zip/test.js b/lib/array/zip/test.js deleted file mode 100644 index dda217a7..00000000 --- a/lib/array/zip/test.js +++ /dev/null @@ -1,11 +0,0 @@ -require('../../../es6/array/zip') - -describe("Array.prototype.zip", () => { - test("['a', 'b'].zip([1, 2], [true, false]) returns [['a', 1, true], ['b', 2, false]]", () => { - expect(['a', 'b'].zip([1, 2], [true, false])).toEqual([['a', 1, true], ['b', 2, false]]) - }) - - test("['a'].zip([1, 2], [true, false]) returns [['a', 1, true], [undefined, 2, false]]", () => { - expect(['a'].zip([1, 2], [true, false])).toEqual([['a', 1, true], [undefined, 2, false]]) - }) -}) diff --git a/lib/array/zip/test.ts b/lib/array/zip/test.ts new file mode 100644 index 00000000..770aad7e --- /dev/null +++ b/lib/array/zip/test.ts @@ -0,0 +1,11 @@ +import "./index"; + +describe("Array.prototype.zip", () => { + test("[\"a\", \"b\"].zip([1, 2], [true, false]) returns [[\"a\", 1, true], [\"b\", 2, false]]", () => { + expect(["a", "b"].zip([1, 2], [true, false])).toEqual([["a", 1, true], ["b", 2, false]]); + }); + + test("[\"a\"].zip([1, 2], [true, false]) returns [[\"a\", 1, true], [undefined, 2, false]]", () => { + expect(["a"].zip([1, 2], [true, false])).toEqual([["a", 1, true], [undefined, 2, false]]); + }); +}); diff --git a/lib/array/zipObject/index.ts b/lib/array/zipObject/index.ts index 20583c2b..3048ced8 100644 --- a/lib/array/zipObject/index.ts +++ b/lib/array/zipObject/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Array { - zipObject(array: Array): object + zipObject(array: any[]): object; } } @@ -15,6 +15,6 @@ declare global { * ['a', 'b', 'c'].zipObject([1, 2]); // {a: 1, b: 2, c: undefined} * ['a', 'b'].zipObject([1, 2, 3]); // {a: 1, b: 2} */ -Array.prototype.zipObject = function(array: Array): object { - return this.reduce((obj, prop, index) => ((obj[prop] = array[index]), obj), {}) -} +Array.prototype.zipObject = function(array) { + return method(this, array); +}; diff --git a/lib/array/zipObject/method.ts b/lib/array/zipObject/method.ts new file mode 100644 index 00000000..6696eb94 --- /dev/null +++ b/lib/array/zipObject/method.ts @@ -0,0 +1,5 @@ +const method = (arr: any[], array: any[]): object => { + return arr.reduce((obj, prop, index) => ((obj[prop] = array[index]), obj), {}); +}; + +export = method; diff --git a/lib/array/zipObject/test.js b/lib/array/zipObject/test.js deleted file mode 100644 index 0bb30afc..00000000 --- a/lib/array/zipObject/test.js +++ /dev/null @@ -1,11 +0,0 @@ -require('../../../es6/array/zipObject') - -describe("Array.prototype.zipObject", () => { - test("['a', 'b', 'c'].zipObject([1, 2]) returns {a: 1, b: 2, c: undefined}", () => { - expect(['a', 'b', 'c'].zipObject([1, 2])).toEqual({a: 1, b: 2, c: undefined}) - }) - - test("['a', 'b'].zipObject([1, 2, 3]) returns {a: 1, b: 2}", () => { - expect(['a', 'b'].zipObject([1, 2, 3])).toEqual({a: 1, b: 2}) - }) -}) diff --git a/lib/array/zipObject/test.ts b/lib/array/zipObject/test.ts new file mode 100644 index 00000000..4498e606 --- /dev/null +++ b/lib/array/zipObject/test.ts @@ -0,0 +1,11 @@ +import "./index"; + +describe("Array.prototype.zipObject", () => { + test("[\"a\", \"b\", \"c\"].zipObject([1, 2]) returns {a: 1, b: 2, c: undefined}", () => { + expect(["a", "b", "c"].zipObject([1, 2])).toEqual({ a: 1, b: 2, c: undefined }); + }); + + test("[\"a\", \"b\"].zipObject([1, 2, 3]) returns {a: 1, b: 2}", () => { + expect(["a", "b"].zipObject([1, 2, 3])).toEqual({ a: 1, b: 2 }); + }); +}); diff --git a/lib/boolean/index.ts b/lib/boolean/index.ts index 1cad95dd..3729d0af 100644 --- a/lib/boolean/index.ts +++ b/lib/boolean/index.ts @@ -1,3 +1,3 @@ /** @namespace Boolean */ -import './isInstance' +import "./isInstance"; diff --git a/lib/boolean/isInstance/index.ts b/lib/boolean/isInstance/index.ts index 8590aa59..402f9566 100644 --- a/lib/boolean/isInstance/index.ts +++ b/lib/boolean/isInstance/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface BooleanConstructor { - isInstance(arg: any): arg is boolean + isInstance(arg: any): arg is boolean; } } @@ -15,4 +15,4 @@ declare global { * Boolean.isInstance('foo bar'); // false * Boolean.isInstance(flase); // true */ -Boolean.isInstance = (arg: any): arg is boolean => typeof arg === 'boolean' +Boolean.isInstance = method; diff --git a/lib/boolean/isInstance/method.ts b/lib/boolean/isInstance/method.ts new file mode 100644 index 00000000..425e9b51 --- /dev/null +++ b/lib/boolean/isInstance/method.ts @@ -0,0 +1,3 @@ +const method = (arg: any): arg is boolean => typeof arg === "boolean"; + +export = method; diff --git a/lib/boolean/isInstance/test.js b/lib/boolean/isInstance/test.js deleted file mode 100644 index d6185924..00000000 --- a/lib/boolean/isInstance/test.js +++ /dev/null @@ -1,13 +0,0 @@ -require('../../../es6/boolean/isInstance') - -describe("Boolean.isInstance", () => { - test("Boolean.isInstance('foo bar') returns false", () => { - expect(Boolean.isInstance('foo bar')) - .toBe(false) - }) - - test("Boolean.isInstance(false) returns true", () => { - expect(Boolean.isInstance(false)) - .toBe(true) - }) -}) diff --git a/lib/boolean/isInstance/test.ts b/lib/boolean/isInstance/test.ts new file mode 100644 index 00000000..46aebe12 --- /dev/null +++ b/lib/boolean/isInstance/test.ts @@ -0,0 +1,13 @@ +import "./index"; + +describe("Boolean.isInstance", () => { + test("Boolean.isInstance(\"foo bar\") returns false", () => { + expect(Boolean.isInstance("foo bar")) + .toBe(false); + }); + + test("Boolean.isInstance(false) returns true", () => { + expect(Boolean.isInstance(false)) + .toBe(true); + }); +}); diff --git a/lib/date/index.ts b/lib/date/index.ts index 99a97487..3d102aea 100644 --- a/lib/date/index.ts +++ b/lib/date/index.ts @@ -1,3 +1,3 @@ /** @namespace Date */ -import './isInstance' +import "./isInstance"; diff --git a/lib/date/isInstance/index.ts b/lib/date/isInstance/index.ts index 880bfda8..eec717fa 100644 --- a/lib/date/isInstance/index.ts +++ b/lib/date/isInstance/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface DateConstructor { - isInstance(arg: any): arg is Date + isInstance(arg: any): arg is Date; } } @@ -15,4 +15,4 @@ declare global { * Date.isInstance('foo bar'); // false * Date.isInstance(new Date()); // true */ -Date.isInstance = (arg: any): arg is Date => arg instanceof Date +Date.isInstance = method; diff --git a/lib/date/isInstance/method.ts b/lib/date/isInstance/method.ts new file mode 100644 index 00000000..866c6464 --- /dev/null +++ b/lib/date/isInstance/method.ts @@ -0,0 +1,3 @@ +const method = (arg: any): arg is Date => arg instanceof Date; + +export = method; diff --git a/lib/date/isInstance/test.js b/lib/date/isInstance/test.js deleted file mode 100644 index f5a963dd..00000000 --- a/lib/date/isInstance/test.js +++ /dev/null @@ -1,13 +0,0 @@ -require('../../../es6/date/isInstance') - -describe("Date.isInstance", () => { - test("Date.isInstance('foo bar') returns false", () => { - expect(Date.isInstance('foo bar')) - .toBe(false) - }) - - test("Date.isInstance(new Date()) returns true", () => { - expect(Date.isInstance(new Date())) - .toBe(true) - }) -}) diff --git a/lib/date/isInstance/test.ts b/lib/date/isInstance/test.ts new file mode 100644 index 00000000..8b91adb4 --- /dev/null +++ b/lib/date/isInstance/test.ts @@ -0,0 +1,13 @@ +import "./index"; + +describe("Date.isInstance", () => { + test("Date.isInstance(\"foo bar\") returns false", () => { + expect(Date.isInstance("foo bar")) + .toBe(false); + }); + + test("Date.isInstance(new Date()) returns true", () => { + expect(Date.isInstance(new Date())) + .toBe(true); + }); +}); diff --git a/lib/function/cache/index.ts b/lib/function/cache/index.ts index 5c3c8b98..b3d0f619 100644 --- a/lib/function/cache/index.ts +++ b/lib/function/cache/index.ts @@ -1,9 +1,9 @@ -export { } +import * as method from "./method"; declare global { interface Function { - cached?: Array<{ key: string, result: any }> - cache(...args: Array): any + cached?: Map; + cache(...args: any[]): any; } } @@ -17,21 +17,6 @@ declare global { * test.cache(); // takes a second to log 'test' * test.cache(); // instantly logs the second 'test' */ -Function.prototype.cache = function(...args: Array): any { - let key = JSON.stringify(args) - let cached = this.cached || [] - - let index = cached.findIndex((c: { [key: string]: any }) => c.key === args) - if (index !== -1) return cached[index].result - - let result = this.call(this, ...args) - - cached.push({ - key, - result - }) - - this.cached = cached - - return result -} +Function.prototype.cache = function(...args) { + return method(this)(...args); +}; diff --git a/lib/function/cache/method.ts b/lib/function/cache/method.ts new file mode 100644 index 00000000..c84cc2e1 --- /dev/null +++ b/lib/function/cache/method.ts @@ -0,0 +1,16 @@ +// tslint:disable-next-line:ban-types +const method = (func: Function): any => { + const cache = new Map(); + + const cached = (...args: any[]) => { + const key = JSON.stringify(args); + + return cache.has(key) ? cache.get(key) : cache.set(key, func.call(func, ...args)) && cache.get(key); + }; + + cached.cached = cache; + + return cached; +}; + +export = method; diff --git a/lib/function/cache/test.ts b/lib/function/cache/test.ts new file mode 100644 index 00000000..75f4e96e --- /dev/null +++ b/lib/function/cache/test.ts @@ -0,0 +1,8 @@ +import "./index"; + +describe("Function.prototype.cache", () => { + test("Math.max.cache(1, 22, 15) returns 22", () => { + expect(Math.max.cache(1, 22, 15)) + .toBe(22); + }); +}); diff --git a/lib/function/defer/index.ts b/lib/function/defer/index.ts index 083bc104..e5e882d1 100644 --- a/lib/function/defer/index.ts +++ b/lib/function/defer/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Function { - defer(...args: Array): any + defer(...args: any[]): any; } } @@ -15,6 +15,6 @@ declare global { * const test = (msg) => console.log(msg); * test.defer('a'), test('b'); // logs 'b' then 'a' */ -Function.prototype.defer = function(...args: Array): any { - return setTimeout(this, 1, ...args) -} +Function.prototype.defer = function(...args) { + return method(this, ...args); +}; diff --git a/lib/function/defer/method.ts b/lib/function/defer/method.ts new file mode 100644 index 00000000..357fb037 --- /dev/null +++ b/lib/function/defer/method.ts @@ -0,0 +1,4 @@ +// tslint:disable-next-line:ban-types +const method = (func: Function, ...args: any[]): any => setTimeout(func, 1, ...args); + +export = method; diff --git a/lib/function/index.ts b/lib/function/index.ts index 9d67fab3..87d99dd5 100644 --- a/lib/function/index.ts +++ b/lib/function/index.ts @@ -1,6 +1,6 @@ /** @namespace Function */ -import './cache' -import './defer' -import './isInstance' -import './once' +import "./cache"; +import "./defer"; +import "./isInstance"; +import "./once"; diff --git a/lib/function/isInstance/index.ts b/lib/function/isInstance/index.ts index e4fa8ee9..8b04794c 100644 --- a/lib/function/isInstance/index.ts +++ b/lib/function/isInstance/index.ts @@ -1,8 +1,9 @@ -export { } +import * as method from "./method"; declare global { interface FunctionConstructor { - isInstance(arg: any): arg is Function + // tslint:disable-next-line:ban-types + isInstance(arg: any): arg is Function; } } @@ -15,4 +16,4 @@ declare global { * Function.isInstance(2); // false * Function.isInstance((() => {})); // true */ -Function.isInstance = (arg: any): arg is Function => arg instanceof Function +Function.isInstance = method; diff --git a/lib/function/isInstance/method.ts b/lib/function/isInstance/method.ts new file mode 100644 index 00000000..637a9ada --- /dev/null +++ b/lib/function/isInstance/method.ts @@ -0,0 +1,4 @@ +// tslint:disable-next-line:ban-types +const method = (arg: any): arg is Function => arg instanceof Function; + +export = method; diff --git a/lib/function/isInstance/test.js b/lib/function/isInstance/test.ts similarity index 71% rename from lib/function/isInstance/test.js rename to lib/function/isInstance/test.ts index d08a79a7..0238365b 100644 --- a/lib/function/isInstance/test.js +++ b/lib/function/isInstance/test.ts @@ -1,13 +1,13 @@ -require('../../../es6/function/isInstance') +import "./index"; describe("Function.isInstance", () => { test("Function.isInstance(2) returns false", () => { expect(Function.isInstance(2)) - .toBe(false) - }) + .toBe(false); + }); test("Function.isInstance((() => {})) returns true", () => { expect(Function.isInstance((() => {}))) - .toBe(true) - }) -}) + .toBe(true); + }); +}); diff --git a/lib/function/once/index.ts b/lib/function/once/index.ts index c9c36b60..d733f9ab 100644 --- a/lib/function/once/index.ts +++ b/lib/function/once/index.ts @@ -1,9 +1,9 @@ -export { } +import * as method from "./method"; declare global { interface Function { - called?: boolean - once(...args: Array): any + called?: boolean; + once(...args: any[]): any; } } @@ -17,10 +17,6 @@ declare global { * test.once('a'); // logs 'a' * test.once('b'); // no log this time */ -Function.prototype.once = function(...args: Array): any { - if (this.called) return; - - this.called = true - - return this.call(this, ...args) -} +Function.prototype.once = function(...args) { + return method(this, ...args); +}; diff --git a/lib/function/once/method.ts b/lib/function/once/method.ts new file mode 100644 index 00000000..9e5c0989 --- /dev/null +++ b/lib/function/once/method.ts @@ -0,0 +1,10 @@ +// tslint:disable-next-line:ban-types +const method = (func: Function, ...args: any[]): any => { + if (func.called) return; + + func.called = true; + + return func.call(func, ...args); +}; + +export = method; diff --git a/lib/index.ts b/lib/index.ts index 096d8ea7..7baa8616 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,8 +1,8 @@ -import './array' -import './boolean' -import './date' -import './function' -import './math' -import './number' -import './object' -import './string' +import "./array"; +import "./boolean"; +import "./date"; +import "./function"; +import "./math"; +import "./number"; +import "./object"; +import "./string"; diff --git a/lib/math/average/index.ts b/lib/math/average/index.ts index 3073bc7d..015d3aab 100644 --- a/lib/math/average/index.ts +++ b/lib/math/average/index.ts @@ -1,9 +1,9 @@ -export { } +import * as method from "./method"; declare global { interface Math { - average(...nums: Array): number - avg(...nums: Array): number + average(...nums: number[]): number; + avg(...nums: number[]): number; } } @@ -16,7 +16,7 @@ declare global { * Math.average(...[1, 2, 3]); // 2 * Math.average(1, 2, 3); // 2 */ -Math.average = (...nums: Array): number => [...nums].reduce((prev, val) => prev + val, 0) / nums.length +Math.average = method; /** * Returns the average of an of two or more numbers @@ -27,4 +27,4 @@ Math.average = (...nums: Array): number => [...nums].reduce((prev, val) * Math.avg(...[1, 2, 3]); // 2 * Math.avg(1, 2, 3); // 2 */ -Math.avg = Math.average +Math.avg = Math.average; diff --git a/lib/math/average/method.ts b/lib/math/average/method.ts new file mode 100644 index 00000000..b04d96ad --- /dev/null +++ b/lib/math/average/method.ts @@ -0,0 +1,5 @@ +import * as sum from "../../array/sum/method"; + +const method = (...nums: number[]): number => sum(nums) / nums.length; + +export = method; diff --git a/lib/math/average/test.js b/lib/math/average/test.ts similarity index 66% rename from lib/math/average/test.js rename to lib/math/average/test.ts index 50e1940d..7a75a70a 100644 --- a/lib/math/average/test.js +++ b/lib/math/average/test.ts @@ -1,8 +1,8 @@ -require('../../../es6/math/average') +import "./index"; describe("Math.average", () => { test("Math.average(1, 2, 3) returns 2", () => { expect(Math.average(1, 2, 3)) - .toBe(2) - }) -}) + .toBe(2); + }); +}); diff --git a/lib/math/factorial/index.ts b/lib/math/factorial/index.ts index 50aacd94..931c05e1 100644 --- a/lib/math/factorial/index.ts +++ b/lib/math/factorial/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Math { - factorial(n: number): number + factorial(n: number): number; } } @@ -14,4 +14,4 @@ declare global { * @example * Math.factorial(6); // 720 */ -Math.factorial = (n: number): number => n <= 1 ? 1 : n * Math.factorial(n - 1) +Math.factorial = method; diff --git a/lib/math/factorial/method.ts b/lib/math/factorial/method.ts new file mode 100644 index 00000000..9ecabc72 --- /dev/null +++ b/lib/math/factorial/method.ts @@ -0,0 +1,3 @@ +const method = (n: number): number => n <= 1 ? 1 : n * Math.factorial(n - 1); + +export = method; diff --git a/lib/math/factorial/test.js b/lib/math/factorial/test.ts similarity index 64% rename from lib/math/factorial/test.js rename to lib/math/factorial/test.ts index 73312e6e..229aaf29 100644 --- a/lib/math/factorial/test.js +++ b/lib/math/factorial/test.ts @@ -1,8 +1,8 @@ -require('../../../es6/math/factorial') +import "./index"; describe("Math.factorial", () => { test("Math.factorial(6) returns 720", () => { expect(Math.factorial(6)) - .toBe(720) - }) -}) + .toBe(720); + }); +}); diff --git a/lib/math/fibonacci/index.ts b/lib/math/fibonacci/index.ts index 3e78f5c5..070887e9 100644 --- a/lib/math/fibonacci/index.ts +++ b/lib/math/fibonacci/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Math { - fibonacci(nth: number): Array + fibonacci(nth: number): number[]; } } @@ -14,7 +14,4 @@ declare global { * @example * Math.fibonacci(6); // [0, 1, 1, 2, 3, 5] */ -Math.fibonacci = (nth: number): Array => Array.from({ length: nth }).reduce( - (acc: any, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i), - [] -) +Math.fibonacci = method; diff --git a/lib/math/fibonacci/method.ts b/lib/math/fibonacci/method.ts new file mode 100644 index 00000000..c6f5a949 --- /dev/null +++ b/lib/math/fibonacci/method.ts @@ -0,0 +1,6 @@ +const method = (nth: number): number[] => Array.from({ length: nth }).reduce( + (acc: any, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i), + [], +); + +export = method; diff --git a/lib/math/fibonacci/test.js b/lib/math/fibonacci/test.ts similarity index 61% rename from lib/math/fibonacci/test.js rename to lib/math/fibonacci/test.ts index 649d9fb6..b1e09d67 100644 --- a/lib/math/fibonacci/test.js +++ b/lib/math/fibonacci/test.ts @@ -1,8 +1,8 @@ -require('../../../es6/math/fibonacci') +import "./index"; describe("Math.fibonacci", () => { test("Math.fibonacci(6) returns [0, 1, 1, 2, 3, 5]", () => { expect(Math.fibonacci(6)) - .toEqual([0, 1, 1, 2, 3, 5]) - }) -}) + .toEqual([0, 1, 1, 2, 3, 5]); + }); +}); diff --git a/lib/math/gcd/index.ts b/lib/math/gcd/index.ts index 098c9710..405681fb 100644 --- a/lib/math/gcd/index.ts +++ b/lib/math/gcd/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Math { - gcd(...nums: Array): number + gcd(...nums: number[]): number; } } @@ -15,8 +15,4 @@ declare global { * Math.gcd(8, 36); // 4 * Math.gcd(...[12, 8, 32]); // 4 */ -Math.gcd = (...nums: Array): number => { - const gcd = (x: number, y: number) => (!y ? x : Math.gcd(y, x % y)) - - return [...nums].reduce((a, b) => gcd(a, b)) -} +Math.gcd = method; diff --git a/lib/math/gcd/method.ts b/lib/math/gcd/method.ts new file mode 100644 index 00000000..9d5c1b3d --- /dev/null +++ b/lib/math/gcd/method.ts @@ -0,0 +1,7 @@ +const method = (...nums: number[]): number => { + const gcd = (x: number, y: number) => (!y ? x : Math.gcd(y, x % y)); + + return nums.reduce((a, b) => gcd(a, b)); +}; + +export = method; diff --git a/lib/math/gcd/test.js b/lib/math/gcd/test.ts similarity index 68% rename from lib/math/gcd/test.js rename to lib/math/gcd/test.ts index cc6e2ffb..8f04d547 100644 --- a/lib/math/gcd/test.js +++ b/lib/math/gcd/test.ts @@ -1,8 +1,8 @@ -require('../../../es6/math/gcd') +import "./index"; describe("Math.gcd", () => { test("Math.gcd(...[12, 8, 32]) returns 4", () => { expect(Math.gcd(...[12, 8, 32])) - .toBe(4) - }) -}) + .toBe(4); + }); +}); diff --git a/lib/math/index.ts b/lib/math/index.ts index f3a291ae..882dabb9 100644 --- a/lib/math/index.ts +++ b/lib/math/index.ts @@ -1,9 +1,9 @@ /** @namespace Math */ -import './average' -import './factorial' -import './fibonacci' -import './gcd' -import './isEven' -import './isPrime' -import './lcm' +import "./average"; +import "./factorial"; +import "./fibonacci"; +import "./gcd"; +import "./isEven"; +import "./isPrime"; +import "./lcm"; diff --git a/lib/math/isEven/index.ts b/lib/math/isEven/index.ts index a7734318..27c76552 100644 --- a/lib/math/isEven/index.ts +++ b/lib/math/isEven/index.ts @@ -1,9 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Math { - isEven(num: number): boolean - isPrime(num: number): boolean + isEven(num: number): boolean; } } @@ -15,4 +14,4 @@ declare global { * @example * Math.isEven(3); // false */ -Math.isEven = (num: number): boolean => num % 2 === 0 +Math.isEven = method; diff --git a/lib/math/isEven/method.ts b/lib/math/isEven/method.ts new file mode 100644 index 00000000..c96c3ce4 --- /dev/null +++ b/lib/math/isEven/method.ts @@ -0,0 +1,3 @@ +const method = (num: number): boolean => num % 2 === 0; + +export = method; diff --git a/lib/math/isEven/test.js b/lib/math/isEven/test.ts similarity index 62% rename from lib/math/isEven/test.js rename to lib/math/isEven/test.ts index fca4f3c8..08b21cf5 100644 --- a/lib/math/isEven/test.js +++ b/lib/math/isEven/test.ts @@ -1,8 +1,8 @@ -require('../../../es6/math/isEven') +import "./index"; describe("Math.isEven", () => { test("Math.isEven(3) returns false", () => { expect(Math.isEven(3)) - .toBe(false) - }) -}) + .toBe(false); + }); +}); diff --git a/lib/math/isPrime/index.ts b/lib/math/isPrime/index.ts index b0bf1e58..022d0c27 100644 --- a/lib/math/isPrime/index.ts +++ b/lib/math/isPrime/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Math { - isPrime(num: number): boolean + isPrime(num: number): boolean; } } @@ -14,10 +14,4 @@ declare global { * @example * Math.isPrime(11); // true */ -Math.isPrime = (num: number): boolean => { - const boundary = Math.floor(Math.sqrt(num)) - - for (let i = 2; i <= boundary; i++) if (num % i == 0) return false - - return num >= 2 -} +Math.isPrime = method; diff --git a/lib/math/isPrime/method.ts b/lib/math/isPrime/method.ts new file mode 100644 index 00000000..3acc78cf --- /dev/null +++ b/lib/math/isPrime/method.ts @@ -0,0 +1,10 @@ +const method = (num: number): boolean => { + const boundary = Math.floor(Math.sqrt(num)); + let i = 2; + + for (; i <= boundary; i++) if (num % i === 0) return false; + + return num >= 2; +}; + +export = method; diff --git a/lib/math/isPrime/test.js b/lib/math/isPrime/test.ts similarity index 63% rename from lib/math/isPrime/test.js rename to lib/math/isPrime/test.ts index 72794227..13132cac 100644 --- a/lib/math/isPrime/test.js +++ b/lib/math/isPrime/test.ts @@ -1,8 +1,8 @@ -require('../../../es6/math/isPrime') +import "./index"; describe("Math.isPrime", () => { test("Math.isPrime(11) returns true", () => { expect(Math.isPrime(11)) - .toBe(true) - }) -}) + .toBe(true); + }); +}); diff --git a/lib/math/lcm/index.ts b/lib/math/lcm/index.ts index a5cdf1c9..27e543fe 100644 --- a/lib/math/lcm/index.ts +++ b/lib/math/lcm/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface Math { - lcm(...nums: Array): number + lcm(...nums: number[]): number; } } @@ -15,10 +15,4 @@ declare global { * Math.lcm(12, 7); // 84 * Math.lcm(...[1, 3, 4, 5]); // 60 */ -Math.lcm = (...nums: Array): number => { - const gcd: (x: number, y: number) => number = (x, y) => (!y ? x : gcd(y, x % y)) - - const lcm: (x: number, y: number) => number = (x, y) => x * y / gcd(x, y) - - return [...nums].reduce((a, b) => lcm(a, b)) -} +Math.lcm = method; diff --git a/lib/math/lcm/method.ts b/lib/math/lcm/method.ts new file mode 100644 index 00000000..4b82628d --- /dev/null +++ b/lib/math/lcm/method.ts @@ -0,0 +1,9 @@ +const method = (...nums: number[]): number => { + const gcd: (x: number, y: number) => number = (x, y) => (!y ? x : gcd(y, x % y)); + + const lcm: (x: number, y: number) => number = (x, y) => x * y / gcd(x, y); + + return nums.reduce((a, b) => lcm(a, b)); +}; + +export = method; diff --git a/lib/math/lcm/test.js b/lib/math/lcm/test.ts similarity index 64% rename from lib/math/lcm/test.js rename to lib/math/lcm/test.ts index 3ca73875..02b8fca4 100644 --- a/lib/math/lcm/test.js +++ b/lib/math/lcm/test.ts @@ -1,8 +1,8 @@ -require('../../../es6/math/lcm') +import "./index"; describe("Math.lcm", () => { test("Math.lcm(12, 7) returns 84", () => { expect(Math.lcm(12, 7)) - .toBe(84) - }) -}) + .toBe(84); + }); +}); diff --git a/lib/number/index.ts b/lib/number/index.ts index a04abe90..23de7be4 100644 --- a/lib/number/index.ts +++ b/lib/number/index.ts @@ -1,3 +1,3 @@ /** @namespace Number */ -import './isInstance' +import "./isInstance"; diff --git a/lib/number/isInstance/index.ts b/lib/number/isInstance/index.ts index bcbbe963..333dd9c5 100644 --- a/lib/number/isInstance/index.ts +++ b/lib/number/isInstance/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface NumberConstructor { - isInstance(arg: any): arg is Number + isInstance(arg: any): arg is number; } } @@ -15,4 +15,4 @@ declare global { * Number.isInstance('foo bar'); // false * Number.isInstance(2); // true */ -Number.isInstance = (arg: any): arg is Number => !isNaN(arg) +Number.isInstance = method; diff --git a/lib/number/isInstance/method.ts b/lib/number/isInstance/method.ts new file mode 100644 index 00000000..02bfc350 --- /dev/null +++ b/lib/number/isInstance/method.ts @@ -0,0 +1,3 @@ +const method = (arg: any): arg is number => !isNaN(arg); + +export = method; diff --git a/lib/number/isInstance/test.js b/lib/number/isInstance/test.js deleted file mode 100644 index 96c95ef3..00000000 --- a/lib/number/isInstance/test.js +++ /dev/null @@ -1,13 +0,0 @@ -require('../../../es6/number/isInstance') - -describe("Number.isInstance", () => { - test("Number.isInstance('foo bar') returns false", () => { - expect(Number.isInstance('foo bar')) - .toBe(false) - }) - - test("Number.isInstance(2) returns true", () => { - expect(Number.isInstance(2)) - .toBe(true) - }) -}) diff --git a/lib/number/isInstance/test.ts b/lib/number/isInstance/test.ts new file mode 100644 index 00000000..d0278f4f --- /dev/null +++ b/lib/number/isInstance/test.ts @@ -0,0 +1,13 @@ +import "./index"; + +describe("Number.isInstance", () => { + test("Number.isInstance(\"foo bar\") returns false", () => { + expect(Number.isInstance("foo bar")) + .toBe(false); + }); + + test("Number.isInstance(2) returns true", () => { + expect(Number.isInstance(2)) + .toBe(true); + }); +}); diff --git a/lib/object/index.ts b/lib/object/index.ts index bc0647f6..a51740b7 100644 --- a/lib/object/index.ts +++ b/lib/object/index.ts @@ -1,9 +1,9 @@ /** @namespace Object */ -import './invert' -import './isInstance' -import './lowerCaseKeys' -import './map' -import './mapKeys' -import './merge' -import './size' +import "./invert"; +import "./isInstance"; +import "./lowerCaseKeys"; +import "./map"; +import "./mapKeys"; +import "./merge"; +import "./size"; diff --git a/lib/object/invert/index.ts b/lib/object/invert/index.ts index 33117a0f..bf4390f9 100644 --- a/lib/object/invert/index.ts +++ b/lib/object/invert/index.ts @@ -1,10 +1,9 @@ -import { addPrototype } from '../utils' - -export { } +import * as method from "./method"; +import { addPrototype } from "../utils"; declare global { interface Object { - $invert(): object + $invert(): object; } } @@ -13,14 +12,10 @@ declare global { * @memberof Object.prototype * @returns {Object} * @example - * { name: 'John', age: 20 }.$invert(); // { 20: 'age', John: 'name' } + * { name: "John", age: 20 }.$invert(); // { 20: "age", John: "name" } */ -function $invert(this: { [key: string]: any }): object { - return Object.keys(this).reduce((acc: { [key: string]: any }, key) => { - acc[this[key]] = key - - return acc - }, {}) +function $invert(this: object): object { + return method(this); } -addPrototype('$invert', $invert) +addPrototype($invert); diff --git a/lib/object/invert/method.ts b/lib/object/invert/method.ts new file mode 100644 index 00000000..33b71b7b --- /dev/null +++ b/lib/object/invert/method.ts @@ -0,0 +1,9 @@ +const method = (obj: { [key: string]: any }): object => { + return Object.keys(obj).reduce((acc: { [key: string]: any }, key) => { + acc[obj[key]] = key; + + return acc; + }, {}); +}; + +export = method; diff --git a/lib/object/invert/test.js b/lib/object/invert/test.js deleted file mode 100644 index 37b30c37..00000000 --- a/lib/object/invert/test.js +++ /dev/null @@ -1,8 +0,0 @@ -require('../../../es6/object/invert') - -describe("Object.prototype.$invert", () => { - test("{ name: 'John', age: 20 }.$invert() returns { 20: 'age', John: 'name' }", () => { - expect({ name: 'John', age: 20 }.$invert()) - .toEqual({ 20: 'age', John: 'name' }) - }) -}) diff --git a/lib/object/invert/test.ts b/lib/object/invert/test.ts new file mode 100644 index 00000000..b69624fb --- /dev/null +++ b/lib/object/invert/test.ts @@ -0,0 +1,8 @@ +import "./index"; + +describe("Object.prototype.$invert", () => { + test("{ name: \"John\", age: 20 }.$invert() returns { 20: \"age\", John: \"name\" }", () => { + expect({ name: "John", age: 20 }.$invert()) + .toEqual({ 20: "age", John: "name" }); + }); +}); diff --git a/lib/object/isInstance/index.ts b/lib/object/isInstance/index.ts index ad89922c..2afbc860 100644 --- a/lib/object/isInstance/index.ts +++ b/lib/object/isInstance/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface ObjectConstructor { - isInstance(arg: any): arg is object + isInstance(arg: any): arg is object; } } @@ -15,4 +15,4 @@ declare global { * Object.isInstance(2); // false * Object.isInstance({foo: 'bar'}); // true */ -Object.isInstance = (arg: any): arg is object => arg instanceof Object +Object.isInstance = method; diff --git a/lib/object/isInstance/method.ts b/lib/object/isInstance/method.ts new file mode 100644 index 00000000..598e46c0 --- /dev/null +++ b/lib/object/isInstance/method.ts @@ -0,0 +1,3 @@ +const method = (arg: any): arg is object => arg instanceof Object; + +export = method; diff --git a/lib/object/isInstance/test.js b/lib/object/isInstance/test.js deleted file mode 100644 index d0d5b0c3..00000000 --- a/lib/object/isInstance/test.js +++ /dev/null @@ -1,11 +0,0 @@ -require('../../../es6/object/isInstance') - -describe("Object.isInstance", () => { - test("Object.isInstance(2) returns false", () => { - expect(Object.isInstance(2)).toBe(false) - }) - - test("Object.isInstance({foo: 'bar'}) returns true", () => { - expect(Object.isInstance({foo: 'bar'})).toBe(true) - }) -}) diff --git a/lib/object/isInstance/test.ts b/lib/object/isInstance/test.ts new file mode 100644 index 00000000..f92ebfbb --- /dev/null +++ b/lib/object/isInstance/test.ts @@ -0,0 +1,11 @@ +import "./index"; + +describe("Object.isInstance", () => { + test("Object.isInstance(2) returns false", () => { + expect(Object.isInstance(2)).toBe(false); + }); + + test("Object.isInstance({foo: \"bar\"}) returns true", () => { + expect(Object.isInstance({foo: "bar"})).toBe(true); + }); +}); diff --git a/lib/object/lowerCaseKeys/index.ts b/lib/object/lowerCaseKeys/index.ts index b1e2ec09..6e14213e 100644 --- a/lib/object/lowerCaseKeys/index.ts +++ b/lib/object/lowerCaseKeys/index.ts @@ -1,10 +1,9 @@ -import { addPrototype } from '../utils' - -export { } +import * as method from "./method"; +import { addPrototype } from "../utils"; declare global { interface Object { - $lowerCaseKeys(): object + $lowerCaseKeys(): object; } } @@ -13,15 +12,11 @@ declare global { * @memberof Object.prototype * @returns {Object} * @example - * const myObj = { Name: 'Adam', sUrnAME: 'Smith' }; - * const myObjLower = myObj.$lowerCaseKeys(); // {name: 'Adam', surname: 'Smith'} + * const myObj = { Name: "Adam", sUrnAME: "Smith" }; + * const myObjLower = myObj.$lowerCaseKeys(); // {name: "Adam", surname: "Smith"} */ -function $lowerCaseKeys(this: { [key: string]: any }): object { - return Object.keys(this).reduce((acc: { [key: string]: any }, key) => { - acc[key.toLowerCase()] = this[key] - - return acc - }, {}) +function $lowerCaseKeys(this: object): object { + return method(this); } -addPrototype('$lowerCaseKeys', $lowerCaseKeys) +addPrototype($lowerCaseKeys); diff --git a/lib/object/lowerCaseKeys/method.ts b/lib/object/lowerCaseKeys/method.ts new file mode 100644 index 00000000..2fe3efbe --- /dev/null +++ b/lib/object/lowerCaseKeys/method.ts @@ -0,0 +1,9 @@ +const method = (obj: { [key: string]: any }): object => { + return Object.keys(obj).reduce((acc: { [key: string]: any }, key) => { + acc[key.toLowerCase()] = obj[key]; + + return acc; + }, {}); +}; + +export = method; diff --git a/lib/object/lowerCaseKeys/test.js b/lib/object/lowerCaseKeys/test.js deleted file mode 100644 index efa3e0cf..00000000 --- a/lib/object/lowerCaseKeys/test.js +++ /dev/null @@ -1,7 +0,0 @@ -require('../../../es6/object/lowerCaseKeys') - -describe("Object.prototype.$lowerCaseKeys", () => { - test("{ Name: 'Adam', sUrnAME: 'Smith' }.$lowerCaseKeys() returns {name: 'Adam', surname: 'Smith'}", () => { - expect({ Name: 'Adam', sUrnAME: 'Smith' }.$lowerCaseKeys()).toEqual({name: 'Adam', surname: 'Smith'}) - }) -}) diff --git a/lib/object/lowerCaseKeys/test.ts b/lib/object/lowerCaseKeys/test.ts new file mode 100644 index 00000000..435980de --- /dev/null +++ b/lib/object/lowerCaseKeys/test.ts @@ -0,0 +1,8 @@ +import "./index"; + +describe("Object.prototype.$lowerCaseKeys", () => { + test("{ Name: \"Adam\", sUrnAME: \"Smith\" }.$lowerCaseKeys() returns {name: \"Adam\", surname: \"Smith\"}", () => { + expect({ Name: "Adam", sUrnAME: "Smith" }.$lowerCaseKeys()) + .toEqual({ name: "Adam", surname: "Smith" }); + }); +}); diff --git a/lib/object/map/index.ts b/lib/object/map/index.ts index 84168b40..2683a3e8 100644 --- a/lib/object/map/index.ts +++ b/lib/object/map/index.ts @@ -1,31 +1,27 @@ -import { addPrototype } from '../utils' - -export { } +import * as method from "./method"; +import { addPrototype } from "../utils"; declare global { interface Object { - $map(fn: (value: any, key: string | number, object: object) => any): object + $map(fn: (value: any, key: string | number, object: object) => any): object; } } /** - * Creates an object with the same keys as the provided object and values generated by running the provided function for each value + * Creates an object with the same keys as the provided object and values + * generated by running the provided function for each value * @memberof Object.prototype * @param {function} fn * @returns {Object} * @example * const users = { - * fred: { user: 'fred', age: 40 }, - * pebbles: { user: 'pebbles', age: 1 } + * fred: { user: "fred", age: 40 }, + * pebbles: { user: "pebbles", age: 1 } * }; * users.$map(u => u.age); // { fred: 40, pebbles: 1 } */ -function $map(this: { [key: string]: any }, fn: (value: any, key: string | number, object: object) => any): object { - return Object.keys(this).reduce((acc: { [key: string]: any }, k) => { - acc[k] = fn(this[k], k, this) - - return acc - }, {}) +function $map(this: object, fn: (value: any, key: string | number, object: object) => any): object { + return method(this, fn); } -addPrototype('$map', $map) +addPrototype($map); diff --git a/lib/object/map/method.ts b/lib/object/map/method.ts new file mode 100644 index 00000000..924daa07 --- /dev/null +++ b/lib/object/map/method.ts @@ -0,0 +1,9 @@ +const method = (obj: { [key: string]: any }, fn: (value: any, key: string | number, object: object) => any): object => { + return Object.keys(obj).reduce((acc: { [key: string]: any }, k) => { + acc[k] = fn(obj[k], k, obj); + + return acc; + }, {}); +}; + +export = method; diff --git a/lib/object/map/test.js b/lib/object/map/test.js deleted file mode 100644 index 6cb20f87..00000000 --- a/lib/object/map/test.js +++ /dev/null @@ -1,7 +0,0 @@ -require('../../../es6/object/map') - -describe("Object.prototype.$map", () => { - test("{fred: { user: 'fred', age: 40 }, pebbles: { user: 'pebbles', age: 1 }}.$map(u => u.age) returns { fred: 40, pebbles: 1 }", () => { - expect({fred: { user: 'fred', age: 40 }, pebbles: { user: 'pebbles', age: 1 }}.$map(u => u.age)).toEqual({ fred: 40, pebbles: 1 }) - }) -}) diff --git a/lib/object/map/test.ts b/lib/object/map/test.ts new file mode 100644 index 00000000..d2016359 --- /dev/null +++ b/lib/object/map/test.ts @@ -0,0 +1,11 @@ +import "./index"; + +describe("Object.prototype.$map", () => { + test( + "{fred: { user: \"fred\", age: 40 }, pebbles: { user: \"pebbles\", age: 1 }}.$map(u => u.age) returns " + + "{ fred: 40, pebbles: 1 }", + () => { + expect({ fred: { user: "fred", age: 40 }, pebbles: { user: "pebbles", age: 1 } }.$map((u) => u.age)) + .toEqual({ fred: 40, pebbles: 1 }); + }); +}); diff --git a/lib/object/mapKeys/index.ts b/lib/object/mapKeys/index.ts index cc7e1b8b..98f89d59 100644 --- a/lib/object/mapKeys/index.ts +++ b/lib/object/mapKeys/index.ts @@ -1,27 +1,23 @@ -import { addPrototype } from '../utils' - -export { } +import * as method from "./method"; +import { addPrototype } from "../utils"; declare global { interface Object { - $mapKeys(fn: (value: any, key: string | number, object: object) => any): object + $mapKeys(fn: (value: any, key: string | number, object: object) => any): object; } } /** - * Creates an object with keys generated by running the provided function for each key and the same values as the provided object + * Creates an object with keys generated by running the provided function for each key + * and the same values as the provided object * @memberof Object.prototype * @param {function} fn * @returns {Object} * @example * { a: 1, b: 2 }.$mapKeys((val, key) => key + val); // { a1: 1, b2: 2 } */ -function $mapKeys(this: { [key: string]: any }, fn: (value: any, key: string | number, object: object) => any): object { - return Object.keys(this).reduce((acc: { [key: string]: any }, k) => { - acc[fn(this[k], k, this)] = this[k] - - return acc - }, {}) +function $mapKeys(this: object, fn: (value: any, key: string | number, object: object) => any): object { + return method(this, fn); } -addPrototype('$mapKeys', $mapKeys) +addPrototype($mapKeys); diff --git a/lib/object/mapKeys/method.ts b/lib/object/mapKeys/method.ts new file mode 100644 index 00000000..0f28aa8a --- /dev/null +++ b/lib/object/mapKeys/method.ts @@ -0,0 +1,9 @@ +const method = (obj: { [key: string]: any }, fn: (value: any, key: string | number, object: object) => any): object => { + return Object.keys(obj).reduce((acc: { [key: string]: any }, k) => { + acc[fn(obj[k], k, obj)] = obj[k]; + + return acc; + }, {}); +}; + +export = method; diff --git a/lib/object/mapKeys/test.js b/lib/object/mapKeys/test.ts similarity index 74% rename from lib/object/mapKeys/test.js rename to lib/object/mapKeys/test.ts index cf130d93..761033b6 100644 --- a/lib/object/mapKeys/test.js +++ b/lib/object/mapKeys/test.ts @@ -1,7 +1,7 @@ -require('../../../es6/object/mapKeys') +import "./index"; describe("Object.prototype.$mapKeys", () => { test("{ a: 1, b: 2 }.$mapKeys((val, key) => key + val) returns { a1: 1, b2: 2 }", () => { - expect({ a: 1, b: 2 }.$mapKeys((val, key) => key + val)).toEqual({ a1: 1, b2: 2 }) - }) -}) + expect({ a: 1, b: 2 }.$mapKeys((val, key) => key + val)).toEqual({ a1: 1, b2: 2 }); + }); +}); diff --git a/lib/object/merge/index.ts b/lib/object/merge/index.ts index 726bd802..158fd571 100644 --- a/lib/object/merge/index.ts +++ b/lib/object/merge/index.ts @@ -1,10 +1,9 @@ -import { addPrototype } from '../utils' - -export { } +import * as method from "./method"; +import { addPrototype } from "../utils"; declare global { interface Object { - $merge(...objects: Array): object + $merge(...objects: object[]): object; } } @@ -21,22 +20,12 @@ declare global { * const other = { * a: { z: 3 }, * b: [2, 3], - * c: 'foo' + * c: "foo" * }; - * object.$merge(other); // { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' } + * object.$merge(other); // { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: "foo" } */ -function $merge(this: { [key: string]: any }, ...objects: Array): object { - objects = [this, ...objects] - - return [...objects].reduce( - (acc: { [key: string]: any }, obj: { [key: string]: any }) => - Object.keys(obj).reduce((a, k) => { - acc[k] = acc.hasOwnProperty(k) ? [].concat(acc[k]).concat(obj[k]) : obj[k] - - return acc - }, {}), - {} - ) +function $merge(this: object, ...objects: object[]): object { + return method(this, ...objects); } -addPrototype('$merge', $merge) +addPrototype($merge); diff --git a/lib/object/merge/method.ts b/lib/object/merge/method.ts new file mode 100644 index 00000000..da08f652 --- /dev/null +++ b/lib/object/merge/method.ts @@ -0,0 +1,15 @@ +const method = (obj: { [key: string]: any }, ...objects: object[]): object => { + objects = [obj, ...objects]; + + return objects.reduce( + (acc: { [key: string]: any }, obj: { [key: string]: any }) => + Object.keys(obj).reduce((a, k) => { + acc[k] = acc.hasOwnProperty(k) ? [].concat(acc[k]).concat(obj[k]) : obj[k]; + + return acc; + }, {}), + {}, + ); +}; + +export = method; diff --git a/lib/object/merge/test.js b/lib/object/merge/test.js deleted file mode 100644 index 84844f2b..00000000 --- a/lib/object/merge/test.js +++ /dev/null @@ -1,8 +0,0 @@ -require('../../../es6/object/merge') - -describe("Object.prototype.$merge", () => { - test("{a: [{ x: 2 }, { y: 4 }], b: 1}.$merge({a: { z: 3 }, b: [2, 3], c: 'foo'}) returns { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' }", () => { - expect({a: [{ x: 2 }, { y: 4 }], b: 1}.$merge({a: { z: 3 }, b: [2, 3], c: 'foo'})) - .toEqual({ a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' }) - }) -}) diff --git a/lib/object/merge/test.ts b/lib/object/merge/test.ts new file mode 100644 index 00000000..91912cb7 --- /dev/null +++ b/lib/object/merge/test.ts @@ -0,0 +1,11 @@ +import "./index"; + +describe("Object.prototype.$merge", () => { + test( + "{a: [{ x: 2 }, { y: 4 }], b: 1}.$merge({a: { z: 3 }, b: [2, 3], c: \"foo\"}) returns " + + "{ a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: \"foo\" }", + () => { + expect({ a: [{ x: 2 }, { y: 4 }], b: 1 }.$merge({ a: { z: 3 }, b: [2, 3], c: "foo" })) + .toEqual({ a: [{ x: 2 }, { y: 4 }, { z: 3 }], b: [1, 2, 3], c: "foo" }); + }); +}); diff --git a/lib/object/size/index.ts b/lib/object/size/index.ts index 967a8a5b..c107c9a6 100644 --- a/lib/object/size/index.ts +++ b/lib/object/size/index.ts @@ -1,10 +1,9 @@ -import { addPrototype } from '../utils' - -export { } +import * as method from "./method"; +import { addPrototype } from "../utils"; declare global { interface Object { - $size(): number + $size(): number; } } @@ -15,8 +14,8 @@ declare global { * @example * { one: 1, two: 2, three: 3 }.$size(); // 3 */ -function $size(this: { [key: string]: any }): number { - return Object.keys(this).length +function $size(this: object): number { + return method(this); } -addPrototype('$size', $size) +addPrototype($size); diff --git a/lib/object/size/method.ts b/lib/object/size/method.ts new file mode 100644 index 00000000..3f401e5a --- /dev/null +++ b/lib/object/size/method.ts @@ -0,0 +1,3 @@ +const method = (obj: { [key: string]: any }): number => Object.keys(obj).length; + +export = method; diff --git a/lib/object/size/test.js b/lib/object/size/test.ts similarity index 72% rename from lib/object/size/test.js rename to lib/object/size/test.ts index 0b5a7944..2b7b4c21 100644 --- a/lib/object/size/test.js +++ b/lib/object/size/test.ts @@ -1,8 +1,8 @@ -require('../../../es6/object/size') +import "./index"; describe("Object.prototype.$size", () => { test("{ one: 1, two: 2, three: 3 }.$size() returns 3", () => { expect({ one: 1, two: 2, three: 3 }.$size()) - .toBe(3) - }) -}) + .toBe(3); + }); +}); diff --git a/lib/object/utils.ts b/lib/object/utils.ts index 17f83653..7d1e0025 100644 --- a/lib/object/utils.ts +++ b/lib/object/utils.ts @@ -1,12 +1,14 @@ -export const addPrototype = (key: string, extension: any) => { - if (Object.prototype.hasOwnProperty(key)) return +export const addPrototype = (extension: any) => { + const key = extension.name; + + if (Object.prototype.hasOwnProperty(key)) return; Object.defineProperty( Object.prototype, key, { value: extension, - writable: true - } - ) -} + writable: true, + }, + ); +}; diff --git a/lib/string/base64/index.ts b/lib/string/base64/index.ts index 146f28d5..ead16409 100644 --- a/lib/string/base64/index.ts +++ b/lib/string/base64/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - base64(): string + base64(): string; } } @@ -13,6 +13,6 @@ declare global { * @example * 'prototyped.js'.base64(); // 'cHJvdG90eXBlZC5qcw==' */ -String.prototype.base64 = function(): string { - return new Buffer(`${this}`).toString('base64') -} +String.prototype.base64 = function() { + return method(this as string); +}; diff --git a/lib/string/base64/method.ts b/lib/string/base64/method.ts new file mode 100644 index 00000000..789da91c --- /dev/null +++ b/lib/string/base64/method.ts @@ -0,0 +1,3 @@ +const method = (str: string) => new Buffer(str).toString("base64"); + +export = method; diff --git a/lib/string/base64/test.js b/lib/string/base64/test.js deleted file mode 100644 index 4ebd94cf..00000000 --- a/lib/string/base64/test.js +++ /dev/null @@ -1,8 +0,0 @@ -require('../../../es6/string/base64') - -describe("String.prototype.base64", () => { - test("'prototyped.js'.base64() returns 'cHJvdG90eXBlZC5qcw=='", () => { - expect('prototyped.js'.base64()) - .toBe('cHJvdG90eXBlZC5qcw==') - }) -}) diff --git a/lib/string/base64/test.ts b/lib/string/base64/test.ts new file mode 100644 index 00000000..0981cf92 --- /dev/null +++ b/lib/string/base64/test.ts @@ -0,0 +1,8 @@ +import "./index"; + +describe("String.prototype.base64", () => { + test("\"prototyped.js\".base64() returns \"cHJvdG90eXBlZC5qcw==\"", () => { + expect("prototyped.js".base64()) + .toBe("cHJvdG90eXBlZC5qcw=="); + }); +}); diff --git a/lib/string/base64Decode/index.ts b/lib/string/base64Decode/index.ts index ca3c752e..7514537e 100644 --- a/lib/string/base64Decode/index.ts +++ b/lib/string/base64Decode/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - base64Decode(): string + base64Decode(): string; } } @@ -11,8 +11,8 @@ declare global { * @memberof String * @returns {string} * @example - * 'cHJvdG90eXBlZC5qcw=='.base64Decode(); // 'prototyped.js' + * "cHJvdG90eXBlZC5qcw==".base64Decode(); // "prototyped.js" */ -String.prototype.base64Decode = function(): string { - return new Buffer(`${this}`, 'base64').toString() -} +String.prototype.base64Decode = function() { + return method(this as string); +}; diff --git a/lib/string/base64Decode/method.ts b/lib/string/base64Decode/method.ts new file mode 100644 index 00000000..f61f7e67 --- /dev/null +++ b/lib/string/base64Decode/method.ts @@ -0,0 +1,3 @@ +const method = (str: string) => new Buffer(str, "base64").toString(); + +export = method; diff --git a/lib/string/base64Decode/test.js b/lib/string/base64Decode/test.js deleted file mode 100644 index 9a3a13c1..00000000 --- a/lib/string/base64Decode/test.js +++ /dev/null @@ -1,8 +0,0 @@ -require('../../../es6/string/base64Decode') - -describe("String.prototype.base64Decode", () => { - test("'cHJvdG90eXBlZC5qcw=='.base64Decode() returns 'prototyped.js'", () => { - expect('cHJvdG90eXBlZC5qcw=='.base64Decode()) - .toBe('prototyped.js') - }) -}) diff --git a/lib/string/base64Decode/test.ts b/lib/string/base64Decode/test.ts new file mode 100644 index 00000000..c611bed4 --- /dev/null +++ b/lib/string/base64Decode/test.ts @@ -0,0 +1,8 @@ +import "./index"; + +describe("String.prototype.base64Decode", () => { + test("\"cHJvdG90eXBlZC5qcw==\".base64Decode() returns \"prototyped.js\"", () => { + expect("cHJvdG90eXBlZC5qcw==".base64Decode()) + .toBe("prototyped.js"); + }); +}); diff --git a/lib/string/camelCase/index.ts b/lib/string/camelCase/index.ts index 12d5ebf2..b93a54c4 100644 --- a/lib/string/camelCase/index.ts +++ b/lib/string/camelCase/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - camelCase(): string + camelCase(): string; } } @@ -11,17 +11,12 @@ declare global { * @memberof String * @returns {string} * @example - * 'some_database_field_name'.camelCase(); // 'someDatabaseFieldName' - * 'Some label that needs to be camelized'.camelCase(); // 'someLabelThatNeedsToBeCamelized' - * 'some-javascript-property'.camelCase(); // 'someJavascriptProperty' - * 'some-mixed_string with spaces_underscores-and-hyphens'.camelCase(); // 'someMixedStringWithSpacesUnderscoresAndHyphens' + * "some_database_field_name".camelCase(); // "someDatabaseFieldName" + * "Some label that needs to be camelized".camelCase(); // "someLabelThatNeedsToBeCamelized" + * "some-javascript-property".camelCase(); // "someJavascriptProperty" + * "some-mixed_string with spaces_underscores-and-hyphens".camelCase(); + * // "someMixedStringWithSpacesUnderscoresAndHyphens" */ String.prototype.camelCase = function(): string { - let s = this.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) - - if (!s) s = [''] - - let str = s.map(x => x.slice(0, 1).toUpperCase() + x.slice(1).toLowerCase()).join('') - - return str.slice(0, 1).toLowerCase() + str.slice(1) -} + return method(this as string); +}; diff --git a/lib/string/camelCase/method.ts b/lib/string/camelCase/method.ts new file mode 100644 index 00000000..051479e2 --- /dev/null +++ b/lib/string/camelCase/method.ts @@ -0,0 +1,9 @@ +const method = (str: string) => { + str = ( + str.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) || [""] + ).map((x) => x.slice(0, 1).toUpperCase() + x.slice(1).toLowerCase()).join(""); + + return str.slice(0, 1).toLowerCase() + str.slice(1); +}; + +export = method; diff --git a/lib/string/camelCase/test.js b/lib/string/camelCase/test.js deleted file mode 100644 index c8cdd27c..00000000 --- a/lib/string/camelCase/test.js +++ /dev/null @@ -1,23 +0,0 @@ -require('../../../es6/string/camelCase') - -describe("String.prototype.camelCase", () => { - test("'some_database_field_name'.camelCase() returns 'someDatabaseFieldName'", () => { - expect('some_database_field_name'.camelCase()) - .toBe('someDatabaseFieldName') - }) - - test("'Some label that needs to be camelized'.camelCase() returns 'someLabelThatNeedsToBeCamelized'", () => { - expect('Some label that needs to be camelized'.camelCase()) - .toBe('someLabelThatNeedsToBeCamelized') - }) - - test("'some-javascript-property'.camelCase() returns 'someJavascriptProperty'", () => { - expect('some-javascript-property'.camelCase()) - .toBe('someJavascriptProperty') - }) - - test("'some-mixed_string with spaces_underscores-and-hyphens'.camelCase() returns 'someMixedStringWithSpacesUnderscoresAndHyphens'", () => { - expect('some-mixed_string with spaces_underscores-and-hyphens'.camelCase()) - .toBe('someMixedStringWithSpacesUnderscoresAndHyphens') - }) -}) diff --git a/lib/string/camelCase/test.ts b/lib/string/camelCase/test.ts new file mode 100644 index 00000000..862c7c04 --- /dev/null +++ b/lib/string/camelCase/test.ts @@ -0,0 +1,24 @@ +import "./index"; + +describe("String.prototype.camelCase", () => { + test("\"some_database_field_name\".camelCase() returns \"someDatabaseFieldName\"", () => { + expect("some_database_field_name".camelCase()) + .toBe("someDatabaseFieldName"); + }); + + test("\"Some label that needs to be camelized\".camelCase() returns \"someLabelThatNeedsToBeCamelized\"", () => { + expect("Some label that needs to be camelized".camelCase()) + .toBe("someLabelThatNeedsToBeCamelized"); + }); + + test("\"some-javascript-property\".camelCase() returns \"someJavascriptProperty\"", () => { + expect("some-javascript-property".camelCase()) + .toBe("someJavascriptProperty"); + }); + + test("\"some-mixed_string with spaces_underscores-and-hyphens\".camelCase() returns " + + "\"someMixedStringWithSpacesUnderscoresAndHyphens\"", () => { + expect("some-mixed_string with spaces_underscores-and-hyphens".camelCase()) + .toBe("someMixedStringWithSpacesUnderscoresAndHyphens"); + }); +}); diff --git a/lib/string/capitalize/index.ts b/lib/string/capitalize/index.ts index c7e0b5e5..a250350a 100644 --- a/lib/string/capitalize/index.ts +++ b/lib/string/capitalize/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - capitalize(allWords?: boolean): string + capitalize(allWords?: boolean): string; } } @@ -15,8 +15,6 @@ declare global { * 'foo bar'.capitalize(); // 'Foo bar' * 'hello world'.capitalize(true); // 'Hello World' */ -String.prototype.capitalize = function(allWords = false): string { - if (allWords) return this.replace(/\b[a-z]/g, (char) => char.toUpperCase()) - - return this.replace(/^[a-z]/, (char) => char.toUpperCase()) -} +String.prototype.capitalize = function(allWords) { + return method(this as string, allWords); +}; diff --git a/lib/string/capitalize/method.ts b/lib/string/capitalize/method.ts new file mode 100644 index 00000000..4da3d0c6 --- /dev/null +++ b/lib/string/capitalize/method.ts @@ -0,0 +1,7 @@ +const method = (str: string, allWords = false): string => { + if (allWords) return str.replace(/\b[a-z]/g, (char) => char.toUpperCase()); + + return str.replace(/^[a-z]/, (char) => char.toUpperCase()); +}; + +export = method; diff --git a/lib/string/capitalize/test.js b/lib/string/capitalize/test.js deleted file mode 100644 index f0445a8f..00000000 --- a/lib/string/capitalize/test.js +++ /dev/null @@ -1,13 +0,0 @@ -require('../../../es6/string/capitalize') - -describe("String.prototype.capitalize", () => { - test("'foo bar'.capitalize() returns 'Foo bar'", () => { - expect('foo bar'.capitalize()) - .toBe('Foo bar') - }) - - test("'hello world'.capitalize(true) returns 'Hello World'", () => { - expect('hello world'.capitalize(true)) - .toBe('Hello World') - }) -}) diff --git a/lib/string/capitalize/test.ts b/lib/string/capitalize/test.ts new file mode 100644 index 00000000..00cd0d65 --- /dev/null +++ b/lib/string/capitalize/test.ts @@ -0,0 +1,13 @@ +import "./index"; + +describe("String.prototype.capitalize", () => { + test("\"foo bar\".capitalize() returns \"Foo bar\"", () => { + expect("foo bar".capitalize()) + .toBe("Foo bar"); + }); + + test("\"hello world\".capitalize(true) returns \"Hello World\"", () => { + expect("hello world".capitalize(true)) + .toBe("Hello World"); + }); +}); diff --git a/lib/string/chars/index.ts b/lib/string/chars/index.ts index e63edabc..1bb8a433 100644 --- a/lib/string/chars/index.ts +++ b/lib/string/chars/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - chars(): Array + chars(): string[]; } } @@ -11,8 +11,8 @@ declare global { * @memberof String * @returns {string[]} * @example - * 'Hello'.chars(); // ['H', 'e', 'l', 'l', 'o'] + * "Hello".chars(); // ["H", "e", "l", "l", "o"] */ -String.prototype.chars = function(): Array { - return this.split('') -} +String.prototype.chars = function() { + return method(this as string); +}; diff --git a/lib/string/chars/method.ts b/lib/string/chars/method.ts new file mode 100644 index 00000000..dc9c6ea7 --- /dev/null +++ b/lib/string/chars/method.ts @@ -0,0 +1,3 @@ +const method = (str: string) => str.split(""); + +export = method; diff --git a/lib/string/chars/test.js b/lib/string/chars/test.js deleted file mode 100644 index 987dfe8a..00000000 --- a/lib/string/chars/test.js +++ /dev/null @@ -1,8 +0,0 @@ -require('../../../es6/string/chars') - -describe("String.prototype.chars", () => { - test("'Hello'.chars() returns ['H', 'e', 'l', 'l', 'o']", () => { - expect('Hello'.chars()) - .toEqual(['H', 'e', 'l', 'l', 'o']) - }) -}) diff --git a/lib/string/chars/test.ts b/lib/string/chars/test.ts new file mode 100644 index 00000000..b409fdfb --- /dev/null +++ b/lib/string/chars/test.ts @@ -0,0 +1,8 @@ +import "./index"; + +describe("String.prototype.chars", () => { + test("\"Hello\".chars() returns [\"H\", \"e\", \"l\", \"l\", \"o\"]", () => { + expect("Hello".chars()) + .toEqual(["H", "e", "l", "l", "o"]); + }); +}); diff --git a/lib/string/contains/index.ts b/lib/string/contains/index.ts index 33cac024..b4585fed 100644 --- a/lib/string/contains/index.ts +++ b/lib/string/contains/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - contains(str: string): boolean + contains(str: string, sensitive?: boolean): boolean; } } @@ -15,8 +15,6 @@ declare global { * 'javaScript & typescript'.contains('Typescript'); // true * 'javaScript & typescript'.contains('Typescript', true); // false */ -String.prototype.contains = function(str: string, sensitive = false): boolean { - if (sensitive) return this.indexOf(str) !== -1 - - return this.toLowerCase().indexOf(str.toLowerCase()) !== -1 -} +String.prototype.contains = function(str, sensitive) { + return method(this as string, str, sensitive); +}; diff --git a/lib/string/contains/method.ts b/lib/string/contains/method.ts new file mode 100644 index 00000000..82189313 --- /dev/null +++ b/lib/string/contains/method.ts @@ -0,0 +1,7 @@ +const method = (str: string, str2: string, sensitive = false): boolean => { + if (sensitive) return str.indexOf(str2) !== -1; + + return str.toLowerCase().indexOf(str2.toLowerCase()) !== -1; +}; + +export = method; diff --git a/lib/string/contains/test.js b/lib/string/contains/test.js deleted file mode 100644 index 29586c94..00000000 --- a/lib/string/contains/test.js +++ /dev/null @@ -1,13 +0,0 @@ -require('../../../es6/string/contains') - -describe("String.prototype.contains", () => { - test("'javaScript & typescript'.contains('Typescript'); // true", () => { - expect('javaScript & typescript'.contains('Typescript')) - .toBe(true) - }) - - test("'javaScript & typescript'.contains('Typescript', true); // false", () => { - expect('javaScript & typescript'.contains('Typescript', true)) - .toBe(false) - }) -}) diff --git a/lib/string/contains/test.ts b/lib/string/contains/test.ts new file mode 100644 index 00000000..79b1ba2b --- /dev/null +++ b/lib/string/contains/test.ts @@ -0,0 +1,13 @@ +import "./index"; + +describe("String.prototype.contains", () => { + test("\"javaScript & typescript\".contains(\"Typescript\"); // true", () => { + expect("javaScript & typescript".contains("Typescript")) + .toBe(true); + }); + + test("\"javaScript & typescript\".contains(\"Typescript\", true); // false", () => { + expect("javaScript & typescript".contains("Typescript", true)) + .toBe(false); + }); +}); diff --git a/lib/string/decapitalize/index.ts b/lib/string/decapitalize/index.ts index 4c17b76a..47d71050 100644 --- a/lib/string/decapitalize/index.ts +++ b/lib/string/decapitalize/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - decapitalize(allWords?: boolean): string + decapitalize(allWords?: boolean): string; } } @@ -15,8 +15,6 @@ declare global { * 'Foo Bar'.decapitalize(); // 'foo Bar' * 'Hello World'.decapitalize(true); // 'hello world' */ -String.prototype.decapitalize = function(allWords = false): string { - if (allWords) return this.replace(/\b[A-Z]/g, (char) => char.toLowerCase()) - - return this.replace(/^[A-Z]/, (char) => char.toLowerCase()) -} +String.prototype.decapitalize = function(allWords) { + return method(this as string, allWords); +}; diff --git a/lib/string/decapitalize/method.ts b/lib/string/decapitalize/method.ts new file mode 100644 index 00000000..201f8718 --- /dev/null +++ b/lib/string/decapitalize/method.ts @@ -0,0 +1,7 @@ +const method = (str: string, allWords = false): string => { + if (allWords) return str.replace(/\b[A-Z]/g, (char) => char.toLowerCase()); + + return str.replace(/^[A-Z]/, (char) => char.toLowerCase()); +}; + +export = method; diff --git a/lib/string/decapitalize/test.js b/lib/string/decapitalize/test.js deleted file mode 100644 index c90a6a18..00000000 --- a/lib/string/decapitalize/test.js +++ /dev/null @@ -1,13 +0,0 @@ -require('../../../es6/string/decapitalize') - -describe("String.prototype.decapitalize", () => { - test("'Foo Bar'.decapitalize() returns 'foo Bar'", () => { - expect('Foo Bar'.decapitalize()) - .toBe('foo Bar') - }) - - test("'Hello World'.decapitalize(true) returns 'hello world'", () => { - expect('Hello World'.decapitalize(true)) - .toBe('hello world') - }) -}) diff --git a/lib/string/decapitalize/test.ts b/lib/string/decapitalize/test.ts new file mode 100644 index 00000000..d48ea7be --- /dev/null +++ b/lib/string/decapitalize/test.ts @@ -0,0 +1,13 @@ +import "./index"; + +describe("String.prototype.decapitalize", () => { + test("\"Foo Bar\".decapitalize() returns \"foo Bar\"", () => { + expect("Foo Bar".decapitalize()) + .toBe("foo Bar"); + }); + + test("\"Hello World\".decapitalize(true) returns \"hello world\"", () => { + expect("Hello World".decapitalize(true)) + .toBe("hello world"); + }); +}); diff --git a/lib/string/humanize/index.ts b/lib/string/humanize/index.ts index 2b491496..fdd2cabb 100644 --- a/lib/string/humanize/index.ts +++ b/lib/string/humanize/index.ts @@ -1,20 +1,19 @@ -export { } +import * as method from "./method"; declare global { interface String { - humanize(): string + humanize(): string; } } /** - * Converts an underscored, camelized, or dasherized string into a humanized one. Also removes beginning and ending whitespace + * Converts an underscored, camelized, or dasherized string into a humanized one. + * Also removes beginning and ending whitespace * @memberof String * @returns {string} * @example * ' capitalize dash-CamelCase_underscore trim '.humanize(); // 'Capitalize dash camel case underscore trim' */ -String.prototype.humanize = function(): string { - let s = this.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) || [''] - - return s.map(x => x.toLowerCase()).join(' ').replace(/^[a-z]/, (char) => char.toUpperCase()) -} +String.prototype.humanize = function() { + return method(this as string); +}; diff --git a/lib/string/humanize/method.ts b/lib/string/humanize/method.ts new file mode 100644 index 00000000..910fe981 --- /dev/null +++ b/lib/string/humanize/method.ts @@ -0,0 +1,5 @@ +const method = (str: string): string => ( + str.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) || [""] +).map((x) => x.toLowerCase()).join(" ").replace(/^[a-z]/, (char) => char.toUpperCase()); + +export = method; diff --git a/lib/string/humanize/test.js b/lib/string/humanize/test.js deleted file mode 100644 index 617b0a44..00000000 --- a/lib/string/humanize/test.js +++ /dev/null @@ -1,8 +0,0 @@ -require('../../../es6/string/humanize') - -describe("String.prototype.humanize", () => { - test("' capitalize dash-CamelCase_underscore trim '.humanize() returns 'Capitalize dash camel case underscore trim'", () => { - expect(' capitalize dash-CamelCase_underscore trim '.humanize()) - .toBe('Capitalize dash camel case underscore trim') - }) -}) diff --git a/lib/string/humanize/test.ts b/lib/string/humanize/test.ts new file mode 100644 index 00000000..80e3ec06 --- /dev/null +++ b/lib/string/humanize/test.ts @@ -0,0 +1,11 @@ +import "./index"; + +describe("String.prototype.humanize", () => { + test( + "\" capitalize dash-CamelCase_underscore trim \".humanize() returns " + + "\"Capitalize dash camel case underscore trim\"", + () => { + expect(" capitalize dash-CamelCase_underscore trim ".humanize()) + .toBe("Capitalize dash camel case underscore trim"); + }); +}); diff --git a/lib/string/index.ts b/lib/string/index.ts index 6b41a1e1..9dde964c 100644 --- a/lib/string/index.ts +++ b/lib/string/index.ts @@ -1,21 +1,21 @@ /** @namespace String */ -import './base64' -import './base64Decode' -import './camelCase' -import './capitalize' -import './chars' -import './contains' -import './decapitalize' -import './humanize' -import './isInstance' -import './kebabCase' -import './lines' -import './map' -import './mask' -import './pluralize' -import './reverse' -import './snakeCase' -import './swapCase' -import './truncate' -import './words' +import "./base64"; +import "./base64Decode"; +import "./camelCase"; +import "./capitalize"; +import "./chars"; +import "./contains"; +import "./decapitalize"; +import "./humanize"; +import "./isInstance"; +import "./kebabCase"; +import "./lines"; +import "./map"; +import "./mask"; +import "./pluralize"; +import "./reverse"; +import "./snakeCase"; +import "./swapCase"; +import "./truncate"; +import "./words"; diff --git a/lib/string/isInstance/index.ts b/lib/string/isInstance/index.ts index d4f91ddc..ab066f9f 100644 --- a/lib/string/isInstance/index.ts +++ b/lib/string/isInstance/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface StringConstructor { - isInstance(arg: any): arg is string + isInstance(arg: any): arg is string; } } @@ -13,6 +13,6 @@ declare global { * @returns {boolean} * @example * String.isInstance(2); // false - * String.isInstance('foo bar'); // true + * String.isInstance("foo bar"); // true */ -String.isInstance = (arg: any): arg is string => typeof arg === 'string' +String.isInstance = method; diff --git a/lib/string/isInstance/method.ts b/lib/string/isInstance/method.ts new file mode 100644 index 00000000..f04a69d2 --- /dev/null +++ b/lib/string/isInstance/method.ts @@ -0,0 +1,3 @@ +const method = (arg: any): arg is string => typeof arg === "string"; + +export = method; diff --git a/lib/string/isInstance/test.js b/lib/string/isInstance/test.js deleted file mode 100644 index 8e16af09..00000000 --- a/lib/string/isInstance/test.js +++ /dev/null @@ -1,13 +0,0 @@ -require('../../../es6/string/isInstance') - -describe("String.isInstance", () => { - test("String.isInstance(2) returns false", () => { - expect(String.isInstance(2)) - .toBe(false) - }) - - test("String.isInstance('foo bar') returns true", () => { - expect(String.isInstance('foo bar')) - .toBe(true) - }) -}) diff --git a/lib/string/isInstance/test.ts b/lib/string/isInstance/test.ts new file mode 100644 index 00000000..efca2dd8 --- /dev/null +++ b/lib/string/isInstance/test.ts @@ -0,0 +1,13 @@ +import "./index"; + +describe("String.isInstance", () => { + test("String.isInstance(2) returns false", () => { + expect(String.isInstance(2)) + .toBe(false); + }); + + test("String.isInstance(\"foo bar\") returns true", () => { + expect(String.isInstance("foo bar")) + .toBe(true); + }); +}); diff --git a/lib/string/kebabCase/index.ts b/lib/string/kebabCase/index.ts index 0d0da7d6..2a530532 100644 --- a/lib/string/kebabCase/index.ts +++ b/lib/string/kebabCase/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - kebabCase(): string + kebabCase(): string; } } @@ -11,16 +11,14 @@ declare global { * @memberof String * @returns {string} * @example - * 'camelCase'.kebabCase(); // 'camel-case' - * 'some text'.kebabCase(); // 'some-text' - * 'some-mixed_string With spaces_underscores-and-hyphens'.kebabCase(); // 'some-mixed-string-with-spaces-underscores-and-hyphens' - * 'AllThe-small Things'.kebabCase(); // "all-the-small-things" - * 'IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'.kebabCase(); // 'i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html' + * "camelCase".kebabCase(); // "camel-case" + * "some text".kebabCase(); // "some-text" + * "some-mixed_string With spaces_underscores-and-hyphens".kebabCase(); + * // "some-mixed-string-with-spaces-underscores-and-hyphens" + * "AllThe-small Things".kebabCase(); // "all-the-small-things" + * "IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML".kebabCase(); + * // "i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html" */ -String.prototype.kebabCase = function(): string { - let s = this.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) - - if (!s) s = [''] - - return s.map(x => x.toLowerCase()).join('-') -} +String.prototype.kebabCase = function() { + return method(this as string); +}; diff --git a/lib/string/kebabCase/method.ts b/lib/string/kebabCase/method.ts new file mode 100644 index 00000000..3333fce9 --- /dev/null +++ b/lib/string/kebabCase/method.ts @@ -0,0 +1,5 @@ +const method = (str: string): string => ( + str.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) || [""] +).map((x) => x.toLowerCase()).join("-"); + +export = method; diff --git a/lib/string/kebabCase/test.js b/lib/string/kebabCase/test.js deleted file mode 100644 index 5cff4894..00000000 --- a/lib/string/kebabCase/test.js +++ /dev/null @@ -1,28 +0,0 @@ -require('../../../es6/string/kebabCase') - -describe("String.prototype.kebabCase", () => { - test("'camelCase'.kebabCase() returns 'camel-case'", () => { - expect('camelCase'.kebabCase()) - .toBe('camel-case') - }) - - test("'some text'.kebabCase() returns 'some-text'", () => { - expect('some text'.kebabCase()) - .toBe('some-text') - }) - - test("'some-mixed_string With spaces_underscores-and-hyphens'.kebabCase() returns 'some-mixed-string-with-spaces-underscores-and-hyphens'", () => { - expect('some-mixed_string With spaces_underscores-and-hyphens'.kebabCase()) - .toBe('some-mixed-string-with-spaces-underscores-and-hyphens') - }) - - test("'AllThe-small Things'.kebabCase() returns 'all-the-small-things'", () => { - expect('AllThe-small Things'.kebabCase()) - .toBe('all-the-small-things') - }) - - test("'IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'.kebabCase() returns 'i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html'", () => { - expect('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'.kebabCase()) - .toBe('i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html') - }) -}) diff --git a/lib/string/kebabCase/test.ts b/lib/string/kebabCase/test.ts new file mode 100644 index 00000000..c8948733 --- /dev/null +++ b/lib/string/kebabCase/test.ts @@ -0,0 +1,32 @@ +import "./index"; + +describe("String.prototype.kebabCase", () => { + test("\"camelCase\".kebabCase() returns \"camel-case\"", () => { + expect("camelCase".kebabCase()) + .toBe("camel-case"); + }); + + test("\"some text\".kebabCase() returns \"some-text\"", () => { + expect("some text".kebabCase()) + .toBe("some-text"); + }); + + test("\"some-mixed_string With spaces_underscores-and-hyphens\".kebabCase() returns " + + "\"some-mixed-string-with-spaces-underscores-and-hyphens\"", () => { + expect("some-mixed_string With spaces_underscores-and-hyphens".kebabCase()) + .toBe("some-mixed-string-with-spaces-underscores-and-hyphens"); + }); + + test("\"AllThe-small Things\".kebabCase() returns \"all-the-small-things\"", () => { + expect("AllThe-small Things".kebabCase()) + .toBe("all-the-small-things"); + }); + + test( + "\"IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML\".kebabCase() returns " + + "\"i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html\"", + () => { + expect("IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML".kebabCase()) + .toBe("i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html"); + }); +}); diff --git a/lib/string/lines/index.ts b/lib/string/lines/index.ts index 31224533..3c74f7c3 100644 --- a/lib/string/lines/index.ts +++ b/lib/string/lines/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - lines(): Array + lines(): string[]; } } @@ -13,6 +13,6 @@ declare global { * @example * 'This\nis a\nmultiline\nstring.\n'.lines(); // ['This', 'is a', 'multiline', 'string.' , ''] */ -String.prototype.lines = function(): Array { - return this.split(/\r?\n/) -} +String.prototype.lines = function() { + return method(this as string); +}; diff --git a/lib/string/lines/method.ts b/lib/string/lines/method.ts new file mode 100644 index 00000000..a623dc5a --- /dev/null +++ b/lib/string/lines/method.ts @@ -0,0 +1,3 @@ +const method = (str: string): string[] => str.split(/\r?\n/); + +export = method; diff --git a/lib/string/lines/test.js b/lib/string/lines/test.js deleted file mode 100644 index 4254edd7..00000000 --- a/lib/string/lines/test.js +++ /dev/null @@ -1,8 +0,0 @@ -require('../../../es6/string/lines') - -describe("String.prototype.lines", () => { - test("'This\nis a\nmultiline\nstring.\n'.lines() returns ['This', 'is a', 'multiline', 'string.' , '']", () => { - expect('This\nis a\nmultiline\nstring.\n'.lines()) - .toEqual(['This', 'is a', 'multiline', 'string.' , '']) - }) -}) diff --git a/lib/string/lines/test.ts b/lib/string/lines/test.ts new file mode 100644 index 00000000..24862cf0 --- /dev/null +++ b/lib/string/lines/test.ts @@ -0,0 +1,9 @@ +import "./index"; + +describe("String.prototype.lines", () => { + test("\"This\nis a\nmultiline\nstring.\n\".lines() returns [\"This\", \"is a\", \"multiline\", \"string.\" , \"\"]", + () => { + expect("This\nis a\nmultiline\nstring.\n".lines()) + .toEqual(["This", "is a", "multiline", "string.", ""]); + }); +}); diff --git a/lib/string/map/index.ts b/lib/string/map/index.ts index b1f43a46..10fa8b78 100644 --- a/lib/string/map/index.ts +++ b/lib/string/map/index.ts @@ -1,4 +1,4 @@ -import * as map from "./method"; +import * as method from "./method"; export { }; @@ -16,6 +16,6 @@ declare global { * @example * 'Hello'.map((char) => char == 'o' ? 'O' : char); // 'HellO' */ -String.prototype.map = function(fn: (char: string, index: number, chars: string[]) => string): string { - return map(this as string, fn); +String.prototype.map = function(fn) { + return method(this as string, fn); }; diff --git a/lib/string/map/method.ts b/lib/string/map/method.ts index ccd20c3a..dc1c7c0a 100644 --- a/lib/string/map/method.ts +++ b/lib/string/map/method.ts @@ -1,6 +1,4 @@ -const map = ( - str: string, - fn: (char: string, index: number, chars: string[]) => string, -): string => str.split("").map(fn).join(""); +const method = (str: string, fn: (char: string, index: number, chars: string[]) => string): string => + str.split("").map(fn).join(""); -export = map; +export = method; diff --git a/lib/string/map/test.js b/lib/string/map/test.js deleted file mode 100644 index cc81bbc6..00000000 --- a/lib/string/map/test.js +++ /dev/null @@ -1,8 +0,0 @@ -require('../../../es6/string/map') - -describe("String.prototype.map", () => { - test("'Hello'.map((char) => char == 'o' ? 'O' : char) returns 'HellO'", () => { - expect('Hello'.map((char) => char == 'o' ? 'O' : char)) - .toBe('HellO') - }) -}) diff --git a/lib/string/map/test.ts b/lib/string/map/test.ts new file mode 100644 index 00000000..b70b8944 --- /dev/null +++ b/lib/string/map/test.ts @@ -0,0 +1,8 @@ +import "./index"; + +describe("String.prototype.map", () => { + test("\"Hello\".map((char) => char == \"o\" ? \"O\" : char) returns \"HellO\"", () => { + expect("Hello".map((char) => char === "o" ? "O" : char)) + .toBe("HellO"); + }); +}); diff --git a/lib/string/mask/index.ts b/lib/string/mask/index.ts index 5e61ab8d..fd28ba19 100644 --- a/lib/string/mask/index.ts +++ b/lib/string/mask/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - mask(num?: number, mask?: string): string + mask(num?: number, mask?: string): string; } } @@ -17,6 +17,6 @@ declare global { * '1234567890'.mask(3); // '*******890' * '1234567890'.mask(-4, '$'); // '$$$$567890' */ -String.prototype.mask = function(num = 4, mask = '*'): string { - return this.slice(0, -num).replace(/./g, mask) + this.slice(-num) -} +String.prototype.mask = function(num, mask) { + return method(this as string, num, mask); +}; diff --git a/lib/string/mask/method.ts b/lib/string/mask/method.ts new file mode 100644 index 00000000..423c7b39 --- /dev/null +++ b/lib/string/mask/method.ts @@ -0,0 +1,3 @@ +const method = (str: string, num = 4, mask = "*"): string => str.slice(0, -num).replace(/./g, mask) + str.slice(-num); + +export = method; diff --git a/lib/string/mask/test.js b/lib/string/mask/test.js deleted file mode 100644 index d99197b4..00000000 --- a/lib/string/mask/test.js +++ /dev/null @@ -1,18 +0,0 @@ -require('../../../es6/string/mask') - -describe("String.prototype.mask", () => { - test("'1234567890'.mask() returns '******7890'", () => { - expect('1234567890'.mask()) - .toBe('******7890') - }) - - test("'1234567890'.mask(3) returns '*******890'", () => { - expect('1234567890'.mask(3)) - .toBe('*******890') - }) - - test("'1234567890'.mask(-4, '$') returns '$$$$567890'", () => { - expect('1234567890'.mask(-4, '$')) - .toBe('$$$$567890') - }) -}) diff --git a/lib/string/mask/test.ts b/lib/string/mask/test.ts new file mode 100644 index 00000000..34561a32 --- /dev/null +++ b/lib/string/mask/test.ts @@ -0,0 +1,18 @@ +import "./index"; + +describe("String.prototype.mask", () => { + test("\"1234567890\".mask() returns \"******7890\"", () => { + expect("1234567890".mask()) + .toBe("******7890"); + }); + + test("\"1234567890\".mask(3) returns \"*******890\"", () => { + expect("1234567890".mask(3)) + .toBe("*******890"); + }); + + test("\"1234567890\".mask(-4, \"$\") returns \"$$$$567890\"", () => { + expect("1234567890".mask(-4, "$")) + .toBe("$$$$567890"); + }); +}); diff --git a/lib/string/pluralize/index.ts b/lib/string/pluralize/index.ts index e95d553e..cb012ca6 100644 --- a/lib/string/pluralize/index.ts +++ b/lib/string/pluralize/index.ts @@ -1,6 +1,4 @@ -import * as pluralize from "./method"; - -export { }; +import * as method from "./method"; declare global { interface String { @@ -20,6 +18,6 @@ declare global { * 'apple'.pluralize(2); // 'apples' * 'person'.pluralize(2, 'people'); // 'people' */ -String.prototype.pluralize = function(value: number, plural?: string): string { - return pluralize(this as string, value, plural); +String.prototype.pluralize = function(value, plural) { + return method(this as string, value, plural); }; diff --git a/lib/string/pluralize/method.ts b/lib/string/pluralize/method.ts index e3c85ccb..f19a924d 100644 --- a/lib/string/pluralize/method.ts +++ b/lib/string/pluralize/method.ts @@ -145,7 +145,7 @@ const IRREGULAR_PLURALS: { [word: string]: string } = { "woman": "women", }; -const pluralize = (str: string, value: number, plural?: string): string => { +const method = (str: string, value: number, plural?: string): string => { if (value === 1) return str; if (!plural) @@ -162,4 +162,4 @@ const pluralize = (str: string, value: number, plural?: string): string => { return plural; }; -export = pluralize; +export = method; diff --git a/lib/string/pluralize/test.js b/lib/string/pluralize/test.js deleted file mode 100644 index b74e718b..00000000 --- a/lib/string/pluralize/test.js +++ /dev/null @@ -1,23 +0,0 @@ -require('../../../es6/string/pluralize') - -describe("String.prototype.pluralize", () => { - test("'apple'.pluralize(0) returns 'apples'", () => { - expect('apple'.pluralize(0)) - .toBe('apples') - }) - - test("'apple'.pluralize(1) returns 'apple'", () => { - expect('apple'.pluralize(1)) - .toBe('apple') - }) - - test("'apple'.pluralize(2) returns 'apples'", () => { - expect('apple'.pluralize(2)) - .toBe('apples') - }) - - test("'person'.pluralize(2, 'people') returns 'people'", () => { - expect('person'.pluralize(2, 'people')) - .toBe('people') - }) -}) diff --git a/lib/string/pluralize/test.ts b/lib/string/pluralize/test.ts new file mode 100644 index 00000000..1dc65d1b --- /dev/null +++ b/lib/string/pluralize/test.ts @@ -0,0 +1,23 @@ +import "./index"; + +describe("String.prototype.pluralize", () => { + test("\"apple\".pluralize(0) returns \"apples\"", () => { + expect("apple".pluralize(0)) + .toBe("apples"); + }); + + test("\"apple\".pluralize(1) returns \"apple\"", () => { + expect("apple".pluralize(1)) + .toBe("apple"); + }); + + test("\"apple\".pluralize(2) returns \"apples\"", () => { + expect("apple".pluralize(2)) + .toBe("apples"); + }); + + test("\"person\".pluralize(2, \"people\") returns \"people\"", () => { + expect("person".pluralize(2, "people")) + .toBe("people"); + }); +}); diff --git a/lib/string/reverse/index.ts b/lib/string/reverse/index.ts index e05d35c6..fe61a2fe 100644 --- a/lib/string/reverse/index.ts +++ b/lib/string/reverse/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - reverse(): string + reverse(): string; } } @@ -11,8 +11,8 @@ declare global { * @memberof String * @returns {string} * @example - * 'foobar'.reverse(); // 'raboof' + * "foobar".reverse(); // "raboof" */ -String.prototype.reverse = function(): string { - return [...this].reverse().join('') -} +String.prototype.reverse = function() { + return method(this as string); +}; diff --git a/lib/string/reverse/method.ts b/lib/string/reverse/method.ts new file mode 100644 index 00000000..7024f29e --- /dev/null +++ b/lib/string/reverse/method.ts @@ -0,0 +1,3 @@ +const method = (str: string): string => [...str].reverse().join(""); + +export = method; diff --git a/lib/string/reverse/test.js b/lib/string/reverse/test.js deleted file mode 100644 index aa503199..00000000 --- a/lib/string/reverse/test.js +++ /dev/null @@ -1,8 +0,0 @@ -require('../../../es6/string/reverse') - -describe("String.prototype.reverse", () => { - test("'foobar'.reverse() returns 'raboof'", () => { - expect('foobar'.reverse()) - .toBe('raboof') - }) -}) diff --git a/lib/string/reverse/test.ts b/lib/string/reverse/test.ts new file mode 100644 index 00000000..d6f82cfa --- /dev/null +++ b/lib/string/reverse/test.ts @@ -0,0 +1,8 @@ +import "./index"; + +describe("String.prototype.reverse", () => { + test("\"foobar\".reverse() returns \"raboof\"", () => { + expect("foobar".reverse()) + .toBe("raboof"); + }); +}); diff --git a/lib/string/snakeCase/index.ts b/lib/string/snakeCase/index.ts index 0c37a4c8..3023fc3a 100644 --- a/lib/string/snakeCase/index.ts +++ b/lib/string/snakeCase/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - snakeCase(): string + snakeCase(): string; } } @@ -13,14 +13,12 @@ declare global { * @example * 'camelCase'.snakeCase(); // 'camel_case' * 'some text'.snakeCase(); // 'some_text' - * 'some-mixed_string With spaces_underscores-and-hyphens'.snakeCase(); // 'some_mixed_string_with_spaces_underscores_and_hyphens' + * 'some-mixed_string With spaces_underscores-and-hyphens'.snakeCase(); + * // 'some_mixed_string_with_spaces_underscores_and_hyphens' * 'AllThe-small Things'.snakeCase(); // "all_the_small_things" - * 'IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'.snakeCase(); // 'i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html' + * 'IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'.snakeCase(); + * // 'i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html' */ -String.prototype.snakeCase = function(): string { - let s = this.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) - - if (!s) s = [''] - - return s.map(x => x.toLowerCase()).join('_') -} +String.prototype.snakeCase = function() { + return method(this as string); +}; diff --git a/lib/string/snakeCase/method.ts b/lib/string/snakeCase/method.ts new file mode 100644 index 00000000..4050f0fb --- /dev/null +++ b/lib/string/snakeCase/method.ts @@ -0,0 +1,5 @@ +const method = (str: string): string => ( + str.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g) || [""] +).map((x) => x.toLowerCase()).join("_"); + +export = method; diff --git a/lib/string/snakeCase/test.js b/lib/string/snakeCase/test.js deleted file mode 100644 index 73ef2d34..00000000 --- a/lib/string/snakeCase/test.js +++ /dev/null @@ -1,28 +0,0 @@ -require('../../../es6/string/snakeCase') - -describe("String.prototype.snakeCase", () => { - test("'camelCase'.snakeCase() returns 'camel_case'", () => { - expect('camelCase'.snakeCase()) - .toBe('camel_case') - }) - - test("'some text'.snakeCase() returns 'some_text'", () => { - expect('some text'.snakeCase()) - .toBe('some_text') - }) - - test("'some-mixed_string With spaces_underscores-and-hyphens'.snakeCase() returns 'some_mixed_string_with_spaces_underscores_and_hyphens'", () => { - expect('some-mixed_string With spaces_underscores-and-hyphens'.snakeCase()) - .toBe('some_mixed_string_with_spaces_underscores_and_hyphens') - }) - - test("'AllThe-small Things'.snakeCase() returns 'all_the_small_things'", () => { - expect('AllThe-small Things'.snakeCase()) - .toBe('all_the_small_things') - }) - - test("'IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'.snakeCase() returns 'i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html'", () => { - expect('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'.snakeCase()) - .toBe('i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html') - }) -}) diff --git a/lib/string/snakeCase/test.ts b/lib/string/snakeCase/test.ts new file mode 100644 index 00000000..9317eaf8 --- /dev/null +++ b/lib/string/snakeCase/test.ts @@ -0,0 +1,34 @@ +import "./index"; + +describe("String.prototype.snakeCase", () => { + test("\"camelCase\".snakeCase() returns \"camel_case\"", () => { + expect("camelCase".snakeCase()) + .toBe("camel_case"); + }); + + test("\"some text\".snakeCase() returns \"some_text\"", () => { + expect("some text".snakeCase()) + .toBe("some_text"); + }); + + test( + "\"some-mixed_string With spaces_underscores-and-hyphens\".snakeCase() returns " + + "\"some_mixed_string_with_spaces_underscores_and_hyphens\"", + () => { + expect("some-mixed_string With spaces_underscores-and-hyphens".snakeCase()) + .toBe("some_mixed_string_with_spaces_underscores_and_hyphens"); + }); + + test("\"AllThe-small Things\".snakeCase() returns \"all_the_small_things\"", () => { + expect("AllThe-small Things".snakeCase()) + .toBe("all_the_small_things"); + }); + + test( + "\"IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML\".snakeCase() returns " + + "\"i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html\"", + () => { + expect("IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML".snakeCase()) + .toBe("i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html"); + }); +}); diff --git a/lib/string/swapCase/index.ts b/lib/string/swapCase/index.ts index 2f903ac4..baa4f10b 100644 --- a/lib/string/swapCase/index.ts +++ b/lib/string/swapCase/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - swapCase(): string + swapCase(): string; } } @@ -13,6 +13,6 @@ declare global { * @example * 'Hello'.swapCase(); // 'hELLO' */ -String.prototype.swapCase = function(): string { - return this.replace(/\S/g, (c) => c === c.toUpperCase() ? c.toLowerCase() : c.toUpperCase()) -} +String.prototype.swapCase = function() { + return method(this as string); +}; diff --git a/lib/string/swapCase/method.ts b/lib/string/swapCase/method.ts new file mode 100644 index 00000000..f16d609c --- /dev/null +++ b/lib/string/swapCase/method.ts @@ -0,0 +1,3 @@ +const method = (str: string) => str.replace(/\S/g, (c) => c === c.toUpperCase() ? c.toLowerCase() : c.toUpperCase()); + +export = method; diff --git a/lib/string/swapCase/test.js b/lib/string/swapCase/test.js deleted file mode 100644 index 6e917c71..00000000 --- a/lib/string/swapCase/test.js +++ /dev/null @@ -1,8 +0,0 @@ -require('../../../es6/string/swapCase') - -describe("String.prototype.swapCase", () => { - test("'Hello'.swapCase() returns 'hELLO'", () => { - expect('Hello'.swapCase()) - .toBe('hELLO') - }) -}) diff --git a/lib/string/swapCase/test.ts b/lib/string/swapCase/test.ts new file mode 100644 index 00000000..c9e85aa2 --- /dev/null +++ b/lib/string/swapCase/test.ts @@ -0,0 +1,8 @@ +import "./index"; + +describe("String.prototype.swapCase", () => { + test("\"Hello\".swapCase() returns \"hELLO\"", () => { + expect("Hello".swapCase()) + .toBe("hELLO"); + }); +}); diff --git a/lib/string/truncate/index.ts b/lib/string/truncate/index.ts index d1b5d3cb..e364e2f9 100644 --- a/lib/string/truncate/index.ts +++ b/lib/string/truncate/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - truncate(num: number): String + truncate(num: number, truncateString?: string): string; } } @@ -16,8 +16,6 @@ declare global { * 'boomerang'.truncate(7); // 'boom...' * 'boomerang'.truncate(7, '....'); // 'boo....' */ -String.prototype.truncate = function(num: number, truncateString = '...'): String { - let length = truncateString.length - - return this.length > num ? this.slice(0, num > length ? num - length : num) + truncateString : this -} +String.prototype.truncate = function(num, truncateString) { + return method(this as string, num, truncateString); +}; diff --git a/lib/string/truncate/method.ts b/lib/string/truncate/method.ts new file mode 100644 index 00000000..4367d67e --- /dev/null +++ b/lib/string/truncate/method.ts @@ -0,0 +1,7 @@ +const method = (str: string, num: number, truncateString = "..."): string => { + const length = truncateString.length; + + return str.length > num ? str.slice(0, num > length ? num - length : num) + truncateString : str; +}; + +export = method; diff --git a/lib/string/truncate/test.js b/lib/string/truncate/test.js deleted file mode 100644 index d0677f05..00000000 --- a/lib/string/truncate/test.js +++ /dev/null @@ -1,13 +0,0 @@ -require('../../../es6/string/truncate') - -describe("String.prototype.truncate", () => { - test("'boomerang'.truncate(7) returns 'boom...'", () => { - expect('boomerang'.truncate(7)) - .toBe('boom...') - }) - - test("'boomerang'.truncate(7, '....') returns 'boo....'", () => { - expect('boomerang'.truncate(7, '....')) - .toBe('boo....') - }) -}) diff --git a/lib/string/truncate/test.ts b/lib/string/truncate/test.ts new file mode 100644 index 00000000..1338f1ba --- /dev/null +++ b/lib/string/truncate/test.ts @@ -0,0 +1,13 @@ +import "./index"; + +describe("String.prototype.truncate", () => { + test("\"boomerang\".truncate(7) returns \"boom...\"", () => { + expect("boomerang".truncate(7)) + .toBe("boom..."); + }); + + test("\"boomerang\".truncate(7, \"....\") returns \"boo....\"", () => { + expect("boomerang".truncate(7, "....")) + .toBe("boo...."); + }); +}); diff --git a/lib/string/words/index.ts b/lib/string/words/index.ts index 32032196..d71fb102 100644 --- a/lib/string/words/index.ts +++ b/lib/string/words/index.ts @@ -1,8 +1,8 @@ -export { } +import * as method from "./method"; declare global { interface String { - words(pattern?: RegExp): Array + words(pattern?: RegExp): string[]; } } @@ -15,6 +15,6 @@ declare global { * 'I love javaScript!!'.words(); // ["I", "love", "javaScript"] * 'python, javaScript & coffee'.words(); // ["python", "javaScript", "coffee"] */ -String.prototype.words = function(pattern = /[^a-zA-Z-]+/): Array { - return this.split(pattern).filter(Boolean) -} +String.prototype.words = function(pattern) { + return method(this as string, pattern); +}; diff --git a/lib/string/words/method.ts b/lib/string/words/method.ts new file mode 100644 index 00000000..d753c6f8 --- /dev/null +++ b/lib/string/words/method.ts @@ -0,0 +1,3 @@ +const method = (str: string, pattern = /[^a-zA-Z-]+/): string[] => str.split(pattern).filter(Boolean); + +export = method; diff --git a/lib/string/words/test.js b/lib/string/words/test.js deleted file mode 100644 index 014179ef..00000000 --- a/lib/string/words/test.js +++ /dev/null @@ -1,13 +0,0 @@ -require('../../../es6/string/words') - -describe("String.prototype.words", () => { - test("'I love javaScript!!'.words() returns ['I', 'love', 'javaScript']", () => { - expect('I love javaScript!!'.words()) - .toEqual(['I', 'love', 'javaScript']) - }) - - test("'python, javaScript & coffee'.words() returns ['python', 'javaScript','coffee']", () => { - expect('python, javaScript & coffee'.words()) - .toEqual(['python', 'javaScript','coffee']) - }) -}) diff --git a/lib/string/words/test.ts b/lib/string/words/test.ts new file mode 100644 index 00000000..4cd5f9fb --- /dev/null +++ b/lib/string/words/test.ts @@ -0,0 +1,13 @@ +import "./index"; + +describe("String.prototype.words", () => { + test("\"I love javaScript!!\".words() returns [\"I\", \"love\", \"javaScript\"]", () => { + expect("I love javaScript!!".words()) + .toEqual(["I", "love", "javaScript"]); + }); + + test("\"python, javaScript & coffee\".words() returns [\"python\", \"javaScript\" ,\"coffee\"]", () => { + expect("python, javaScript & coffee".words()) + .toEqual(["python", "javaScript", "coffee"]); + }); +}); diff --git a/package-lock.json b/package-lock.json index fbb6c2b1..712350be 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "prototyped.js", - "version": "0.4.0", + "version": "0.5.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -62,9 +62,9 @@ "dev": true }, "@types/node": { - "version": "9.6.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.4.tgz", - "integrity": "sha512-Awg4BcUYiZtNKoveGOu654JVPt11V/KIC77iBz8NweyoOAZpz5rUJfPDwwD+ajfTs2HndbTCEB8IuLfX9m/mmw==", + "version": "9.6.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.5.tgz", + "integrity": "sha512-NOLEgsT6UiDTjnWG5Hd2Mg25LRyz/oe8ql3wbjzgSFeRzRROhPmtlsvIrei4B46UjERF0td9SZ1ZXPLOdcrBHg==", "dev": true }, "abab": { diff --git a/package.json b/package.json index 6ee13df7..a4a31e3d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prototyped.js", - "version": "0.4.0", + "version": "0.5.0", "description": "Common typescript ready prototypes available in both es5 and es6", "author": "Ardalan Amini ", "license": "MIT", @@ -108,13 +108,13 @@ "scripts": { "doc": "tsc && jsdoc2md es6/*.js es6/**/*.js es6/**/**/*.js --example-lang javascript > API.md", "build": "node scripts/build.js", - "prepare": "npm run build && npm test", + "prepare": "npm test && npm run build", "lint": "tslint -p tsconfig.json -c tslint.json --exclude '**/*.d.ts'", "test": "jest" }, "devDependencies": { "@types/jest": "^22.2.3", - "@types/node": "^9.6.4", + "@types/node": "^9.6.5", "babel-core": "^6.26.0", "babel-preset-env": "^1.6.1", "fs-extra": "^5.0.0", @@ -136,7 +136,7 @@ "^.+\\.ts$": "/scripts/preprocessor.js" }, "testMatch": [ - "/lib/**/test\\.(ts|js)" + "/lib/**/test\\.ts" ] } } From 542fe62c6743ce5a9706ec1349c79ded666b6af3 Mon Sep 17 00:00:00 2001 From: Ardalan Amini Date: Fri, 13 Apr 2018 23:21:25 +0430 Subject: [PATCH 5/5] Update Documents --- API.md | 285 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 185 insertions(+), 100 deletions(-) diff --git a/API.md b/API.md index a2414c02..7c46440f 100644 --- a/API.md +++ b/API.md @@ -27,6 +27,8 @@ * [Array](#Array) : object * _instance_ * [.avg](#Array+avg) ⇒ number + * [.all([fn])](#Array+all) ⇒ boolean + * [.any([fn])](#Array+any) ⇒ boolean * [.append(value)](#Array+append) * [.average([key])](#Array+average) ⇒ number * [.chunk(size)](#Array+chunk) ⇒ [Array.<Array>](#Array) @@ -66,8 +68,8 @@ * [.zipObject(array)](#Array+zipObject) ⇒ [Array](#Array) * _static_ * [.isInstance](#Array.isInstance) ⇒ boolean - * [.range(end, [start], [step])](#Array.range) ⇒ Array.<number> - * [.repeat(n, [value])](#Array.repeat) ⇒ [Array](#Array) + * [.range](#Array.range) ⇒ Array.<number> + * [.repeat](#Array.repeat) ⇒ [Array](#Array) @@ -83,8 +85,41 @@ An alias of Array.prototype.average **Example** ```javascript [1, 2, 3].avg(); // 2 -[{a: 1}, {a: 2}, {a: 3}].avg('a'); // 2 -[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].avg('a.b'); // 2 +[{a: 1}, {a: 2}, {a: 3}].avg("a"); // 2 +[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].avg("a.b"); // 2 +``` + + +### array.all([fn]) ⇒ boolean +Returns `true` if the provided predicate function returns `true` for all elements in a collection, `false` otherwise + +**Kind**: instance method of [Array](#Array) + +| Param | Type | Default | +| --- | --- | --- | +| [fn] | function | Boolean | + +**Example** +```javascript +[4, 2, 3].all((x) => x > 1); // true +[1, 2, 3].all(); // true +``` + + +### array.any([fn]) ⇒ boolean +Returns `true` if the provided predicate function returns `true` for at least one element in a collection, +`false` otherwise + +**Kind**: instance method of [Array](#Array) + +| Param | Type | Default | +| --- | --- | --- | +| [fn] | function | Boolean | + +**Example** +```javascript +[0, 1, 2, 0].any((x) => x >= 2); // true +[0, 0, 1, 0].any(); // true ``` @@ -116,8 +151,8 @@ Returns the average value of a given key **Example** ```javascript [1, 2, 3].average(); // 2 -[{a: 1}, {a: 2}, {a: 3}].average('a'); // 2 -[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].average('a.b'); // 2 +[{a: 1}, {a: 2}, {a: 3}].average("a"); // 2 +[{a: {b: 1}}, {a: {b: 2}}, {a: {b: 3}}].average("a.b"); // 2 ``` @@ -466,7 +501,10 @@ Groups the elements into two arrays, depending on the provided function's truthi **Example** ```javascript const users = [{ user: 'barney', age: 36, active: false }, { user: 'fred', age: 40, active: true }]; -users.partition(o => o.active); // [[{ 'user': 'fred', 'age': 40, 'active': true }],[{ 'user': 'barney', 'age': 36, 'active': false }]] +users.partition(o => o.active); // [ + [{ 'user': 'fred', 'age': 40, 'active': true }], + [{ 'user': 'barney', 'age': 36, 'active': false }] +] ``` @@ -629,10 +667,11 @@ Array.isInstance([7, 3]); // true ``` -### Array.range(end, [start], [step]) ⇒ Array.<number> -Initializes an array containing the numbers in the specified range where start and end are inclusive with there common difference step +### Array.range ⇒ Array.<number> +Initializes an array containing the numbers in the specified range where start +and end are inclusive with there common difference step -**Kind**: static method of [Array](#Array) +**Kind**: static property of [Array](#Array) | Param | Type | Default | | --- | --- | --- | @@ -648,10 +687,10 @@ Array.range(9, 0, 2); // [0,2,4,6,8] ``` -### Array.repeat(n, [value]) ⇒ [Array](#Array) +### Array.repeat ⇒ [Array](#Array) Initializes and fills an array with the specified value -**Kind**: static method of [Array](#Array) +**Kind**: static property of [Array](#Array) | Param | Type | Default | | --- | --- | --- | @@ -668,10 +707,10 @@ Array.repeat(5, 2); // [2,2,2,2,2] **Kind**: global namespace -### Boolean.isInstance(arg) ⇒ boolean +### Boolean.isInstance ⇒ boolean Returns true if the given argument is a boolean -**Kind**: static method of [Boolean](#Boolean) +**Kind**: static property of [Boolean](#Boolean) | Param | Type | | --- | --- | @@ -688,10 +727,10 @@ Boolean.isInstance(flase); // true **Kind**: global namespace -### Date.isInstance(arg) ⇒ boolean +### Date.isInstance ⇒ boolean Returns true if the given argument is an instance of Date -**Kind**: static method of [Date](#Date) +**Kind**: static property of [Date](#Date) | Param | Type | | --- | --- | @@ -713,7 +752,7 @@ Date.isInstance(new Date()); // true * [.defer(args)](#Function+defer) ⇒ \* * [.once(args)](#Function+once) ⇒ \* * _static_ - * [.isInstance(arg)](#Function.isInstance) ⇒ boolean + * [.isInstance](#Function.isInstance) ⇒ boolean @@ -767,10 +806,10 @@ test.once('b'); // no log this time ``` -### Function.isInstance(arg) ⇒ boolean +### Function.isInstance ⇒ boolean Returns true if the given argument is a function -**Kind**: static method of [Function](#Function) +**Kind**: static property of [Function](#Function) | Param | Type | | --- | --- | @@ -787,18 +826,18 @@ Function.isInstance((() => {})); // true **Kind**: global namespace * [Math](#Math) : object + * [.average](#Math.average) ⇒ number * [.avg](#Math.avg) ⇒ number - * [.average(nums)](#Math.average) ⇒ number - * [.factorial(num)](#Math.factorial) ⇒ number - * [.fibonacci(num)](#Math.fibonacci) ⇒ Array.<number> - * [.gcd(nums)](#Math.gcd) ⇒ number - * [.isEven(num)](#Math.isEven) ⇒ boolean - * [.isPrime(num)](#Math.isPrime) ⇒ boolean - * [.lcm(nums)](#Math.lcm) ⇒ number + * [.factorial](#Math.factorial) ⇒ number + * [.fibonacci](#Math.fibonacci) ⇒ Array.<number> + * [.gcd](#Math.gcd) ⇒ number + * [.isEven](#Math.isEven) ⇒ boolean + * [.isPrime](#Math.isPrime) ⇒ boolean + * [.lcm](#Math.lcm) ⇒ number - + -### Math.avg ⇒ number +### Math.average ⇒ number Returns the average of an of two or more numbers **Kind**: static property of [Math](#Math) @@ -809,15 +848,15 @@ Returns the average of an of two or more numbers **Example** ```javascript -Math.avg(...[1, 2, 3]); // 2 -Math.avg(1, 2, 3); // 2 +Math.average(...[1, 2, 3]); // 2 +Math.average(1, 2, 3); // 2 ``` - + -### Math.average(nums) ⇒ number +### Math.avg ⇒ number Returns the average of an of two or more numbers -**Kind**: static method of [Math](#Math) +**Kind**: static property of [Math](#Math) | Param | Type | | --- | --- | @@ -825,15 +864,15 @@ Returns the average of an of two or more numbers **Example** ```javascript -Math.average(...[1, 2, 3]); // 2 -Math.average(1, 2, 3); // 2 +Math.avg(...[1, 2, 3]); // 2 +Math.avg(1, 2, 3); // 2 ``` -### Math.factorial(num) ⇒ number +### Math.factorial ⇒ number Calculates the factorial of a number -**Kind**: static method of [Math](#Math) +**Kind**: static property of [Math](#Math) | Param | Type | | --- | --- | @@ -845,10 +884,10 @@ Math.factorial(6); // 720 ``` -### Math.fibonacci(num) ⇒ Array.<number> +### Math.fibonacci ⇒ Array.<number> Generates an array, containing the Fibonacci sequence, up until the nth term -**Kind**: static method of [Math](#Math) +**Kind**: static property of [Math](#Math) | Param | Type | | --- | --- | @@ -860,10 +899,10 @@ Math.fibonacci(6); // [0, 1, 1, 2, 3, 5] ``` -### Math.gcd(nums) ⇒ number +### Math.gcd ⇒ number Calculates the greatest common divisor between two or more numbers -**Kind**: static method of [Math](#Math) +**Kind**: static property of [Math](#Math) | Param | Type | | --- | --- | @@ -876,10 +915,10 @@ Math.gcd(...[12, 8, 32]); // 4 ``` -### Math.isEven(num) ⇒ boolean +### Math.isEven ⇒ boolean Returns true if the given number is even, false otherwise -**Kind**: static method of [Math](#Math) +**Kind**: static property of [Math](#Math) | Param | Type | | --- | --- | @@ -891,10 +930,10 @@ Math.isEven(3); // false ``` -### Math.isPrime(num) ⇒ boolean +### Math.isPrime ⇒ boolean Checks if the provided integer is a prime number -**Kind**: static method of [Math](#Math) +**Kind**: static property of [Math](#Math) | Param | Type | | --- | --- | @@ -906,10 +945,10 @@ Math.isPrime(11); // true ``` -### Math.lcm(nums) ⇒ number +### Math.lcm ⇒ number Returns the least common multiple of two or more numbers -**Kind**: static method of [Math](#Math) +**Kind**: static property of [Math](#Math) | Param | Type | | --- | --- | @@ -926,10 +965,10 @@ Math.lcm(...[1, 3, 4, 5]); // 60 **Kind**: global namespace -### Number.isInstance(arg) ⇒ boolean +### Number.isInstance ⇒ boolean Returns true if the given argument is a number -**Kind**: static method of [Number](#Number) +**Kind**: static property of [Number](#Number) | Param | Type | | --- | --- | @@ -947,40 +986,41 @@ Number.isInstance(2); // true * [Object](#Object) : object * _instance_ - * [.invert()](#Object+invert) ⇒ [Object](#Object) - * [.lowerCaseKeys()](#Object+lowerCaseKeys) ⇒ [Object](#Object) - * [.map(fn)](#Object+map) ⇒ [Object](#Object) - * [.mapKeys(fn)](#Object+mapKeys) ⇒ [Object](#Object) - * [.merge(...objects)](#Object+merge) ⇒ [Object](#Object) - * [.size()](#Object+size) ⇒ [Object](#Object) + * [.$invert()](#Object+$invert) ⇒ [Object](#Object) + * [.$lowerCaseKeys()](#Object+$lowerCaseKeys) ⇒ [Object](#Object) + * [.$map(fn)](#Object+$map) ⇒ [Object](#Object) + * [.$mapKeys(fn)](#Object+$mapKeys) ⇒ [Object](#Object) + * [.$merge(...objects)](#Object+$merge) ⇒ [Object](#Object) + * [.$size()](#Object+$size) ⇒ [Object](#Object) * _static_ - * [.isInstance(arg)](#Object.isInstance) ⇒ boolean + * [.isInstance](#Object.isInstance) ⇒ boolean - + -### object.invert() ⇒ [Object](#Object) +### object.$invert() ⇒ [Object](#Object) Inverts the key-value pairs of the object, without mutating it **Kind**: instance method of [Object](#Object) **Example** ```javascript -{ name: 'John', age: 20 }.invert(); // { 20: 'age', John: 'name' } +{ name: "John", age: 20 }.$invert(); // { 20: "age", John: "name" } ``` - + -### object.lowerCaseKeys() ⇒ [Object](#Object) +### object.$lowerCaseKeys() ⇒ [Object](#Object) Creates a new object from the specified object, where all the keys are in lowercase **Kind**: instance method of [Object](#Object) **Example** ```javascript -const myObj = { Name: 'Adam', sUrnAME: 'Smith' }; -const myObjLower = myObj.lowerCaseKeys(); // {name: 'Adam', surname: 'Smith'} +const myObj = { Name: "Adam", sUrnAME: "Smith" }; +const myObjLower = myObj.$lowerCaseKeys(); // {name: "Adam", surname: "Smith"} ``` - + -### object.map(fn) ⇒ [Object](#Object) -Creates an object with the same keys as the provided object and values generated by running the provided function for each value +### object.$map(fn) ⇒ [Object](#Object) +Creates an object with the same keys as the provided object and values +generated by running the provided function for each value **Kind**: instance method of [Object](#Object) @@ -991,15 +1031,16 @@ Creates an object with the same keys as the provided object and values generated **Example** ```javascript const users = { - fred: { user: 'fred', age: 40 }, - pebbles: { user: 'pebbles', age: 1 } + fred: { user: "fred", age: 40 }, + pebbles: { user: "pebbles", age: 1 } }; -users.map(u => u.age); // { fred: 40, pebbles: 1 } +users.$map(u => u.age); // { fred: 40, pebbles: 1 } ``` - + -### object.mapKeys(fn) ⇒ [Object](#Object) -Creates an object with keys generated by running the provided function for each key and the same values as the provided object +### object.$mapKeys(fn) ⇒ [Object](#Object) +Creates an object with keys generated by running the provided function for each key +and the same values as the provided object **Kind**: instance method of [Object](#Object) @@ -1009,11 +1050,11 @@ Creates an object with keys generated by running the provided function for each **Example** ```javascript -{ a: 1, b: 2 }.mapKeys((val, key) => key + val); // { a1: 1, b2: 2 } +{ a: 1, b: 2 }.$mapKeys((val, key) => key + val); // { a1: 1, b2: 2 } ``` - + -### object.merge(...objects) ⇒ [Object](#Object) +### object.$merge(...objects) ⇒ [Object](#Object) Creates a new object from the combination of two or more objects **Kind**: instance method of [Object](#Object) @@ -1031,26 +1072,26 @@ const object = { const other = { a: { z: 3 }, b: [2, 3], - c: 'foo' + c: "foo" }; -object.merge(other); // { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: 'foo' } +object.$merge(other); // { a: [ { x: 2 }, { y: 4 }, { z: 3 } ], b: [ 1, 2, 3 ], c: "foo" } ``` - + -### object.size() ⇒ [Object](#Object) +### object.$size() ⇒ [Object](#Object) Get size of the object **Kind**: instance method of [Object](#Object) **Example** ```javascript -{ one: 1, two: 2, three: 3 }.size(); // 3 +{ one: 1, two: 2, three: 3 }.$size(); // 3 ``` -### Object.isInstance(arg) ⇒ boolean +### Object.isInstance ⇒ boolean Returns true if the given argument is an object -**Kind**: static method of [Object](#Object) +**Kind**: static property of [Object](#Object) | Param | Type | | --- | --- | @@ -1068,6 +1109,8 @@ Object.isInstance({foo: 'bar'}); // true * [String](#String) : object * _instance_ + * [.base64()](#String+base64) ⇒ string + * [.base64Decode()](#String+base64Decode) ⇒ string * [.camelCase()](#String+camelCase) ⇒ string * [.capitalize([allWords])](#String+capitalize) ⇒ string * [.chars()](#String+chars) ⇒ Array.<string> @@ -1076,6 +1119,7 @@ Object.isInstance({foo: 'bar'}); // true * [.humanize()](#String+humanize) ⇒ string * [.kebabCase()](#String+kebabCase) ⇒ string * [.lines()](#String+lines) ⇒ Array.<string> + * [.map(fn)](#String+map) ⇒ Array.<string> * [.mask([num], [mask])](#String+mask) ⇒ string * [.pluralize(value, [plural])](#String+pluralize) ⇒ string * [.reverse()](#String+reverse) ⇒ string @@ -1084,8 +1128,28 @@ Object.isInstance({foo: 'bar'}); // true * [.truncate(num, [truncateString])](#String+truncate) ⇒ string * [.words(pattern)](#String+words) ⇒ Array.<string> * _static_ - * [.isInstance(arg)](#String.isInstance) ⇒ boolean + * [.isInstance](#String.isInstance) ⇒ boolean + + + +### string.base64() ⇒ string +Encodes data with MIME base64 + +**Kind**: instance method of [String](#String) +**Example** +```javascript +'prototyped.js'.base64(); // 'cHJvdG90eXBlZC5qcw==' +``` + +### string.base64Decode() ⇒ string +Decodes data encoded with MIME base64 + +**Kind**: instance method of [String](#String) +**Example** +```javascript +"cHJvdG90eXBlZC5qcw==".base64Decode(); // "prototyped.js" +``` ### string.camelCase() ⇒ string @@ -1094,10 +1158,11 @@ Converts the string to camelcase **Kind**: instance method of [String](#String) **Example** ```javascript -'some_database_field_name'.camelCase(); // 'someDatabaseFieldName' -'Some label that needs to be camelized'.camelCase(); // 'someLabelThatNeedsToBeCamelized' -'some-javascript-property'.camelCase(); // 'someJavascriptProperty' -'some-mixed_string with spaces_underscores-and-hyphens'.camelCase(); // 'someMixedStringWithSpacesUnderscoresAndHyphens' +"some_database_field_name".camelCase(); // "someDatabaseFieldName" +"Some label that needs to be camelized".camelCase(); // "someLabelThatNeedsToBeCamelized" +"some-javascript-property".camelCase(); // "someJavascriptProperty" +"some-mixed_string with spaces_underscores-and-hyphens".camelCase(); +// "someMixedStringWithSpacesUnderscoresAndHyphens" ``` @@ -1123,7 +1188,7 @@ Returns an array of the string's character **Kind**: instance method of [String](#String) **Example** ```javascript -'Hello'.chars(); // ['H', 'e', 'l', 'l', 'o'] +"Hello".chars(); // ["H", "e", "l", "l", "o"] ``` @@ -1160,7 +1225,8 @@ Returns the decapitalized string ### string.humanize() ⇒ string -Converts an underscored, camelized, or dasherized string into a humanized one. Also removes beginning and ending whitespace +Converts an underscored, camelized, or dasherized string into a humanized one. +Also removes beginning and ending whitespace **Kind**: instance method of [String](#String) **Example** @@ -1175,11 +1241,13 @@ Converts a string to kebab case **Kind**: instance method of [String](#String) **Example** ```javascript -'camelCase'.kebabCase(); // 'camel-case' -'some text'.kebabCase(); // 'some-text' -'some-mixed_string With spaces_underscores-and-hyphens'.kebabCase(); // 'some-mixed-string-with-spaces-underscores-and-hyphens' -'AllThe-small Things'.kebabCase(); // "all-the-small-things" -'IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'.kebabCase(); // 'i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html' +"camelCase".kebabCase(); // "camel-case" +"some text".kebabCase(); // "some-text" +"some-mixed_string With spaces_underscores-and-hyphens".kebabCase(); +// "some-mixed-string-with-spaces-underscores-and-hyphens" +"AllThe-small Things".kebabCase(); // "all-the-small-things" +"IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML".kebabCase(); +// "i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-some-xml-and-html" ``` @@ -1191,6 +1259,21 @@ Splits a multiline string into an array of lines ```javascript 'This\nis a\nmultiline\nstring.\n'.lines(); // ['This', 'is a', 'multiline', 'string.' , ''] ``` + + +### string.map(fn) ⇒ Array.<string> +Just like array.map + +**Kind**: instance method of [String](#String) + +| Param | Type | +| --- | --- | +| fn | function | + +**Example** +```javascript +'Hello'.map((char) => char == 'o' ? 'O' : char); // 'HellO' +``` ### string.mask([num], [mask]) ⇒ string @@ -1236,7 +1319,7 @@ Reverses the string **Kind**: instance method of [String](#String) **Example** ```javascript -'foobar'.reverse(); // 'raboof' +"foobar".reverse(); // "raboof" ``` @@ -1248,9 +1331,11 @@ Converts a string to snake case ```javascript 'camelCase'.snakeCase(); // 'camel_case' 'some text'.snakeCase(); // 'some_text' -'some-mixed_string With spaces_underscores-and-hyphens'.snakeCase(); // 'some_mixed_string_with_spaces_underscores_and_hyphens' +'some-mixed_string With spaces_underscores-and-hyphens'.snakeCase(); +// 'some_mixed_string_with_spaces_underscores_and_hyphens' 'AllThe-small Things'.snakeCase(); // "all_the_small_things" -'IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'.snakeCase(); // 'i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html' +'IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML'.snakeCase(); +// 'i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html' ``` @@ -1297,10 +1382,10 @@ Converts a given string into an array of words ``` -### String.isInstance(arg) ⇒ boolean +### String.isInstance ⇒ boolean Returns true if the given argument is an string -**Kind**: static method of [String](#String) +**Kind**: static property of [String](#String) | Param | Type | | --- | --- | @@ -1309,5 +1394,5 @@ Returns true if the given argument is an string **Example** ```javascript String.isInstance(2); // false -String.isInstance('foo bar'); // true +String.isInstance("foo bar"); // true ```