Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
richrdkng committed Aug 19, 2016
0 parents commit f61abf5
Show file tree
Hide file tree
Showing 31 changed files with 1,564 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .doclets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
packageJson: package.json

dir: src

articles:
- Overview: readme.md

branches:
- master
- develop
- feature/*
- release/*
- hotfix/*
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{json,yml}]
indent_size = 2
144 changes: 144 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
module.exports = {
extends : [
'eslint:all'
],
globals : {
'define': true,
'module': true,
'require' : true,
'console' : true,

'Symbol' : true,

// typed arrays
'Int8Array' : true,
'Uint8Array' : true,
'Uint8ClampedArray' : true,
'Int16Array' : true,
'Uint16Array' : true,
'Int32Array' : true,
'Uint32Array' : true,
'Float32Array' : true,
'Float64Array' : true
},
'parserOptions': {
'ecmaVersion': 5
},
rules : {
'strict': 'off',
'padded-blocks': 'off',
'func-names': 'off',
'no-var' : 'off',
'sort-vars' : 'off',
'no-multi-spaces': 'off',
'init-declarations': 'off',
'prefer-arrow-callback' : 'off',
'func-style': 'off',
'no-plusplus': 'off',
'no-continue': 'off',
'no-prototype-builtins': 'off',
'vars-on-top': 'error',
'prefer-reflect': 'off',
'space-unary-ops': 'off',
'key-spacing' : 'off',
'callback-return' : 'off',
'no-implicit-coercion' : 'off',
'no-negated-condition' : 'off',
'guard-for-in' : 'off',
'no-lonely-if' : 'off',
'no-self-compare': 'off',
'no-inline-comments' : 'off',
'lines-around-comment' : 'off',
'no-underscore-dangle': 'off',
'no-unused-expressions': 'off',
'one-var': 'off',
'indent': 'off',
'arrow-body-style' : 'off',
'wrap-regex' : 'off',
'prefer-spread' : 'off',
'prefer-rest-params' : 'off',
'no-invalid-this' : 'off',
'newline-before-return': 'off',
'no-console': [
'error', {
allow: [
'warn',
'error'
]
}
],
'new-cap': [
'error', {
'newIsCap': false,
'capIsNew': true,
}
],
'comma-dangle' : [
'error', 'always-multiline'
],
'max-params': [
'error', 5
],
'max-lines': [
'error', {
'max' : 999,
'skipBlankLines' : true,
'skipComments' : true
}
],
'quote-props': [
'error',
'as-needed', {
'keywords': false
}
],
'space-in-parens': 'off',
'id-length': [
'error', {
'exceptions': [
'i', 'j', 'p', 'n', 'x', 'y', 'w', 'e', 'h'
]
}
],
'linebreak-style': [
'error', 'unix'
],
'complexity': [
'error', 50
],
'max-statements': [
'error', 40
],
'max-len': [
'error', 120, 4
],
'camelcase': [
'error', {
'properties': 'never'
}
],
'quotes' : [
'error', 'single', {
'avoidEscape' : true,
'allowTemplateLiterals' : true
}
],
'default-case': [
'error', {
'commentPattern' : '^skip\\sdefault'
}
],
'no-magic-numbers': [
'error', {
'ignore' : [-1, 0, 1, 2],
'ignoreArrayIndexes' : true
}
],
'space-before-function-paren': [
'error', {
'anonymous' : 'never',
'named' : 'never'
}
]
}
};
59 changes: 59 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# General .gitattributes v1.0.0

# Auto detect text files and perform LF normalization
* text=auto
* eol=lf

# These files are text and should be normalized (Convert crlf => lf)
*.php text
*.css text
*.scss text
*.sass text
*.js text
*.htm text
*.html text
*.xml text
*.txt text
*.ini text
*.inc text
.htaccess text

# These files are binary and should be left untouched
# images
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.psd binary
*.ai binary

# fonts
*.ttf binary
*.woff binary
*.woff2 binary
*.eot binary

# documents
*.pdf binary
*.doc binary
*.docx binary

# compressed formats
*.zip binary
*.tar binary
*.gz binary
*.rar binary
*.7z binary

# executables
*.phar binary
*.exe binary

# media formats
*.mov binary
*.mp4 binary
*.mp3 binary
*.flv binary
*.fla binary
*.swf binary
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# IntelliJ project directory
.idea/

# Vagrant VM directory
.vagrant/

# Node project dependencies
/node_modules/

# Code coverage report
/cov/

# Logs
/npm-debug.log

# Required data for publishing project
/.publish.json
26 changes: 26 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# IntelliJ project directory
/.idea/

# Vagrant VM directory
/.vagrant/

# coverage directory (for development)
/cov/

# scripts directory (for development)
/scripts/

# source directory (for development)
/src/

# tests directory (for development)
/tests/

.doclets.yml
.editorconfig
.eslintrc.js
.gitattributes
.npmignore
.publish.json
.travis.yml
vagrantfile
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: node_js

node_js:
- stable
- "6"
- "6.1"
- "5"
- "5.1"
- "4"
- "4.2"
- "4.1"
- "4.0"

script:
- npm run ci
92 changes: 92 additions & 0 deletions dist/js-partial-is-array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
|----------------------------------------------------------------------------------------------------------------------
| A partial to check whether an object is an array.
|----------------------------------------------------------------------------------------------------------------------
*/

