mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
Create typings for is-plain-object
This commit is contained in:
25
is-plain-object/is-plain-object-tests.ts
Normal file
25
is-plain-object/is-plain-object-tests.ts
Normal 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
10
is-plain-object/is-plain-object.d.ts
vendored
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user