Skip to content

Commit

Permalink
feat(checks): add date, map, nan, set checks
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Apr 26, 2018
1 parent d057d95 commit a865f62
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/checks/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export * from "./is-arraylike";
export * from "./is-blob";
export * from "./is-boolean";
export * from "./is-chrome";
export * from "./is-date";
export * from "./is-even";
export * from "./is-false";
export * from "./is-file";
Expand All @@ -22,7 +23,9 @@ export * from "./is-ie";
export * from "./is-in-range";
export * from "./is-int32";
export * from "./is-iterable";
export * from "./is-map";
export * from "./is-mobile";
export * from "./is-nan";
export * from "./is-negative";
export * from "./is-node";
export * from "./is-null";
Expand All @@ -35,6 +38,7 @@ export * from "./is-promise";
export * from "./is-promiselike";
export * from "./is-regexp";
export * from "./is-safari";
export * from "./is-set";
export * from "./is-string";
export * from "./is-symbol";
export * from "./is-transferable";
Expand Down
3 changes: 3 additions & 0 deletions packages/checks/src/is-date.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function isDate(x: any): x is Date {
return x instanceof Date;
}
3 changes: 3 additions & 0 deletions packages/checks/src/is-map.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function isMap(x: any): x is Set<any> {
return x instanceof Map;
}
3 changes: 3 additions & 0 deletions packages/checks/src/is-nan.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function isNaN(x: any) {
return x !== x;
}
2 changes: 1 addition & 1 deletion packages/checks/src/is-plain-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @param x
*/
export function isPlainObject(x: any): x is Object {
export function isPlainObject(x: any): x is object {
let proto;
return Object.prototype.toString.call(x) === "[object Object]" &&
(proto = Object.getPrototypeOf(x), proto === null || proto === Object.getPrototypeOf({}));
Expand Down
3 changes: 3 additions & 0 deletions packages/checks/src/is-set.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function isSet(x: any): x is Set<any> {
return x instanceof Set;
}

0 comments on commit a865f62

Please sign in to comment.