/**
* More information on [JavaScript Open Standards]{@link https://github.com/jsopenstd/jsopenstd}.
*
* @namespace js.partial
* @version 0.0.0
*
* @author Richard King <richrdkng@gmail.com> [GitHub]{@link https://github.com/richrdkng}
* @license [MIT]{@link https://github.com/jsopenstd/js-partial-foreach/blob/master/license.md}
*/

/**
* UMD - [returnExports.js pattern]{@link https://github.com/umdjs/umd/blob/master/templates/returnExports.js}
* For more information and license, check the link below:
* [UMD GitHub Repository]{@link https://github.com/umdjs/umd}
*/
(function(root, factory) {
// AMD
/* istanbul ignore next: ignore coverage test for UMD */
if (typeof define === 'function' && define.amd) {
define([], factory);

// CommonJS
} else if (typeof module === 'object' && module.exports) {
module.exports = factory();

// Browser
} else {
root.js_partial_isArray = factory();
}
}(this, function() {
'use strict';

/**
* Determines whether an object is an array.
* By default it handles **typed arrays and array-likes as non-arrays**.
*
* @function isArray
* @memberOf js.partial
*
* @param {*} object - The object to check.
* @param {boolean} [handleTypedArrayAsArray=false] - Handle a typed array as a regular array too.
* By default a typed array is not classified as a regular array.
* @param {boolean} [handleArrayLikeAsArray=false] - Handle an array-like as a regular array too.
* An array-like is anything, that has a valid .length property
* and behaves as a collection, that stores values
* (e.g.: arguments, strings, objects based on arrays/objects).
* By default an array-like is not classified as a regular array.
*
* @returns {boolean} If the object is an array, it will return true.
*/
return function isArray(object, handleTypedArrayAsArray, handleArrayLikeAsArray) {
var handleTypedArray = handleTypedArrayAsArray === true,
handleArrayLike = handleArrayLikeAsArray === true;

if (object !== null && typeof object === 'object') {

if ( ! handleTypedArray &&
! handleArrayLike) {

return Object.prototype.toString.call(object) === '[object Array]';
}

if (handleTypedArray) {
return object instanceof Int8Array ||
object instanceof Uint8Array ||
object instanceof Uint8ClampedArray ||
object instanceof Int16Array ||
object instanceof Uint16Array ||
object instanceof Int32Array ||
object instanceof Uint32Array ||
object instanceof Float32Array ||
object instanceof Float64Array;
}

if (handleArrayLike) {
if ('length' in object &&
typeof object.length === 'number') {

return true;
}
}
}

return false;
};
}));
2 changes: 2 additions & 0 deletions dist/js-partial-is-array.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f61abf5

Please sign in to comment.