Skip to content

Commit 0352d98

Browse files
committed
Merge pull request DefinitelyTyped#8458 from chrootsu/lodash-isSet
lodash: added _.isSet
2 parents 51f10a3 + a6ff127 commit 0352d98

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

lodash/lodash-tests.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7050,6 +7050,37 @@ module TestIsSafeInteger {
70507050
}
70517051
}
70527052

7053+
// _.isSet
7054+
module TestIsSet {
7055+
{
7056+
let value: number|Set<string>;
7057+
7058+
if (_.isSet<string>(value)) {
7059+
let result: Set<string> = value;
7060+
}
7061+
else {
7062+
let result: number = value;
7063+
}
7064+
}
7065+
7066+
{
7067+
let result: boolean;
7068+
7069+
result = _.isSet(any);
7070+
result = _(1).isSet();
7071+
result = _<any>([]).isSet();
7072+
result = _({}).isSet();
7073+
}
7074+
7075+
{
7076+
let result: _.LoDashExplicitWrapper<boolean>;
7077+
7078+
result = _(1).chain().isSet();
7079+
result = _<any>([]).chain().isSet();
7080+
result = _({}).chain().isSet();
7081+
}
7082+
}
7083+
70537084
// _.isString
70547085
module TestIsString {
70557086
{

lodash/lodash.d.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12132,6 +12132,31 @@ declare module _ {
1213212132
isSafeInteger(): LoDashExplicitWrapper<boolean>;
1213312133
}
1213412134

12135+
//_.isSet
12136+
interface LoDashStatic {
12137+
/**
12138+
* Checks if value is classified as a Set object.
12139+
*
12140+
* @param value The value to check.
12141+
* @returns Returns true if value is correctly classified, else false.
12142+
*/
12143+
isSet<T>(value?: any): value is Set<T>;
12144+
}
12145+
12146+
interface LoDashImplicitWrapperBase<T, TWrapper> {
12147+
/**
12148+
* @see _.isSet
12149+
*/
12150+
isSet(): boolean;
12151+
}
12152+
12153+
interface LoDashExplicitWrapperBase<T, TWrapper> {
12154+
/**
12155+
* @see _.isSet
12156+
*/
12157+
isSet(): LoDashExplicitWrapper<boolean>;
12158+
}
12159+
1213512160
//_.isString
1213612161
interface LoDashStatic {
1213712162
/**
@@ -18460,4 +18485,5 @@ declare module "lodash" {
1846018485
}
1846118486

1846218487
// Backward compatibility with --target es5
18488+
interface Set<T> {}
1846318489
interface Map<K, V> {}

0 commit comments

Comments
 (0)