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

2
node_modules/typical/.npmignore generated vendored Normal file
View File

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

9
node_modules/typical/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,9 @@
language: node_js
node_js:
- '0.10'
- 0.12
- iojs
- 4
- 5
- 6
- 7

22
node_modules/typical/LICENSE generated vendored Normal file
View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014-17 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.

205
node_modules/typical/README.md generated vendored Normal file
View File

@ -0,0 +1,205 @@
[![view on npm](http://img.shields.io/npm/v/typical.svg)](https://www.npmjs.org/package/typical)
[![npm module downloads](http://img.shields.io/npm/dt/typical.svg)](https://www.npmjs.org/package/typical)
[![Build Status](https://travis-ci.org/75lb/typical.svg?branch=master)](https://travis-ci.org/75lb/typical)
[![Dependency Status](https://david-dm.org/75lb/typical.svg)](https://david-dm.org/75lb/typical)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
<a name="module_typical"></a>
## typical
For type-checking Javascript values.
**Example**
```js
const t = require('typical')
```
* [typical](#module_typical)
* [.isNumber(n)](#module_typical.isNumber) ⇒ <code>boolean</code>
* [.isPlainObject(input)](#module_typical.isPlainObject) ⇒ <code>boolean</code>
* [.isArrayLike(input)](#module_typical.isArrayLike) ⇒ <code>boolean</code>
* [.isObject(input)](#module_typical.isObject) ⇒ <code>boolean</code>
* [.isDefined(input)](#module_typical.isDefined) ⇒ <code>boolean</code>
* [.isString(input)](#module_typical.isString) ⇒ <code>boolean</code>
* [.isBoolean(input)](#module_typical.isBoolean) ⇒ <code>boolean</code>
* [.isFunction(input)](#module_typical.isFunction) ⇒ <code>boolean</code>
* [.isClass(input)](#module_typical.isClass) ⇒ <code>boolean</code>
* [.isPrimitive(input)](#module_typical.isPrimitive) ⇒ <code>boolean</code>
* [.isPromise(input)](#module_typical.isPromise) ⇒ <code>boolean</code>
* [.isIterable(input)](#module_typical.isIterable) ⇒ <code>boolean</code>
<a name="module_typical.isNumber"></a>
### t.isNumber(n) ⇒ <code>boolean</code>
Returns true if input is a number
**Kind**: static method of [<code>typical</code>](#module_typical)
| Param | Type | Description |
| --- | --- | --- |
| n | <code>\*</code> | the input to test |
**Example**
```js
> t.isNumber(0)
true
> t.isNumber(1)
true
> t.isNumber(1.1)
true
> t.isNumber(0xff)
true
> t.isNumber(0644)
true
> t.isNumber(6.2e5)
true
> t.isNumber(NaN)
false
> t.isNumber(Infinity)
false
```
<a name="module_typical.isPlainObject"></a>
### t.isPlainObject(input) ⇒ <code>boolean</code>
A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
**Kind**: static method of [<code>typical</code>](#module_typical)
| Param | Type | Description |
| --- | --- | --- |
| input | <code>\*</code> | the input to test |
**Example**
```js
> t.isPlainObject({ clive: 'hater' })
true
> t.isPlainObject(new Date())
false
> t.isPlainObject([ 0, 1 ])
false
> t.isPlainObject(1)
false
> t.isPlainObject(/test/)
false
```
<a name="module_typical.isArrayLike"></a>
### t.isArrayLike(input) ⇒ <code>boolean</code>
An array-like value has all the properties of an array, but is not an array instance. Examples in the `arguments` object. Returns true if the input value is an object, not null and has a `length` property with a numeric value.
**Kind**: static method of [<code>typical</code>](#module_typical)
| Param | Type | Description |
| --- | --- | --- |
| input | <code>\*</code> | the input to test |
**Example**
```js
function sum(x, y){
console.log(t.isArrayLike(arguments))
// prints `true`
}
```
<a name="module_typical.isObject"></a>
### t.isObject(input) ⇒ <code>boolean</code>
returns true if the typeof input is `'object'`, but not null!
**Kind**: static method of [<code>typical</code>](#module_typical)
| Param | Type | Description |
| --- | --- | --- |
| input | <code>\*</code> | the input to test |
<a name="module_typical.isDefined"></a>
### t.isDefined(input) ⇒ <code>boolean</code>
Returns true if the input value is defined
**Kind**: static method of [<code>typical</code>](#module_typical)
| Param | Type | Description |
| --- | --- | --- |
| input | <code>\*</code> | the input to test |
<a name="module_typical.isString"></a>
### t.isString(input) ⇒ <code>boolean</code>
Returns true if the input value is a string
**Kind**: static method of [<code>typical</code>](#module_typical)
| Param | Type | Description |
| --- | --- | --- |
| input | <code>\*</code> | the input to test |
<a name="module_typical.isBoolean"></a>
### t.isBoolean(input) ⇒ <code>boolean</code>
Returns true if the input value is a boolean
**Kind**: static method of [<code>typical</code>](#module_typical)
| Param | Type | Description |
| --- | --- | --- |
| input | <code>\*</code> | the input to test |
<a name="module_typical.isFunction"></a>
### t.isFunction(input) ⇒ <code>boolean</code>
Returns true if the input value is a function
**Kind**: static method of [<code>typical</code>](#module_typical)
| Param | Type | Description |
| --- | --- | --- |
| input | <code>\*</code> | the input to test |
<a name="module_typical.isClass"></a>
### t.isClass(input) ⇒ <code>boolean</code>
Returns true if the input value is an es2015 `class`.
**Kind**: static method of [<code>typical</code>](#module_typical)
| Param | Type | Description |
| --- | --- | --- |
| input | <code>\*</code> | the input to test |
<a name="module_typical.isPrimitive"></a>
### t.isPrimitive(input) ⇒ <code>boolean</code>
Returns true if the input is a string, number, symbol, boolean, null or undefined value.
**Kind**: static method of [<code>typical</code>](#module_typical)
| Param | Type | Description |
| --- | --- | --- |
| input | <code>\*</code> | the input to test |
<a name="module_typical.isPromise"></a>
### t.isPromise(input) ⇒ <code>boolean</code>
Returns true if the input is a Promise.
**Kind**: static method of [<code>typical</code>](#module_typical)
| Param | Type | Description |
| --- | --- | --- |
| input | <code>\*</code> | the input to test |
<a name="module_typical.isIterable"></a>
### t.isIterable(input) ⇒ <code>boolean</code>
Returns true if the input is an iterable (`Map`, `Set`, `Array` etc.).
**Kind**: static method of [<code>typical</code>](#module_typical)
| Param | Type | Description |
| --- | --- | --- |
| input | <code>\*</code> | the input to test |
* * *
&copy; 2014-17 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).

11
node_modules/typical/jsdoc2md/README.hbs generated vendored Normal file
View File

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

200
node_modules/typical/lib/typical.js generated vendored Normal file
View File

@ -0,0 +1,200 @@
'use strict'
/**
* For type-checking Javascript values.
* @module typical
* @typicalname t
* @example
* const t = require('typical')
*/
exports.isNumber = isNumber
exports.isString = isString
exports.isBoolean = isBoolean
exports.isPlainObject = isPlainObject
exports.isArrayLike = isArrayLike
exports.isObject = isObject
exports.isDefined = isDefined
exports.isFunction = isFunction
exports.isClass = isClass
exports.isPrimitive = isPrimitive
exports.isPromise = isPromise
exports.isIterable = isIterable
/**
* Returns true if input is a number
* @param {*} - the input to test
* @returns {boolean}
* @static
* @example
* > t.isNumber(0)
* true
* > t.isNumber(1)
* true
* > t.isNumber(1.1)
* true
* > t.isNumber(0xff)
* true
* > t.isNumber(0644)
* true
* > t.isNumber(6.2e5)
* true
* > t.isNumber(NaN)
* false
* > t.isNumber(Infinity)
* false
*/
function isNumber (n) {
return !isNaN(parseFloat(n)) && isFinite(n)
}
/**
* A plain object is a simple object literal, it is not an instance of a class. Returns true if the input `typeof` is `object` and directly decends from `Object`.
*
* @param {*} - the input to test
* @returns {boolean}
* @static
* @example
* > t.isPlainObject({ clive: 'hater' })
* true
* > t.isPlainObject(new Date())
* false
* > t.isPlainObject([ 0, 1 ])
* false
* > t.isPlainObject(1)
* false
* > t.isPlainObject(/test/)
* false
*/
function isPlainObject (input) {
return input !== null && typeof input === 'object' && input.constructor === Object
}
/**
* An array-like value has all the properties of an array, but is not an array instance. Examples in the `arguments` object. Returns true if the input value is an object, not null and has a `length` property with a numeric value.
*
* @param {*} - the input to test
* @returns {boolean}
* @static
* @example
* function sum(x, y){
* console.log(t.isArrayLike(arguments))
* // prints `true`
* }
*/
function isArrayLike (input) {
return isObject(input) && typeof input.length === 'number'
}
/**
* returns true if the typeof input is `'object'`, but not null!
* @param {*} - the input to test
* @returns {boolean}
* @static
*/
function isObject (input) {
return typeof input === 'object' && input !== null
}
/**
* Returns true if the input value is defined
* @param {*} - the input to test
* @returns {boolean}
* @static
*/
function isDefined (input) {
return typeof input !== 'undefined'
}
/**
* Returns true if the input value is a string
* @param {*} - the input to test
* @returns {boolean}
* @static
*/
function isString (input) {
return typeof input === 'string'
}
/**
* Returns true if the input value is a boolean
* @param {*} - the input to test
* @returns {boolean}
* @static
*/
function isBoolean (input) {
return typeof input === 'boolean'
}
/**
* Returns true if the input value is a function
* @param {*} - the input to test
* @returns {boolean}
* @static
*/
function isFunction (input) {
return typeof input === 'function'
}
/**
* Returns true if the input value is an es2015 `class`.
* @param {*} - the input to test
* @returns {boolean}
* @static
*/
function isClass (input) {
if (isFunction(input)) {
return /^class /.test(Function.prototype.toString.call(input))
} else {
return false
}
}
/**
* Returns true if the input is a string, number, symbol, boolean, null or undefined value.
* @param {*} - the input to test
* @returns {boolean}
* @static
*/
function isPrimitive (input) {
if (input === null) return true
switch (typeof input) {
case "string":
case "number":
case "symbol":
case "undefined":
case "boolean":
return true
default:
return false
}
}
/**
* Returns true if the input is a Promise.
* @param {*} - the input to test
* @returns {boolean}
* @static
*/
function isPromise (input) {
if (input) {
var isPromise = isDefined(Promise) && input instanceof Promise
var isThenable = input.then && typeof input.then === 'function'
return isPromise || isThenable ? true : false
} else {
return false
}
}
/**
* Returns true if the input is an iterable (`Map`, `Set`, `Array` etc.).
* @param {*} - the input to test
* @returns {boolean}
* @static
*/
function isIterable (input) {
if (input === null || !isDefined(input)) {
return false
} else {
return typeof input[Symbol.iterator] === 'function'
}
}

79
node_modules/typical/package.json generated vendored Normal file
View File

@ -0,0 +1,79 @@
{
"_from": "typical@^2.6.1",
"_id": "typical@2.6.1",
"_inBundle": false,
"_integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=",
"_location": "/typical",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "typical@^2.6.1",
"name": "typical",
"escapedName": "typical",
"rawSpec": "^2.6.1",
"saveSpec": null,
"fetchSpec": "^2.6.1"
},
"_requiredBy": [
"/array-back",
"/command-line-args",
"/find-replace/array-back",
"/test-value",
"/test-value/array-back"
],
"_resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz",
"_shasum": "5c080e5d661cbbe38259d2e70a3c7253e873881d",
"_spec": "typical@^2.6.1",
"_where": "/home/wn/workspace-node/homepage/node_modules/command-line-args",
"author": {
"name": "Lloyd Brookes",
"email": "75pound@gmail.com"
},
"bugs": {
"url": "https://github.com/75lb/typical/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Robust Javascript type-checking",
"devDependencies": {
"core-assert": "^0.2.1",
"feature-detect-es6": "^1.3.1",
"jsdoc-to-markdown": "^3.0.0",
"test-runner": "^0.3.0"
},
"homepage": "https://github.com/75lb/typical#readme",
"keywords": [
"type",
"checking",
"check",
"value",
"valid",
"is",
"number",
"object",
"plainobject",
"array",
"like",
"defined",
"string",
"boolean",
"function",
"promise",
"iterable",
"class",
"primitive"
],
"license": "MIT",
"main": "./lib/typical.js",
"name": "typical",
"repository": {
"type": "git",
"url": "git+https://github.com/75lb/typical.git"
},
"scripts": {
"docs": "jsdoc2md -t jsdoc2md/README.hbs lib/*.js > README.md; echo",
"test": "test-runner test/*.js"
},
"version": "2.6.1"
}

155
node_modules/typical/test/test.js generated vendored Normal file
View File

@ -0,0 +1,155 @@
'use strict'
var TestRunner = require('test-runner')
var type = require('../')
var detect = require('feature-detect-es6')
var runner = new TestRunner()
var a = require('core-assert')
function evaluates (statement) {
try {
eval(statement)
return true
} catch (err) {
return false
}
}
runner.test('.isNumber(value)', function () {
a.strictEqual(type.isNumber(0), true)
a.strictEqual(type.isNumber(1), true)
a.strictEqual(type.isNumber(1.1), true)
a.strictEqual(type.isNumber(0xff), true)
a.strictEqual(type.isNumber(6.2e5), true)
a.strictEqual(type.isNumber(NaN), false)
a.strictEqual(type.isNumber(Infinity), false)
})
runner.test('.isPlainObject(value)', function () {
a.strictEqual(type.isPlainObject({ clive: 'hater' }), true, '{} is true')
a.strictEqual(type.isPlainObject(new Date()), false, 'new Date() is false')
a.strictEqual(type.isPlainObject([ 0, 1 ]), false, 'Array is false')
a.strictEqual(type.isPlainObject(/test/), false, 'RegExp is false')
a.strictEqual(type.isPlainObject(1), false, '1 is false')
a.strictEqual(type.isPlainObject('one'), false, "'one' is false")
a.strictEqual(type.isPlainObject(null), false, 'null is false')
})
runner.test('.isDefined(value)', function () {
a.strictEqual(type.isDefined({}), true)
a.strictEqual(type.isDefined({}.one), false)
a.strictEqual(type.isDefined(0), true)
a.strictEqual(type.isDefined(null), true)
a.strictEqual(type.isDefined(undefined), false)
})
runner.test('.isString(value)', function () {
a.strictEqual(type.isString(0), false)
a.strictEqual(type.isString('1'), true)
a.strictEqual(type.isString(1.1), false)
a.strictEqual(type.isString(NaN), false)
a.strictEqual(type.isString(Infinity), false)
})
runner.test('.isBoolean(value)', function () {
a.strictEqual(type.isBoolean(true), true)
a.strictEqual(type.isBoolean(false), true)
a.strictEqual(type.isBoolean(0), false)
a.strictEqual(type.isBoolean('1'), false)
a.strictEqual(type.isBoolean(1.1), false)
a.strictEqual(type.isBoolean(NaN), false)
a.strictEqual(type.isBoolean(Infinity), false)
})
runner.test('.isFunction(value)', function () {
a.strictEqual(type.isFunction(true), false)
a.strictEqual(type.isFunction({}), false)
a.strictEqual(type.isFunction(0), false)
a.strictEqual(type.isFunction('1'), false)
a.strictEqual(type.isFunction(1.1), false)
a.strictEqual(type.isFunction(NaN), false)
a.strictEqual(type.isFunction(Infinity), false)
a.strictEqual(type.isFunction(function () {}), true)
a.strictEqual(type.isFunction(Date), true)
})
runner.test('.isPrimitive(value)', function () {
a.strictEqual(type.isPrimitive(true), true)
a.strictEqual(type.isPrimitive({}), false)
a.strictEqual(type.isPrimitive(0), true)
a.strictEqual(type.isPrimitive('1'), true)
a.strictEqual(type.isPrimitive(1.1), true)
a.strictEqual(type.isPrimitive(NaN), true)
a.strictEqual(type.isPrimitive(Infinity), true)
a.strictEqual(type.isPrimitive(function () {}), false)
a.strictEqual(type.isPrimitive(Date), false)
a.strictEqual(type.isPrimitive(null), true)
a.strictEqual(type.isPrimitive(undefined), true)
})
if (detect.symbols() && typeof Symbol() === 'symbol') {
runner.test('.isPrimitive(value) ES6', function () {
a.strictEqual(type.isPrimitive(Symbol()), true)
})
}
runner.test('.isClass(value)', function () {
a.strictEqual(type.isClass(true), false)
a.strictEqual(type.isClass({}), false)
a.strictEqual(type.isClass(0), false)
a.strictEqual(type.isClass('1'), false)
a.strictEqual(type.isClass(1.1), false)
a.strictEqual(type.isClass(NaN), false)
a.strictEqual(type.isClass(Infinity), false)
a.strictEqual(type.isClass(function () {}), false)
a.strictEqual(type.isClass(Date), false)
a.strictEqual(type.isClass(), false)
function broken () { }
broken.toString = function () { throw new Error() }
a.strictEqual(type.isClass(broken), false)
})
if (detect.class()) {
runner.test('.isClass(value) ES6', function () {
var result = eval('type.isClass(class {})')
a.strictEqual(result, true)
})
}
if (detect.promises()) {
runner.test('.isPromise', function () {
a.strictEqual(type.isPromise(Promise.resolve()), true)
a.strictEqual(type.isPromise(Promise), false)
a.strictEqual(type.isPromise(true), false)
a.strictEqual(type.isPromise({}), false)
a.strictEqual(type.isPromise(0), false)
a.strictEqual(type.isPromise('1'), false)
a.strictEqual(type.isPromise(1.1), false)
a.strictEqual(type.isPromise(NaN), false)
a.strictEqual(type.isPromise(Infinity), false)
a.strictEqual(type.isPromise(function () {}), false)
a.strictEqual(type.isPromise(Date), false)
a.strictEqual(type.isPromise(), false)
a.strictEqual(type.isPromise({ then: function () {} }), true)
})
}
if (detect.collections()) {
runner.test('.isIterable', function () {
a.strictEqual(type.isIterable(Promise.resolve()), false)
a.strictEqual(type.isIterable(Promise), false)
a.strictEqual(type.isIterable(true), false)
a.strictEqual(type.isIterable({}), false)
a.strictEqual(type.isIterable(0), false)
a.strictEqual(type.isIterable('1'), true)
a.strictEqual(type.isIterable(1.1), false)
a.strictEqual(type.isIterable(NaN), false)
a.strictEqual(type.isIterable(Infinity), false)
a.strictEqual(type.isIterable(function () {}), false)
a.strictEqual(type.isIterable(Date), false)
a.strictEqual(type.isIterable(), false)
a.strictEqual(type.isIterable(new Map()), true)
a.strictEqual(type.isIterable([]), true)
a.strictEqual(type.isIterable({ then: function () {} }), false)
})
}