Create typings for is-plain-object

This commit is contained in:
Kevin Zeng
2016-09-08 16:45:29 +08:00
parent 01a3adcdb6
commit 25b3e88086
2 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
/// <reference path="is-plain-object.d.ts" />
import * as isPlainObject from 'is-plain-object';
isPlainObject(Object.create({}));
//=> true
isPlainObject(Object.create(Object.prototype));
//=> true
isPlainObject({foo: 'bar'});
//=> true
isPlainObject({});
isPlainObject(1);
//=> false
isPlainObject(['foo', 'bar']);
//=> false
isPlainObject([]);
//=> false
class Foo {}
isPlainObject(new Foo);
//=> false
isPlainObject(null);
//=> false
isPlainObject(Object.create(null));
//=> false

10
is-plain-object/is-plain-object.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
// Type definitions for is-plain-object
// Project: https://github.com/jonschlinkert/is-plain-object
// Definitions by: Kevin Zeng <https://github.com/zengfenfei/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "is-plain-object" {
namespace isPlainObject {}
function isPlainObject(obj: any): boolean;
export = isPlainObject;
}