From d8e89fd35eeafe0705a158f92b7be49f950cd2ca Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 18 Feb 2016 23:12:24 +0500 Subject: [PATCH] lodash: added _.castArray --- lodash/lodash-tests.ts | 35 ++++++++++++++++++++++++++++ lodash/lodash.d.ts | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 17dfb80e4..8a8a433c1 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6000,6 +6000,41 @@ module TestWrap { * Lang * ********/ +// _.castArray +namespace TestCastArray { + { + let result: number[]; + + result = _.castArray(42); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(42).castArray(); + result = _([42]).castArray(); + } + + { + let result: _.LoDashImplicitArrayWrapper<{a: number}>; + + result = _({a: 42}).castArray(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(42).chain().castArray(); + result = _([42]).chain().castArray(); + } + + { + let result: _.LoDashExplicitArrayWrapper<{a: number}>; + + result = _({a: 42}).chain().castArray(); + } +} + // _.clone { let result: number; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 6618209cb..ad5dba0d5 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10596,6 +10596,59 @@ declare module _ { * Lang * ********/ + //_.castArray + interface LoDashStatic { + /** + * Casts value as an array if it’s not one. + * + * @param value The value to inspect. + * @return Returns the cast array. + */ + castArray(value: T): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.castArray + */ + castArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.castArray + */ + castArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.castArray + */ + castArray(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.castArray + */ + castArray(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.castArray + */ + castArray(): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.castArray + */ + castArray(): LoDashExplicitArrayWrapper; + } + //_.clone interface LoDashStatic { /**