[Pkg-javascript-commits] [node-is-arrayish] 01/03: Import Upstream version 0.3.0

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Tue Oct 25 11:22:23 UTC 2016


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository node-is-arrayish.

commit 7bead605dc4ef82cf046d4abcc79d5efdaf59490
Author: Shanavas M <shanavas.m2 at gmail.com>
Date:   Tue Oct 18 07:59:01 2016 +0000

    Import Upstream version 0.3.0
---
 .editorconfig    | 18 ++++++++++++++++++
 .gitignore       |  4 ++++
 .istanbul.yml    |  4 ++++
 .npmignore       |  5 +++++
 .travis.yml      | 16 ++++++++++++++++
 LICENSE          | 21 +++++++++++++++++++++
 README.md        | 16 ++++++++++++++++
 index.js         | 11 +++++++++++
 package.json     | 34 ++++++++++++++++++++++++++++++++++
 test/test.coffee | 20 ++++++++++++++++++++
 10 files changed, 149 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..4c017f8
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,18 @@
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.coffee]
+indent_style = space
+
+[{package.json,*.yml}]
+indent_style = space
+indent_size = 2
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fd0fbb0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.sw[a-p]
+/node_modules/
+npm-ignore.log
+/coverage/
diff --git a/.istanbul.yml b/.istanbul.yml
new file mode 100644
index 0000000..19fbec3
--- /dev/null
+++ b/.istanbul.yml
@@ -0,0 +1,4 @@
+instrumentation:
+  excludes:
+    - test.js
+    - test/**/*
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..8d5eacb
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,5 @@
+/coverage/
+/test.js
+/test/
+*.sw[a-p]
+/node_modules/
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..c716af2
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,16 @@
+language: node_js
+
+script:
+  - node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- --compilers coffee:coffee-script/register
+  - cat coverage/lcov.info | node_modules/.bin/coveralls
+node_js:
+  - "0.10"
+  - "0.11"
+  - "0.12"
+  - "iojs"
+os:
+  - linux
+
+notifications:
+  slack:
+    secure: oOt8QGzdrPDsTMcyahtIq5Q+0U1iwfgJgFCxBLsomQ0bpIMn+y5m4viJydA2UinHPGc944HS3LMZS9iKQyv+DjTgbhUyNXqeVjtxCwRe37f5rKQlXVvdfmjHk2kln4H8DcK3r5Qd/+2hd9BeMsp2GImTrkRSud1CZQlhhe5IgZOboSoWpGVMMy1iazWT06tAtiB2LRVhmsdUaFZDWAhGZ+UAvCPf+mnBOAylIj+U0GDrofhfTi25RK0gddG2f/p2M1HCu49O6wECGWkt2hVei233DkNJyLLLJVcvmhf+aXkV5TjMyaoxh/HdcV4DrA7KvYuWmWWKsINa9hlwAsdd/FYmJ6PjRkKWas2JoQ1C+qOzDxyQvn3CaUZFKD99pdsq0rBBZujqXQKZZ/hWb/CE74BI6fKmqQkiEPaD/7uADj04FEg6HVBZaMCyauOaK5b3VC97twbALZ1qVxYV6mU+zSEvnUbpnjjv [...]
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..0a5f461
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 JD Ballard
+
+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/README.md b/README.md
new file mode 100644
index 0000000..7d36072
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+# node-is-arrayish [![Travis-CI.org Build Status](https://img.shields.io/travis/Qix-/node-is-arrayish.svg?style=flat-square)](https://travis-ci.org/Qix-/node-is-arrayish) [![Coveralls.io Coverage Rating](https://img.shields.io/coveralls/Qix-/node-is-arrayish.svg?style=flat-square)](https://coveralls.io/r/Qix-/node-is-arrayish)
+> Determines if an object can be used like an Array
+
+## Example
+```javascript
+var isArrayish = require('is-arrayish');
+
+isArrayish([]); // true
+isArrayish({__proto__: []}); // true
+isArrayish({}); // false
+isArrayish({length:10}); // false
+```
+
+## License
+Licensed under the [MIT License](http://opensource.org/licenses/MIT).
+You can find a copy of it in [LICENSE](LICENSE).
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..9244ffd
--- /dev/null
+++ b/index.js
@@ -0,0 +1,11 @@
+'use strict';
+
+module.exports = function isArrayish(obj) {
+	if (!obj) {
+		return false;
+	}
+
+	return obj instanceof Array || Array.isArray(obj) ||
+		(obj.length >= 0 && (obj.splice instanceof Function ||
+			(Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..6a7df2c
--- /dev/null
+++ b/package.json
@@ -0,0 +1,34 @@
+{
+  "name": "is-arrayish",
+  "description": "Determines if an object can be used as an array",
+  "version": "0.3.0",
+  "author": "Qix (http://github.com/qix-)",
+  "keywords": [
+    "is",
+    "array",
+    "duck",
+    "type",
+    "arrayish",
+    "similar",
+    "proto",
+    "prototype",
+    "type"
+  ],
+  "license": "MIT",
+  "scripts": {
+    "pretest": "xo",
+    "test": "mocha --compilers coffee:coffee-script/register"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/qix-/node-is-arrayish.git"
+  },
+  "devDependencies": {
+    "coffee-script": "^1.9.3",
+    "coveralls": "^2.11.2",
+    "istanbul": "^0.3.17",
+    "mocha": "^2.2.5",
+    "should": "^7.0.1",
+    "xo": "^0.6.1"
+  }
+}
diff --git a/test/test.coffee b/test/test.coffee
new file mode 100644
index 0000000..0341ec4
--- /dev/null
+++ b/test/test.coffee
@@ -0,0 +1,20 @@
+should = require 'should'
+isArrayish = require '../'
+
+Error.stackTraceLimit = Infinity
+
+it 'should check if things are like arrays', ->
+  (isArrayish 1).should.equal no
+  (isArrayish 'hello').should.equal no
+  (isArrayish {}).should.equal no
+  (isArrayish null).should.equal no
+  (isArrayish undefined).should.equal no
+
+  (isArrayish length: 123, splice: (->)).should.equal yes
+  (isArrayish length: 3, 0: 1, 1: 15, 2: 17).should.equal yes
+  (isArrayish []).should.equal yes
+  (isArrayish __proto__: []).should.equal yes
+  (isArrayish __proto__: Array.prototype).should.equal yes
+  if Object.setPrototypeOf
+    (isArrayish Object.setPrototypeOf {}, []).should.equal yes
+    (isArrayish Object.setPrototypeOf {}, Array.prototype).should.equal yes

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-is-arrayish.git



More information about the Pkg-javascript-commits mailing list