change approach again

This commit is contained in:
2018-05-09 14:31:22 +02:00
parent 54a933c83a
commit 0686e02b75
2252 changed files with 864743 additions and 270 deletions

View File

@ -0,0 +1,2 @@
tmp
out

View File

@ -0,0 +1,8 @@
language: node_js
node_js:
- 7
- 6
- 5
- 4
- iojs
- 0.12

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015-16 Lloyd Brookes <75pound@gmail.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.

View File

@ -0,0 +1,51 @@
[![view on npm](http://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back)
[![npm module downloads](http://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back)
[![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back)
[![Dependency Status](https://david-dm.org/75lb/array-back.svg)](https://david-dm.org/75lb/array-back)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
<a name="module_array-back"></a>
## array-back
**Example**
```js
var arrayify = require("array-back")
```
<a name="exp_module_array-back--arrayify"></a>
### arrayify(input) ⇒ <code>Array</code> ⏏
Takes any input and guarantees an array back.
- converts array-like objects (e.g. `arguments`) to a real array
- converts `undefined` to an empty array
- converts any another other, singular value (including `null`) into an array containing that value
- ignores input which is already an array
**Kind**: Exported function
| Param | Type | Description |
| --- | --- | --- |
| input | <code>\*</code> | the input value to convert to an array |
**Example**
```js
> a.arrayify(undefined)
[]
> a.arrayify(null)
[ null ]
> a.arrayify(0)
[ 0 ]
> a.arrayify([ 1, 2 ])
[ 1, 2 ]
> function f(){ return a.arrayify(arguments); }
> f(1,2,3)
[ 1, 2, 3 ]
```
* * *
&copy; 2015-16 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).

View File

@ -0,0 +1,11 @@
[![view on npm](http://img.shields.io/npm/v/array-back.svg)](https://www.npmjs.org/package/array-back)
[![npm module downloads](http://img.shields.io/npm/dt/array-back.svg)](https://www.npmjs.org/package/array-back)
[![Build Status](https://travis-ci.org/75lb/array-back.svg?branch=master)](https://travis-ci.org/75lb/array-back)
[![Dependency Status](https://david-dm.org/75lb/array-back.svg)](https://david-dm.org/75lb/array-back)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
{{>main}}
* * *
&copy; 2015-16 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).

View File

@ -0,0 +1,47 @@
'use strict'
var t = require('typical')
/**
* @module array-back
* @example
* var arrayify = require("array-back")
*/
module.exports = arrayify
/**
* Takes any input and guarantees an array back.
*
* - converts array-like objects (e.g. `arguments`) to a real array
* - converts `undefined` to an empty array
* - converts any another other, singular value (including `null`) into an array containing that value
* - ignores input which is already an array
*
* @param {*} - the input value to convert to an array
* @returns {Array}
* @alias module:array-back
* @example
* > a.arrayify(undefined)
* []
*
* > a.arrayify(null)
* [ null ]
*
* > a.arrayify(0)
* [ 0 ]
*
* > a.arrayify([ 1, 2 ])
* [ 1, 2 ]
*
* > function f(){ return a.arrayify(arguments); }
* > f(1,2,3)
* [ 1, 2, 3 ]
*/
function arrayify (input) {
if (input === undefined) {
return []
} else if (t.isArrayLike(input)) {
return Array.prototype.slice.call(input)
} else {
return Array.isArray(input) ? input : [ input ]
}
}

View File

@ -0,0 +1,66 @@
{
"_from": "array-back@^1.0.3",
"_id": "array-back@1.0.4",
"_inBundle": false,
"_integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=",
"_location": "/test-value/array-back",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "array-back@^1.0.3",
"name": "array-back",
"escapedName": "array-back",
"rawSpec": "^1.0.3",
"saveSpec": null,
"fetchSpec": "^1.0.3"
},
"_requiredBy": [
"/test-value"
],
"_resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz",
"_shasum": "644ba7f095f7ffcf7c43b5f0dc39d3c1f03c063b",
"_spec": "array-back@^1.0.3",
"_where": "/home/wn/workspace-node/homepage/node_modules/test-value",
"author": {
"name": "Lloyd Brookes",
"email": "75pound@gmail.com"
},
"bugs": {
"url": "https://github.com/75lb/array-back/issues"
},
"bundleDependencies": false,
"dependencies": {
"typical": "^2.6.0"
},
"deprecated": false,
"description": "Guarantees an array back",
"devDependencies": {
"core-assert": "^0.2.1",
"jsdoc-to-markdown": "^2.0.1",
"test-runner": "^0.3.0"
},
"engines": {
"node": ">=0.12.0"
},
"homepage": "https://github.com/75lb/array-back#readme",
"keywords": [
"to",
"convert",
"return",
"array",
"arrayify"
],
"license": "MIT",
"main": "./lib/array-back.js",
"name": "array-back",
"repository": {
"type": "git",
"url": "git+https://github.com/75lb/array-back.git"
},
"scripts": {
"docs": "jsdoc2md -t jsdoc2md/README.hbs lib/*.js > README.md; echo",
"test": "test-runner test/*.js"
},
"version": "1.0.4"
}

View File

@ -0,0 +1,18 @@
'use strict'
var TestRunner = require('test-runner')
var arrayify = require('../')
var a = require('core-assert')
var runner = new TestRunner()
runner.test('arrayify()', function () {
a.deepStrictEqual(arrayify(undefined), [])
a.deepStrictEqual(arrayify(null), [ null ])
a.deepStrictEqual(arrayify(0), [ 0 ])
a.deepStrictEqual(arrayify([ 1, 2 ]), [ 1, 2 ])
function func () {
a.deepStrictEqual(arrayify(arguments), [ 1, 2, 3 ])
}
func(1, 2, 3)
})