mirror of
https://github.com/musix-org/musix-oss
synced 2025-06-17 01:16:00 +00:00
Modules
This commit is contained in:
20
node_modules/is-callable/.editorconfig
generated
vendored
Normal file
20
node_modules/is-callable/.editorconfig
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 150
|
||||
|
||||
[CHANGELOG.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
max_line_length = off
|
||||
|
||||
[Makefile]
|
||||
max_line_length = off
|
11
node_modules/is-callable/.eslintrc
generated
vendored
Normal file
11
node_modules/is-callable/.eslintrc
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"id-length": 0,
|
||||
"max-statements": [2, 12],
|
||||
"max-statements-per-line": [2, { "max": 2 }]
|
||||
}
|
||||
}
|
12
node_modules/is-callable/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/is-callable/.github/FUNDING.yml
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/is-callable
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
14
node_modules/is-callable/.github/main.workflow
generated
vendored
Normal file
14
node_modules/is-callable/.github/main.workflow
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
workflow "Autorebase branch on merge commits" {
|
||||
on = "push"
|
||||
resolves = ["rebase"]
|
||||
}
|
||||
|
||||
workflow "Autorebase PR on merge commits" {
|
||||
on = "pull_request"
|
||||
resolves = ["rebase"]
|
||||
}
|
||||
|
||||
action "rebase" {
|
||||
uses = "ljharb/rebase@latest"
|
||||
secrets = ["GITHUB_TOKEN"]
|
||||
}
|
15
node_modules/is-callable/.github/workflows/rebase.yml
generated
vendored
Normal file
15
node_modules/is-callable/.github/workflows/rebase.yml
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
name: Automatic Rebase
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
_:
|
||||
name: "Automatic Rebase"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: ljharb/rebase@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
47
node_modules/is-callable/.istanbul.yml
generated
vendored
Normal file
47
node_modules/is-callable/.istanbul.yml
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
verbose: false
|
||||
instrumentation:
|
||||
root: .
|
||||
extensions:
|
||||
- .js
|
||||
- .jsx
|
||||
default-excludes: true
|
||||
excludes: []
|
||||
variable: __coverage__
|
||||
compact: true
|
||||
preserve-comments: false
|
||||
complete-copy: false
|
||||
save-baseline: false
|
||||
baseline-file: ./coverage/coverage-baseline.raw.json
|
||||
include-all-sources: false
|
||||
include-pid: false
|
||||
es-modules: false
|
||||
auto-wrap: false
|
||||
reporting:
|
||||
print: summary
|
||||
reports:
|
||||
- html
|
||||
dir: ./coverage
|
||||
summarizer: pkg
|
||||
report-config: {}
|
||||
watermarks:
|
||||
statements: [50, 80]
|
||||
functions: [50, 80]
|
||||
branches: [50, 80]
|
||||
lines: [50, 80]
|
||||
hooks:
|
||||
hook-run-in-context: false
|
||||
post-require-hook: null
|
||||
handle-sigint: false
|
||||
check:
|
||||
global:
|
||||
statements: 100
|
||||
lines: 100
|
||||
branches: 100
|
||||
functions: 100
|
||||
excludes: []
|
||||
each:
|
||||
statements: 100
|
||||
lines: 100
|
||||
branches: 100
|
||||
functions: 100
|
||||
excludes: []
|
12
node_modules/is-callable/.travis.yml
generated
vendored
Normal file
12
node_modules/is-callable/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
version: ~> 1.0
|
||||
language: node_js
|
||||
os:
|
||||
- linux
|
||||
import:
|
||||
- ljharb/travis-ci:node/all.yml
|
||||
- ljharb/travis-ci:node/pretest.yml
|
||||
- ljharb/travis-ci:node/posttest.yml
|
||||
- ljharb/travis-ci:node/coverage.yml
|
||||
matrix:
|
||||
allow_failures:
|
||||
- env: COVERAGE=true
|
67
node_modules/is-callable/CHANGELOG.md
generated
vendored
Normal file
67
node_modules/is-callable/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
1.1.5 / 2019-12-18
|
||||
=================
|
||||
* [meta] remove unused Makefile and associated utilities
|
||||
* [meta] add `funding` field; add FUNDING.yml
|
||||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `semver`, `tape`, `covert`, `rimraf`
|
||||
* [Tests] use shared travis configs
|
||||
* [Tests] use `eccheck` over `editorconfig-tools`
|
||||
* [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops
|
||||
* [Tests] remove `jscs`
|
||||
* [actions] add automatic rebasing / merge commit blocking
|
||||
|
||||
1.1.4 / 2018-07-02
|
||||
=================
|
||||
* [Fix] improve `class` and arrow function detection (#30, #31)
|
||||
* [Tests] on all latest node minors; improve matrix
|
||||
* [Dev Deps] update all dev deps
|
||||
|
||||
1.1.3 / 2016-02-27
|
||||
=================
|
||||
* [Fix] ensure “class “ doesn’t screw up “class” detection
|
||||
* [Tests] up to `node` `v5.7`, `v4.3`
|
||||
* [Dev Deps] update to `eslint` v2, `@ljharb/eslint-config`, `jscs`
|
||||
|
||||
1.1.2 / 2016-01-15
|
||||
=================
|
||||
* [Fix] Make sure comments don’t screw up “class” detection (#4)
|
||||
* [Tests] up to `node` `v5.3`
|
||||
* [Tests] Add `parallelshell`, run both `--es-staging` and stock tests at once
|
||||
* [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`
|
||||
* [Refactor] convert `isNonES6ClassFn` into `isES6ClassFn`
|
||||
|
||||
1.1.1 / 2015-11-30
|
||||
=================
|
||||
* [Fix] do not throw when a non-function has a function in its [[Prototype]] (#2)
|
||||
* [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config`, `jscs`, `nsp`, `semver`
|
||||
* [Tests] up to `node` `v5.1`
|
||||
* [Tests] no longer allow node 0.8 to fail.
|
||||
* [Tests] fix npm upgrades in older nodes
|
||||
|
||||
1.1.0 / 2015-10-02
|
||||
=================
|
||||
* [Fix] Some browsers report TypedArray constructors as `typeof object`
|
||||
* [New] return false for "class" constructors, when possible.
|
||||
* [Tests] up to `io.js` `v3.3`, `node` `v4.1`
|
||||
* [Dev Deps] update `eslint`, `editorconfig-tools`, `nsp`, `tape`, `semver`, `jscs`, `covert`, `make-arrow-function`
|
||||
* [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG
|
||||
|
||||
1.0.4 / 2015-01-30
|
||||
=================
|
||||
* If @@toStringTag is not present, use the old-school Object#toString test.
|
||||
|
||||
1.0.3 / 2015-01-29
|
||||
=================
|
||||
* Add tests to ensure arrow functions are callable.
|
||||
* Refactor to aid optimization of non-try/catch code.
|
||||
|
||||
1.0.2 / 2015-01-29
|
||||
=================
|
||||
* Fix broken package.json
|
||||
|
||||
1.0.1 / 2015-01-29
|
||||
=================
|
||||
* Add early exit for typeof not "function"
|
||||
|
||||
1.0.0 / 2015-01-29
|
||||
=================
|
||||
* Initial release.
|
22
node_modules/is-callable/LICENSE
generated
vendored
Normal file
22
node_modules/is-callable/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Jordan Harband
|
||||
|
||||
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.
|
||||
|
59
node_modules/is-callable/README.md
generated
vendored
Normal file
59
node_modules/is-callable/README.md
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
# is-callable <sup>[![Version Badge][2]][1]</sup>
|
||||
|
||||
[![Build Status][3]][4]
|
||||
[![dependency status][5]][6]
|
||||
[![dev dependency status][7]][8]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][11]][1]
|
||||
|
||||
[![browser support][9]][10]
|
||||
|
||||
Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var isCallable = require('is-callable');
|
||||
var assert = require('assert');
|
||||
|
||||
assert.notOk(isCallable(undefined));
|
||||
assert.notOk(isCallable(null));
|
||||
assert.notOk(isCallable(false));
|
||||
assert.notOk(isCallable(true));
|
||||
assert.notOk(isCallable([]));
|
||||
assert.notOk(isCallable({}));
|
||||
assert.notOk(isCallable(/a/g));
|
||||
assert.notOk(isCallable(new RegExp('a', 'g')));
|
||||
assert.notOk(isCallable(new Date()));
|
||||
assert.notOk(isCallable(42));
|
||||
assert.notOk(isCallable(NaN));
|
||||
assert.notOk(isCallable(Infinity));
|
||||
assert.notOk(isCallable(new Number(42)));
|
||||
assert.notOk(isCallable('foo'));
|
||||
assert.notOk(isCallable(Object('foo')));
|
||||
|
||||
assert.ok(isCallable(function () {}));
|
||||
assert.ok(isCallable(function* () {}));
|
||||
assert.ok(isCallable(x => x * x));
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[1]: https://npmjs.org/package/is-callable
|
||||
[2]: http://versionbadg.es/ljharb/is-callable.svg
|
||||
[3]: https://travis-ci.org/ljharb/is-callable.svg
|
||||
[4]: https://travis-ci.org/ljharb/is-callable
|
||||
[5]: https://david-dm.org/ljharb/is-callable.svg
|
||||
[6]: https://david-dm.org/ljharb/is-callable
|
||||
[7]: https://david-dm.org/ljharb/is-callable/dev-status.svg
|
||||
[8]: https://david-dm.org/ljharb/is-callable#info=devDependencies
|
||||
[9]: https://ci.testling.com/ljharb/is-callable.png
|
||||
[10]: https://ci.testling.com/ljharb/is-callable
|
||||
[11]: https://nodei.co/npm/is-callable.png?downloads=true&stars=true
|
||||
[license-image]: http://img.shields.io/npm/l/is-callable.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: http://img.shields.io/npm/dm/is-callable.svg
|
||||
[downloads-url]: http://npm-stat.com/charts.html?package=is-callable
|
37
node_modules/is-callable/index.js
generated
vendored
Normal file
37
node_modules/is-callable/index.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var fnToStr = Function.prototype.toString;
|
||||
|
||||
var constructorRegex = /^\s*class\b/;
|
||||
var isES6ClassFn = function isES6ClassFunction(value) {
|
||||
try {
|
||||
var fnStr = fnToStr.call(value);
|
||||
return constructorRegex.test(fnStr);
|
||||
} catch (e) {
|
||||
return false; // not a function
|
||||
}
|
||||
};
|
||||
|
||||
var tryFunctionObject = function tryFunctionToStr(value) {
|
||||
try {
|
||||
if (isES6ClassFn(value)) { return false; }
|
||||
fnToStr.call(value);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
var toStr = Object.prototype.toString;
|
||||
var fnClass = '[object Function]';
|
||||
var genClass = '[object GeneratorFunction]';
|
||||
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
|
||||
|
||||
module.exports = function isCallable(value) {
|
||||
if (!value) { return false; }
|
||||
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
||||
if (typeof value === 'function' && !value.prototype) { return true; }
|
||||
if (hasToStringTag) { return tryFunctionObject(value); }
|
||||
if (isES6ClassFn(value)) { return false; }
|
||||
var strClass = toStr.call(value);
|
||||
return strClass === fnClass || strClass === genClass;
|
||||
};
|
121
node_modules/is-callable/package.json
generated
vendored
Normal file
121
node_modules/is-callable/package.json
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
{
|
||||
"_from": "is-callable@^1.1.5",
|
||||
"_id": "is-callable@1.1.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==",
|
||||
"_location": "/is-callable",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "is-callable@^1.1.5",
|
||||
"name": "is-callable",
|
||||
"escapedName": "is-callable",
|
||||
"rawSpec": "^1.1.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/es-abstract",
|
||||
"/es-to-primitive"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz",
|
||||
"_shasum": "f7e46b596890456db74e7f6e976cb3273d06faab",
|
||||
"_spec": "is-callable@^1.1.5",
|
||||
"_where": "C:\\Users\\matia\\Documents\\GitHub\\Musix\\node_modules\\es-abstract",
|
||||
"author": {
|
||||
"name": "Jordan Harband",
|
||||
"email": "ljharb@gmail.com",
|
||||
"url": "http://ljharb.codes"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ljharb/is-callable/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jordan Harband",
|
||||
"email": "ljharb@gmail.com",
|
||||
"url": "http://ljharb.codes"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.",
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^15.0.2",
|
||||
"covert": "^1.1.1",
|
||||
"eclint": "^2.8.1",
|
||||
"eslint": "^6.7.2",
|
||||
"foreach": "^2.0.5",
|
||||
"istanbul": "1.1.0-alpha.1",
|
||||
"istanbul-merge": "^1.1.1",
|
||||
"make-arrow-function": "^1.1.0",
|
||||
"make-generator-function": "^1.1.0",
|
||||
"rimraf": "^2.7.1",
|
||||
"tape": "^4.12.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"homepage": "https://github.com/ljharb/is-callable#readme",
|
||||
"keywords": [
|
||||
"Function",
|
||||
"function",
|
||||
"callable",
|
||||
"generator",
|
||||
"generator function",
|
||||
"arrow",
|
||||
"arrow function",
|
||||
"ES6",
|
||||
"toStringTag",
|
||||
"@@toStringTag"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "is-callable",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/ljharb/is-callable.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "npm run --silent istanbul",
|
||||
"covert": "covert test",
|
||||
"covert:quiet": "covert test --quiet",
|
||||
"istanbul": "npm run --silent istanbul:clean && npm run --silent istanbul:std && npm run --silent istanbul:harmony && npm run --silent istanbul:merge && istanbul check",
|
||||
"istanbul:clean": "rimraf coverage coverage-std coverage-harmony",
|
||||
"istanbul:harmony": "node --harmony ./node_modules/istanbul/lib/cli.js cover test --dir coverage-harmony",
|
||||
"istanbul:merge": "istanbul-merge --out coverage/coverage.raw.json coverage-harmony/coverage.raw.json coverage-std/coverage.raw.json && istanbul report html",
|
||||
"istanbul:std": "istanbul cover test --report html --dir coverage-std",
|
||||
"lint": "eslint .",
|
||||
"posttest": "npx aud",
|
||||
"prelint": "eclint check *",
|
||||
"pretest": "npm run --silent lint",
|
||||
"test": "npm run --silent tests-only",
|
||||
"test:staging": "node --es-staging test",
|
||||
"test:stock": "node test",
|
||||
"tests-only": "npm run --silent test:stock && npm run --silent test:staging"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js",
|
||||
"browsers": [
|
||||
"iexplore/6.0..latest",
|
||||
"firefox/3.0..6.0",
|
||||
"firefox/15.0..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/4.0..10.0",
|
||||
"chrome/20.0..latest",
|
||||
"chrome/canary",
|
||||
"opera/10.0..latest",
|
||||
"opera/next",
|
||||
"safari/4.0..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2"
|
||||
]
|
||||
},
|
||||
"version": "1.1.5"
|
||||
}
|
159
node_modules/is-callable/test/index.js
generated
vendored
Normal file
159
node_modules/is-callable/test/index.js
generated
vendored
Normal file
@ -0,0 +1,159 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint no-magic-numbers: 1 */
|
||||
|
||||
var test = require('tape');
|
||||
var isCallable = require('../');
|
||||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
|
||||
var genFn = require('make-generator-function');
|
||||
var arrowFn = require('make-arrow-function')();
|
||||
var weirdlyCommentedArrowFn;
|
||||
var asyncFn;
|
||||
var asyncArrowFn;
|
||||
try {
|
||||
/* eslint-disable no-new-func */
|
||||
weirdlyCommentedArrowFn = Function('return cl/*/**/=>/**/ass - 1;')();
|
||||
asyncFn = Function('return async function foo() {};')();
|
||||
asyncArrowFn = Function('return async () => {};')();
|
||||
/* eslint-enable no-new-func */
|
||||
} catch (e) { /**/ }
|
||||
var forEach = require('foreach');
|
||||
|
||||
var noop = function () {};
|
||||
var classFake = function classFake() { }; // eslint-disable-line func-name-matching
|
||||
var returnClass = function () { return ' class '; };
|
||||
var return3 = function () { return 3; };
|
||||
/* for coverage */
|
||||
noop();
|
||||
classFake();
|
||||
returnClass();
|
||||
return3();
|
||||
/* end for coverage */
|
||||
|
||||
var invokeFunction = function invokeFunctionString(str) {
|
||||
var result;
|
||||
try {
|
||||
/* eslint-disable no-new-func */
|
||||
var fn = Function(str);
|
||||
/* eslint-enable no-new-func */
|
||||
result = fn();
|
||||
} catch (e) {}
|
||||
return result;
|
||||
};
|
||||
|
||||
var classConstructor = invokeFunction('"use strict"; return class Foo {}');
|
||||
|
||||
var commentedClass = invokeFunction('"use strict"; return class/*kkk*/\n//blah\n Bar\n//blah\n {}');
|
||||
var commentedClassOneLine = invokeFunction('"use strict"; return class/**/A{}');
|
||||
var classAnonymous = invokeFunction('"use strict"; return class{}');
|
||||
var classAnonymousCommentedOneLine = invokeFunction('"use strict"; return class/*/*/{}');
|
||||
|
||||
test('not callables', function (t) {
|
||||
t.test('non-number/string primitives', function (st) {
|
||||
st.notOk(isCallable(), 'undefined is not callable');
|
||||
st.notOk(isCallable(null), 'null is not callable');
|
||||
st.notOk(isCallable(false), 'false is not callable');
|
||||
st.notOk(isCallable(true), 'true is not callable');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.notOk(isCallable([]), 'array is not callable');
|
||||
t.notOk(isCallable({}), 'object is not callable');
|
||||
t.notOk(isCallable(/a/g), 'regex literal is not callable');
|
||||
t.notOk(isCallable(new RegExp('a', 'g')), 'regex object is not callable');
|
||||
t.notOk(isCallable(new Date()), 'new Date() is not callable');
|
||||
|
||||
t.test('numbers', function (st) {
|
||||
st.notOk(isCallable(42), 'number is not callable');
|
||||
st.notOk(isCallable(Object(42)), 'number object is not callable');
|
||||
st.notOk(isCallable(NaN), 'NaN is not callable');
|
||||
st.notOk(isCallable(Infinity), 'Infinity is not callable');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('strings', function (st) {
|
||||
st.notOk(isCallable('foo'), 'string primitive is not callable');
|
||||
st.notOk(isCallable(Object('foo')), 'string object is not callable');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('non-function with function in its [[Prototype]] chain', function (st) {
|
||||
var Foo = function Bar() {};
|
||||
Foo.prototype = noop;
|
||||
st.equal(true, isCallable(Foo), 'sanity check: Foo is callable');
|
||||
st.equal(false, isCallable(new Foo()), 'instance of Foo is not callable');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('@@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) {
|
||||
var fakeFunction = {
|
||||
toString: function () { return String(return3); },
|
||||
valueOf: return3
|
||||
};
|
||||
fakeFunction[Symbol.toStringTag] = 'Function';
|
||||
t.equal(String(fakeFunction), String(return3));
|
||||
t.equal(Number(fakeFunction), return3());
|
||||
t.notOk(isCallable(fakeFunction), 'fake Function with @@toStringTag "Function" is not callable');
|
||||
t.end();
|
||||
});
|
||||
|
||||
var typedArrayNames = [
|
||||
'Int8Array',
|
||||
'Uint8Array',
|
||||
'Uint8ClampedArray',
|
||||
'Int16Array',
|
||||
'Uint16Array',
|
||||
'Int32Array',
|
||||
'Uint32Array',
|
||||
'Float32Array',
|
||||
'Float64Array'
|
||||
];
|
||||
|
||||
test('Functions', function (t) {
|
||||
t.ok(isCallable(noop), 'function is callable');
|
||||
t.ok(isCallable(classFake), 'function with name containing "class" is callable');
|
||||
t.ok(isCallable(returnClass), 'function with string " class " is callable');
|
||||
t.ok(isCallable(isCallable), 'isCallable is callable');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Typed Arrays', function (st) {
|
||||
forEach(typedArrayNames, function (typedArray) {
|
||||
/* istanbul ignore if : covered in node 0.6 */
|
||||
if (typeof global[typedArray] === 'undefined') {
|
||||
st.comment('# SKIP typed array "' + typedArray + '" not supported');
|
||||
} else {
|
||||
st.ok(isCallable(global[typedArray]), typedArray + ' is callable');
|
||||
}
|
||||
});
|
||||
st.end();
|
||||
});
|
||||
|
||||
test('Generators', { skip: !genFn }, function (t) {
|
||||
t.ok(isCallable(genFn), 'generator function is callable');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Arrow functions', { skip: !arrowFn }, function (t) {
|
||||
t.ok(isCallable(arrowFn), 'arrow function is callable');
|
||||
t.ok(isCallable(weirdlyCommentedArrowFn), 'weirdly commented arrow functions are callable');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('"Class" constructors', { skip: !classConstructor || !commentedClass || !commentedClassOneLine || !classAnonymous }, function (t) {
|
||||
t.notOk(isCallable(classConstructor), 'class constructors are not callable');
|
||||
t.notOk(isCallable(commentedClass), 'class constructors with comments in the signature are not callable');
|
||||
t.notOk(isCallable(commentedClassOneLine), 'one-line class constructors with comments in the signature are not callable');
|
||||
t.notOk(isCallable(classAnonymous), 'anonymous class constructors are not callable');
|
||||
t.notOk(isCallable(classAnonymousCommentedOneLine), 'anonymous one-line class constructors with comments in the signature are not callable');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('`async function`s', { skip: !asyncFn }, function (t) {
|
||||
t.ok(isCallable(asyncFn), '`async function`s are callable');
|
||||
t.ok(isCallable(asyncArrowFn), '`async` arrow functions are callable');
|
||||
t.end();
|
||||
});
|
Reference in New Issue
Block a user