mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-22 20:37:58 +08:00
(feature) Add _.functionsIn
This commit is contained in:
@@ -8152,6 +8152,31 @@ module TestFunctions {
|
||||
}
|
||||
}
|
||||
|
||||
// _.functionsIn
|
||||
module TestFunctionsIn {
|
||||
type SampleObject = {a: number; b: string; c: boolean;};
|
||||
|
||||
let object: SampleObject;
|
||||
|
||||
{
|
||||
let result: string[];
|
||||
|
||||
result = _.functionsIn<SampleObject>(object);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitArrayWrapper<string>;
|
||||
|
||||
result = _(object).functionsIn();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitArrayWrapper<string>;
|
||||
|
||||
result = _(object).chain().functionsIn();
|
||||
}
|
||||
}
|
||||
|
||||
// _.get
|
||||
result = <number>_.get<number>({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c');
|
||||
|
||||
|
||||
67
lodash/lodash.d.ts
vendored
67
lodash/lodash.d.ts
vendored
@@ -99,9 +99,9 @@ added 18 lang methods:
|
||||
- [ ] _.toString
|
||||
|
||||
added 13 object methods:
|
||||
- [ ] _.assignIn
|
||||
- [ ] _.assignInWith
|
||||
- [ ] _.assignWith
|
||||
- [x] _.assignIn
|
||||
- [x] _.assignInWith
|
||||
- [x] _.assignWith
|
||||
- [ ] _.functionsIn
|
||||
- [ ] _.hasIn
|
||||
- [ ] _.invoke
|
||||
@@ -13009,10 +13009,25 @@ declare module _ {
|
||||
//_.functions
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates an array of function property names from all enumerable properties, own and inherited, of object.
|
||||
* Creates an array of function property names from own enumerable properties
|
||||
* of `object`.
|
||||
*
|
||||
* @param object The object to inspect.
|
||||
* @return Returns the new array of property names.
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Object
|
||||
* @param {Object} object The object to inspect.
|
||||
* @returns {Array} Returns the new array of property names.
|
||||
* @example
|
||||
*
|
||||
* function Foo() {
|
||||
* this.a = _.constant('a');
|
||||
* this.b = _.constant('b');
|
||||
* }
|
||||
*
|
||||
* Foo.prototype.c = _.constant('c');
|
||||
*
|
||||
* _.functions(new Foo);
|
||||
* // => ['a', 'b']
|
||||
*/
|
||||
functions<T extends {}>(object: any): string[];
|
||||
}
|
||||
@@ -13031,6 +13046,46 @@ declare module _ {
|
||||
functions(): _.LoDashExplicitArrayWrapper<string>;
|
||||
}
|
||||
|
||||
//_.functionsIn
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates an array of function property names from own and inherited
|
||||
* enumerable properties of `object`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Object
|
||||
* @param {Object} object The object to inspect.
|
||||
* @returns {Array} Returns the new array of property names.
|
||||
* @example
|
||||
*
|
||||
* function Foo() {
|
||||
* this.a = _.constant('a');
|
||||
* this.b = _.constant('b');
|
||||
* }
|
||||
*
|
||||
* Foo.prototype.c = _.constant('c');
|
||||
*
|
||||
* _.functionsIn(new Foo);
|
||||
* // => ['a', 'b', 'c']
|
||||
*/
|
||||
functionsIn<T extends {}>(object: any): string[];
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.functionsIn
|
||||
*/
|
||||
functionsIn(): _.LoDashImplicitArrayWrapper<string>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.functionsIn
|
||||
*/
|
||||
functionsIn(): _.LoDashExplicitArrayWrapper<string>;
|
||||
}
|
||||
|
||||
//_.get
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user