UNPKG

1.27 kBJavaScriptView Raw
1"use strict";
2/* --------------------------------------------------------------------------------------------
3 * Copyright (c) Microsoft Corporation. All rights reserved.
4 * Licensed under the MIT License. See License.txt in the project root for license information.
5 * ------------------------------------------------------------------------------------------ */
6Object.defineProperty(exports, "__esModule", { value: true });
7exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
8function boolean(value) {
9 return value === true || value === false;
10}
11exports.boolean = boolean;
12function string(value) {
13 return typeof value === 'string' || value instanceof String;
14}
15exports.string = string;
16function number(value) {
17 return typeof value === 'number' || value instanceof Number;
18}
19exports.number = number;
20function error(value) {
21 return value instanceof Error;
22}
23exports.error = error;
24function func(value) {
25 return typeof value === 'function';
26}
27exports.func = func;
28function array(value) {
29 return Array.isArray(value);
30}
31exports.array = array;
32function stringArray(value) {
33 return array(value) && value.every(elem => string(elem));
34}
35exports.stringArray = stringArray;