massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-json / node_modules / vscode-languageserver-protocol / lib / common / utils / is.js
1 /* --------------------------------------------------------------------------------------------
2  * Copyright (c) Microsoft Corporation. All rights reserved.
3  * Licensed under the MIT License. See License.txt in the project root for license information.
4  * ------------------------------------------------------------------------------------------ */
5 'use strict';
6 Object.defineProperty(exports, "__esModule", { value: true });
7 exports.objectLiteral = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
8 function boolean(value) {
9     return value === true || value === false;
10 }
11 exports.boolean = boolean;
12 function string(value) {
13     return typeof value === 'string' || value instanceof String;
14 }
15 exports.string = string;
16 function number(value) {
17     return typeof value === 'number' || value instanceof Number;
18 }
19 exports.number = number;
20 function error(value) {
21     return value instanceof Error;
22 }
23 exports.error = error;
24 function func(value) {
25     return typeof value === 'function';
26 }
27 exports.func = func;
28 function array(value) {
29     return Array.isArray(value);
30 }
31 exports.array = array;
32 function stringArray(value) {
33     return array(value) && value.every(elem => string(elem));
34 }
35 exports.stringArray = stringArray;
36 function typedArray(value, check) {
37     return Array.isArray(value) && value.every(check);
38 }
39 exports.typedArray = typedArray;
40 function objectLiteral(value) {
41     // Strictly speaking class instances pass this check as well. Since the LSP
42     // doesn't use classes we ignore this for now. If we do we need to add something
43     // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`
44     return value !== null && typeof value === 'object';
45 }
46 exports.objectLiteral = objectLiteral;
47 //# sourceMappingURL=is.js.map