[Pkg-javascript-commits] [node-is-obj] 01/08: Import Upstream version 1.0.1
Ross Gammon
ross-guest at moszumanska.debian.org
Tue Jan 31 18:42:48 UTC 2017
This is an automated email from the git hooks/post-receive script.
ross-guest pushed a commit to branch master
in repository node-is-obj.
commit dd638f6966542f999c08da73f40e8611988e4ec2
Author: Gaurav Juvekar <gauravjuvekar at gmail.com>
Date: Thu Jan 5 11:18:03 2017 +0100
Import Upstream version 1.0.1
---
.editorconfig | 12 ++++++++++++
.gitattributes | 1 +
.gitignore | 1 +
.travis.yml | 7 +++++++
index.js | 5 +++++
license | 21 +++++++++++++++++++++
package.json | 33 +++++++++++++++++++++++++++++++++
readme.md | 34 ++++++++++++++++++++++++++++++++++
test.js | 25 +++++++++++++++++++++++++
9 files changed, 139 insertions(+)
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..98a761d
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,12 @@
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[{package.json,*.yml}]
+indent_style = space
+indent_size = 2
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..176a458
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text=auto
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..a78e23d
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,7 @@
+sudo: false
+language: node_js
+node_js:
+ - '5'
+ - '4'
+ - '0.12'
+ - '0.10'
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..4d023bc
--- /dev/null
+++ b/index.js
@@ -0,0 +1,5 @@
+'use strict';
+module.exports = function (x) {
+ var type = typeof x;
+ return x !== null && (type === 'object' || type === 'function');
+};
diff --git a/license b/license
new file mode 100644
index 0000000..654d0bf
--- /dev/null
+++ b/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus at gmail.com> (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.
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..c441d27
--- /dev/null
+++ b/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "is-obj",
+ "version": "1.0.1",
+ "description": "Check if a value is an object",
+ "license": "MIT",
+ "repository": "sindresorhus/is-obj",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus at gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "obj",
+ "object",
+ "is",
+ "check",
+ "test",
+ "type"
+ ],
+ "devDependencies": {
+ "ava": "*",
+ "xo": "*"
+ }
+}
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..d311026
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,34 @@
+# 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.<br>
+See [`is-plain-obj`](https://github.com/sindresorhus/is-plain-obj) if you want to check for plain objects.
+
+
+## Install
+
+```
+$ npm install --save is-obj
+```
+
+
+## Usage
+
+```js
+const isObj = require('is-obj');
+
+isObj({foo: 'bar'});
+//=> true
+
+isObj([1, 2, 3]);
+//=> true
+
+isObj('foo');
+//=> false
+```
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..d441dee
--- /dev/null
+++ b/test.js
@@ -0,0 +1,25 @@
+import test from 'ava';
+import m from './';
+
+test(t => {
+ t.true(m({}));
+ t.true(m(new Object())); // eslint-disable-line
+ t.true(m(new Date()));
+ t.true(m(new RegExp()));
+ t.true(m(Object.create(null)));
+ t.true(m({foo: true}));
+ t.true(m([]));
+ t.true(m(['foo', 'bar']));
+ t.true(m(() => {}));
+ t.true(m(arguments));
+ t.true(m(/./));
+ t.true(m(Object(0)));
+ t.true(m(Object('foo')));
+ t.true(m(Object(false)));
+ t.false(m(null));
+ t.false(m(undefined));
+ t.false(m(NaN));
+ t.false(m(''));
+ t.false(m(0));
+ t.false(m(false));
+});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-is-obj.git
More information about the Pkg-javascript-commits
mailing list