Skip to content

Commit a6ff127

Browse files
committed
lodash: added _.isSet
1 parent 9f0f926 commit a6ff127

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
@@ -6932,6 +6932,37 @@ module TestIsSafeInteger {
69326932
}
69336933
}
69346934

6935+
// _.isSet
6936+
module TestIsSet {
6937+
{
6938+
let value: number|Set<string>;
6939+
6940+
if (_.isSet<string>(value)) {
6941+
let result: Set<string> = value;
6942+
}
6943+
else {
6944+
let result: number = value;
6945+
}
6946+
}
6947+
6948+
{
6949+
let result: boolean;
6950+
6951+
result = _.isSet(any);
6952+
result = _(1).isSet();
6953+
result = _<any>([]).isSet();
6954+
result = _({}).isSet();
6955+
}
6956+
6957+
{
6958+
let result: _.LoDashExplicitWrapper<boolean>;
6959+
6960+
result = _(1).chain().isSet();
6961+
result = _<any>([]).chain().isSet();
6962+
result = _({}).chain().isSet();
6963+
}
6964+
}
6965+
69356966
// _.isString
69366967
module TestIsString {
69376968
{

lodash/lodash.d.ts

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

11961+
//_.isSet
11962+
interface LoDashStatic {
11963+
/**
11964+
* Checks if value is classified as a Set object.
11965+
*
11966+
* @param value The value to check.
11967+
* @returns Returns true if value is correctly classified, else false.
11968+
*/
11969+
isSet<T>(value?: any): value is Set<T>;
11970+
}
11971+
11972+
interface LoDashImplicitWrapperBase<T, TWrapper> {
11973+
/**
11974+
* @see _.isSet
11975+
*/
11976+
isSet(): boolean;
11977+
}
11978+
11979+
interface LoDashExplicitWrapperBase<T, TWrapper> {
11980+
/**
11981+
* @see _.isSet
11982+
*/
11983+
isSet(): LoDashExplicitWrapper<boolean>;
11984+
}
11985+
1196111986
//_.isString
1196211987
interface LoDashStatic {
1196311988
/**
@@ -18286,4 +18311,5 @@ declare module "lodash" {
1828618311
}
1828718312

1828818313
// Backward compatibility with --target es5
18314+
interface Set<T> {}
1828918315
interface Map<K, V> {}

0 commit comments

Comments
 (0)