pax_global_header00006660000000000000000000000064134563633360014526gustar00rootroot0000000000000052 comment=65347b53b6a013900c4ea2fa9920ce6fb366a2ed is-obj-2.0.0/000077500000000000000000000000001345636333600127105ustar00rootroot00000000000000is-obj-2.0.0/.editorconfig000066400000000000000000000002571345636333600153710ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.yml] indent_style = space indent_size = 2 is-obj-2.0.0/.gitattributes000066400000000000000000000000231345636333600155760ustar00rootroot00000000000000* text=auto eol=lf is-obj-2.0.0/.gitignore000066400000000000000000000000271345636333600146770ustar00rootroot00000000000000node_modules yarn.lock is-obj-2.0.0/.npmrc000066400000000000000000000000231345636333600140230ustar00rootroot00000000000000package-lock=false is-obj-2.0.0/.travis.yml000066400000000000000000000000541345636333600150200ustar00rootroot00000000000000language: node_js node_js: - '10' - '8' is-obj-2.0.0/index.d.ts000066400000000000000000000005311345636333600146100ustar00rootroot00000000000000/** Check if a value is an object. Keep in mind that array, function, regexp, etc, are objects in JavaScript. @example ``` import isObject = require('is-obj'); isObject({foo: 'bar'}); //=> true isObject([1, 2, 3]); //=> true isObject('foo'); //=> false ``` */ declare function isObject(value: unknown): value is object; export = isObject; is-obj-2.0.0/index.js000066400000000000000000000002201345636333600143470ustar00rootroot00000000000000'use strict'; module.exports = value => { const type = typeof value; return value !== null && (type === 'object' || type === 'function'); }; is-obj-2.0.0/index.test-d.ts000066400000000000000000000002061345636333600155640ustar00rootroot00000000000000import {expectType} from 'tsd'; import isObject = require('.'); const foo = 'foo'; if (isObject(foo)) { expectType(foo); } is-obj-2.0.0/license000066400000000000000000000021251345636333600142550ustar00rootroot00000000000000MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. is-obj-2.0.0/package.json000066400000000000000000000010271345636333600151760ustar00rootroot00000000000000{ "name": "is-obj", "version": "2.0.0", "description": "Check if a value is an object", "license": "MIT", "repository": "sindresorhus/is-obj", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=8" }, "scripts": { "test": "xo && ava && tsd" }, "files": [ "index.js", "index.d.ts" ], "keywords": [ "object", "is", "check", "test", "type" ], "devDependencies": { "ava": "^1.4.1", "tsd": "^0.7.2", "xo": "^0.24.0" } } is-obj-2.0.0/readme.md000066400000000000000000000012601345636333600144660ustar00rootroot00000000000000# is-obj [![Build Status](https://travis-ci.org/sindresorhus/is-obj.svg?branch=master)](https://travis-ci.org/sindresorhus/is-obj) > Check if a value is an object Keep in mind that array, function, regexp, etc, are objects in JavaScript.
See [`is-plain-obj`](https://github.com/sindresorhus/is-plain-obj) if you want to check for plain objects. ## Install ``` $ npm install is-obj ``` ## Usage ```js const isObject = require('is-obj'); isObject({foo: 'bar'}); //=> true isObject([1, 2, 3]); //=> true isObject('foo'); //=> false ``` ## Related - [is](https://github.com/sindresorhus/is) - Type check values ## License MIT © [Sindre Sorhus](https://sindresorhus.com) is-obj-2.0.0/test.js000066400000000000000000000013131345636333600142230ustar00rootroot00000000000000import test from 'ava'; import isObject from '.'; test('main', t => { /* eslint-disable no-new-object */ t.true(isObject({})); t.true(isObject(new Object())); t.true(isObject(new Date())); t.true(isObject(new RegExp())); t.true(isObject(Object.create(null))); t.true(isObject({foo: true})); t.true(isObject([])); t.true(isObject(['foo', 'bar'])); t.true(isObject(() => {})); t.true(isObject(/./)); t.true(isObject(new Object(0))); t.true(isObject(new Object('foo'))); t.true(isObject(new Object(false))); t.false(isObject(null)); t.false(isObject(undefined)); t.false(isObject(NaN)); t.false(isObject('')); t.false(isObject(0)); t.false(isObject(false)); /* eslint-enable no-new-object */ });