lodash: added _.isWeakSet

This commit is contained in:
Ilya Mochalov
2016-03-02 23:01:58 +05:00
parent ca92a5b250
commit eedec57cba
2 changed files with 57 additions and 0 deletions

View File

@@ -7201,6 +7201,37 @@ module TestIsWeakMap {
}
}
// _.isWeakSet
module TestIsWeakSet {
{
let value: number|WeakSet<string>;
if (_.isWeakSet<string>(value)) {
let result: WeakSet<string> = value;
}
else {
let result: number = value;
}
}
{
let result: boolean;
result = _.isWeakSet(any);
result = _(1).isWeakSet();
result = _<any>([]).isWeakSet();
result = _({}).isWeakSet();
}
{
let result: _.LoDashExplicitWrapper<boolean>;
result = _(1).chain().isWeakSet();
result = _<any>([]).chain().isWeakSet();
result = _({}).chain().isWeakSet();
}
}
// _.lt
module TestLt {
{

26
lodash/lodash.d.ts vendored
View File

@@ -12292,6 +12292,31 @@ declare module _ {
isWeakMap(): LoDashExplicitWrapper<boolean>;
}
//_.isWeakSet
interface LoDashStatic {
/**
* Checks if value is classified as a WeakSet object.
*
* @param value The value to check.
* @returns Returns true if value is correctly classified, else false.
*/
isWeakSet<T>(value?: any): value is WeakSet<T>;
}
interface LoDashImplicitWrapperBase<T, TWrapper> {
/**
* @see _.isWeakSet
*/
isWeakSet(): boolean;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.isWeakSet
*/
isWeakSet(): LoDashExplicitWrapper<boolean>;
}
//_.lt
interface LoDashStatic {
/**
@@ -18512,4 +18537,5 @@ declare module "lodash" {
// Backward compatibility with --target es5
interface Set<T> {}
interface Map<K, V> {}
interface WeakSet<T> {}
interface WeakMap<K, V> {}