Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

whichtype

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

whichtype - npm Package Compare versions

Comparing version
1.3.0
to
1.4.0
+1
-1
dist/args.d.ts

@@ -0,1 +1,2 @@

export declare function hasAColon(arg: string): boolean;
export declare function isNumeric(x: string): boolean;

@@ -6,5 +7,4 @@ export declare function isArrayIndex(x: string): boolean;

export declare function isNotFlag(arg: string): boolean;
export declare function hasAColon(arg: string): boolean;
export declare function isSingleFlag(x: string): boolean;
export declare function isDoubleFlag(x: string): boolean;
export declare function isTripleFlag(x: string): boolean;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isTripleFlag = exports.isDoubleFlag = exports.isSingleFlag = exports.hasAColon = exports.isNotFlag = exports.isFlag = exports.isObjectKey = exports.isArrayIndex = exports.isNumeric = void 0;
exports.isTripleFlag = exports.isDoubleFlag = exports.isSingleFlag = exports.isNotFlag = exports.isFlag = exports.isObjectKey = exports.isArrayIndex = exports.isNumeric = exports.hasAColon = void 0;
function hasAColon(arg) {
return arg.includes(":");
}
exports.hasAColon = hasAColon;
function isNumeric(x) {

@@ -34,6 +38,2 @@ if (typeof x !== "string") {

exports.isNotFlag = isNotFlag;
function hasAColon(arg) {
return arg.includes(":");
}
exports.hasAColon = hasAColon;
function isSingleFlag(x) {

@@ -40,0 +40,0 @@ if (x.length > 1 && x[0] === "-" && x[1] !== "-" && !isArrayIndex(x.slice(1))) {

export { isArray, isBoolean, isChar, isNumber, isObject, isString, isNull, isUndefined, isPrimitive, isReference, } from "./basictypes";
export { isNotArray, isNotBoolean, isNotChar, isNotNumber, isNotObject, isNotString, isNotNull, isNotUndefined, isNotPrimitive, isNotReference, } from './inverses';
export { isNumeric, isArrayIndex, isObjectKey, isFlag, isNotFlag, hasAColon, isSingleFlag, isDoubleFlag, isTripleFlag, } from './args';
export { hasAColon, isNumeric, isArrayIndex, isObjectKey, isFlag, isNotFlag, isSingleFlag, isDoubleFlag, isTripleFlag, } from './args';
export { isEmptyArray, isArrayOfArrays, isArrayOfBooleans, isArrayOfChars, isArrayOfNumbers, isArrayOfObjects, isArrayOfStrings, } from './array';

@@ -5,0 +5,0 @@ export { isEmptyObject, isObjectOfArrays, isObjectOfBooleans, isObjectOfChars, isObjectOfNumbers, isObjectOfObjects, isObjectOfStrings, } from './object';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isURL = exports.isHttps = exports.isHttp = exports.isUpperCase = exports.isLowerCase = exports.isObjectOfStrings = exports.isObjectOfObjects = exports.isObjectOfNumbers = exports.isObjectOfChars = exports.isObjectOfBooleans = exports.isObjectOfArrays = exports.isEmptyObject = exports.isArrayOfStrings = exports.isArrayOfObjects = exports.isArrayOfNumbers = exports.isArrayOfChars = exports.isArrayOfBooleans = exports.isArrayOfArrays = exports.isEmptyArray = exports.isTripleFlag = exports.isDoubleFlag = exports.isSingleFlag = exports.hasAColon = exports.isNotFlag = exports.isFlag = exports.isObjectKey = exports.isArrayIndex = exports.isNumeric = exports.isNotReference = exports.isNotPrimitive = exports.isNotUndefined = exports.isNotNull = exports.isNotString = exports.isNotObject = exports.isNotNumber = exports.isNotChar = exports.isNotBoolean = exports.isNotArray = exports.isReference = exports.isPrimitive = exports.isUndefined = exports.isNull = exports.isString = exports.isObject = exports.isNumber = exports.isChar = exports.isBoolean = exports.isArray = void 0;
exports.isURL = exports.isHttps = exports.isHttp = exports.isUpperCase = exports.isLowerCase = exports.isObjectOfStrings = exports.isObjectOfObjects = exports.isObjectOfNumbers = exports.isObjectOfChars = exports.isObjectOfBooleans = exports.isObjectOfArrays = exports.isEmptyObject = exports.isArrayOfStrings = exports.isArrayOfObjects = exports.isArrayOfNumbers = exports.isArrayOfChars = exports.isArrayOfBooleans = exports.isArrayOfArrays = exports.isEmptyArray = exports.isTripleFlag = exports.isDoubleFlag = exports.isSingleFlag = exports.isNotFlag = exports.isFlag = exports.isObjectKey = exports.isArrayIndex = exports.isNumeric = exports.hasAColon = exports.isNotReference = exports.isNotPrimitive = exports.isNotUndefined = exports.isNotNull = exports.isNotString = exports.isNotObject = exports.isNotNumber = exports.isNotChar = exports.isNotBoolean = exports.isNotArray = exports.isReference = exports.isPrimitive = exports.isUndefined = exports.isNull = exports.isString = exports.isObject = exports.isNumber = exports.isChar = exports.isBoolean = exports.isArray = void 0;
var basictypes_1 = require("./basictypes");

@@ -27,2 +27,3 @@ Object.defineProperty(exports, "isArray", { enumerable: true, get: function () { return basictypes_1.isArray; } });

var args_1 = require("./args");
Object.defineProperty(exports, "hasAColon", { enumerable: true, get: function () { return args_1.hasAColon; } });
Object.defineProperty(exports, "isNumeric", { enumerable: true, get: function () { return args_1.isNumeric; } });

@@ -33,3 +34,2 @@ Object.defineProperty(exports, "isArrayIndex", { enumerable: true, get: function () { return args_1.isArrayIndex; } });

Object.defineProperty(exports, "isNotFlag", { enumerable: true, get: function () { return args_1.isNotFlag; } });
Object.defineProperty(exports, "hasAColon", { enumerable: true, get: function () { return args_1.hasAColon; } });
Object.defineProperty(exports, "isSingleFlag", { enumerable: true, get: function () { return args_1.isSingleFlag; } });

@@ -36,0 +36,0 @@ Object.defineProperty(exports, "isDoubleFlag", { enumerable: true, get: function () { return args_1.isDoubleFlag; } });

+50
-36
{
"functions": [
{"heading": "Basics"},
{"name": "isArray", "description": "Returns `true` only if the `arg` is an Array."},
{"name": "isBoolean", "description": "Returns `true` only if the `arg` is a Boolean."},
{"name": "isChar", "description": "Returns `true` only if the `arg` is a Char."},
{"name": "isNumber", "description": "Returns `true` only if the `arg` is a Number."},
{"name": "isObject", "description": "Returns `true` only if the `arg` is an Object."},
{"name": "isString", "description": "Returns `true` only if the `arg` is a String."},
{"name": "isArray", "description": "Returns `true` only if `arg` is an Array."},
{"name": "isBoolean", "description": "Returns `true` only if `arg` is a Boolean."},
{"name": "isChar", "description": "Returns `true` only if `arg` is a Char."},
{"name": "isNumber", "description": "Returns `true` only if `arg` is a Number."},
{"name": "isObject", "description": "Returns `true` only if `arg` is an Object."},
{"name": "isString", "description": "Returns `true` only if `arg` is a String."},
{"name": "isNull", "description": "Returns `true` only if the `arg` is null."},
{"name": "isUndefined", "description": "Returns `true` only if the `arg` is undefined."},
{"name": "isNull", "description": "Returns `true` only if `arg` is null."},
{"name": "isUndefined", "description": "Returns `true` only if `arg` is undefined."},
{"name": "isPrimitive", "description": "Returns `true` only if the `arg` is a Primitive value."},
{"name": "isReference", "description": "Returns `true` only if the `arg` is a Reference value."},
{"name": "isPrimitive", "description": "Returns `true` only if `arg` is a Primitive value."},
{"name": "isReference", "description": "Returns `true` only if `arg` is a Reference value."},
{"heading": "Inverses"},
{"name": "isNotArray", "description": "Returns `true` only if the `arg` is not an Array."},
{"name": "isNotBoolean", "description": "Returns `true` only if the `arg` is not a Boolean."},
{"name": "isNotChar", "description": "Returns `true` only if the `arg` is not a Char."},
{"name": "isNotNumber", "description": "Returns `true` only if the `arg` is not a Number."},
{"name": "isNotObject", "description": "Returns `true` only if the `arg` is not an Object."},
{"name": "isNotString", "description": "Returns `true` only if the `arg` is not a String."},
{"name": "isNotArray", "description": "Returns `true` only if `arg` is not an Array."},
{"name": "isNotBoolean", "description": "Returns `true` only if `arg` is not a Boolean."},
{"name": "isNotChar", "description": "Returns `true` only if `arg` is not a Char."},
{"name": "isNotNumber", "description": "Returns `true` only if `arg` is not a Number."},
{"name": "isNotObject", "description": "Returns `true` only if `arg` is not an Object."},
{"name": "isNotString", "description": "Returns `true` only if `arg` is not a String."},
{"name": "isNotNull", "description": "Returns `true` only if the `arg` is not null."},
{"name": "isNotUndefined", "description": "Returns `true` only if the `arg` is not undefined."},
{"name": "isNotNull", "description": "Returns `true` only if `arg` is not null."},
{"name": "isNotUndefined", "description": "Returns `true` only if `arg` is not undefined."},
{"name": "isNotPrimitive", "description": "Returns `true` only if the `arg` is not a Primitive value."},
{"name": "isNotReference", "description": "Returns `true` only if the `arg` is not a Reference value."},
{"name": "isNotPrimitive", "description": "Returns `true` only if `arg` is not a Primitive value."},
{"name": "isNotReference", "description": "Returns `true` only if `arg` is not a Reference value."},
{"heading": "Array Functions"},
{"name": "isEmptyArray", "description": "Returns `true` only if the `arg` is an empty Array."},
{"name": "isArrayOfArrays", "description": "Returns `true` only if the `arg` is an Array of Arrays."},
{"name": "isArrayOfBooleans", "description": "Returns `true` only if the `arg` is an Array of Boolean values."},
{"name": "isArrayOfChars", "description": "Returns `true` only if the `arg` is an Array of Char values."},
{"name": "isArrayOfNumbers", "description": "Returns `true` only if the `arg` is an Array of Numbers."},
{"name": "isArrayOfObjects", "description": "Returns `true` only if the `arg` is an Array of Objects."},
{"name": "isArrayOfStrings", "description": "Returns `true` only if the `arg` is an Array of Strings."},
{"heading": "Arg Functions", "description": "For checking the type of command line arguments."},
{"name": "hasAColon", "description": "Returns `true` only if `arg` contains a `colon`."},
{"name": "isNumeric", "description": "Returns `true` only if `arg` is a numeric string."},
{"name": "isArrayIndex", "description": "Returns `true` only if `arg` is an array index."},
{"name": "isObjectKey", "description": "Returns `true` only if `arg` is an object key."},
{"heading": "Object Functions"},
{"name": "isEmptyObject", "description": "Returns `true` only if the `arg` is an empty Object."},
{"name": "isObjectOfArrays", "description": "Returns `true` only if the `arg` is an Object only containing Array values."},
{"name": "isObjectOfBooleans", "description": "Returns `true` only if the `arg` is an Object only containing Boolean values."},
{"name": "isObjectOfChars", "description": "Returns `true` only if the `arg` is an Object only containing Char values."},
{"name": "isObjectOfNumbers", "description": "Returns `true` only if the `arg` is an Object only containing Number values."},
{"name": "isObjectOfObjects", "description": "Returns `true` only if the `arg` is an Object only containing Object values."},
{"name": "isObjectOfStrings", "description": "Returns `true` only if the `arg` is an Object only containing String values."},
{"name": "isFlag", "description": "Returns `true` only if `arg` is a flag."},
{"name": "isNotFlag", "description": "Returns `true` only if `arg` is NOT a flag."},
{"name": "isSingleFlag", "description": "Returns `true` only if `arg` is a single flag."},
{"name": "isDoubleFlag", "description": "Returns `true` only if `arg` is a double flag."},
{"name": "isTripleFlag", "description": "Returns `true` only if `arg` is a triple flag."},
{"heading": "Array Functions", "description": "For checking the type of Arrays."},
{"name": "isEmptyArray", "description": "Returns `true` only if `arg` is an empty Array."},
{"name": "isArrayOfArrays", "description": "Returns `true` only if `arg` is an Array of Arrays."},
{"name": "isArrayOfBooleans", "description": "Returns `true` only if `arg` is an Array of Boolean values."},
{"name": "isArrayOfChars", "description": "Returns `true` only if `arg` is an Array of Char values."},
{"name": "isArrayOfNumbers", "description": "Returns `true` only if `arg` is an Array of Numbers."},
{"name": "isArrayOfObjects", "description": "Returns `true` only if `arg` is an Array of Objects."},
{"name": "isArrayOfStrings", "description": "Returns `true` only if `arg` is an Array of Strings."},
{"heading": "Object Functions", "description": "For checking the type of Objects"},
{"name": "isEmptyObject", "description": "Returns `true` only if `arg` is an empty Object."},
{"name": "isObjectOfArrays", "description": "Returns `true` only if `arg` is an Object only containing Array values."},
{"name": "isObjectOfBooleans", "description": "Returns `true` only if `arg` is an Object only containing Boolean values."},
{"name": "isObjectOfChars", "description": "Returns `true` only if `arg` is an Object only containing Char values."},
{"name": "isObjectOfNumbers", "description": "Returns `true` only if `arg` is an Object only containing Number values."},
{"name": "isObjectOfObjects", "description": "Returns `true` only if `arg` is an Object only containing Object values."},
{"name": "isObjectOfStrings", "description": "Returns `true` only if `arg` is an Object only containing String values."},
]
}
{
"name": "whichtype",
"version": "1.3.0",
"version": "1.4.0",
"description": "Whichtype is a small JavaScript library for checking the type of your variables.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

+52
-40
# whichtype
[`whichtype`](https://www.npmjs.com/package/whichtype) is a small `JavaScript/TypeScript` library for checking the type of your variables, written in `TypeScript`.
It has no dependencies.
I felt the need for `whichtype` when I was working on [`iaseth/josn`](https://github.com/iaseth/josn).
I felt the need for `whichtype` when I was working on [`josn`](https://github.com/iaseth/josn).

@@ -27,3 +28,3 @@ I am using [`readmix`](https://github.com/iaseth/readmix) for generating this README.

```
Now you can import `whichtype` in your project as follows.
Now, you can import `whichtype` in your project as follows.
```

@@ -38,3 +39,4 @@ const whichtype = require("whichtype");

## Documentation
`Whichtype` export the following functions, each of them accept a single argument and return `true` or `false`.
`whichtype` exports the following functions.
Each of these functions accept a single argument and return `true` or `false`.

@@ -44,39 +46,49 @@ | Function | Description |

| **Basics** | |
| `isArray(arg)` | Returns `true` only if the `arg` is an Array. |
| `isBoolean(arg)` | Returns `true` only if the `arg` is a Boolean. |
| `isChar(arg)` | Returns `true` only if the `arg` is a Char. |
| `isNumber(arg)` | Returns `true` only if the `arg` is a Number. |
| `isObject(arg)` | Returns `true` only if the `arg` is an Object. |
| `isString(arg)` | Returns `true` only if the `arg` is a String. |
| `isNull(arg)` | Returns `true` only if the `arg` is null. |
| `isUndefined(arg)` | Returns `true` only if the `arg` is undefined. |
| `isPrimitive(arg)` | Returns `true` only if the `arg` is a Primitive value. |
| `isReference(arg)` | Returns `true` only if the `arg` is a Reference value. |
| `isArray(arg)` | Returns `true` only if `arg` is an Array. |
| `isBoolean(arg)` | Returns `true` only if `arg` is a Boolean. |
| `isChar(arg)` | Returns `true` only if `arg` is a Char. |
| `isNumber(arg)` | Returns `true` only if `arg` is a Number. |
| `isObject(arg)` | Returns `true` only if `arg` is an Object. |
| `isString(arg)` | Returns `true` only if `arg` is a String. |
| `isNull(arg)` | Returns `true` only if `arg` is null. |
| `isUndefined(arg)` | Returns `true` only if `arg` is undefined. |
| `isPrimitive(arg)` | Returns `true` only if `arg` is a Primitive value. |
| `isReference(arg)` | Returns `true` only if `arg` is a Reference value. |
| **Inverses** | |
| `isNotArray(arg)` | Returns `true` only if the `arg` is not an Array. |
| `isNotBoolean(arg)` | Returns `true` only if the `arg` is not a Boolean. |
| `isNotChar(arg)` | Returns `true` only if the `arg` is not a Char. |
| `isNotNumber(arg)` | Returns `true` only if the `arg` is not a Number. |
| `isNotObject(arg)` | Returns `true` only if the `arg` is not an Object. |
| `isNotString(arg)` | Returns `true` only if the `arg` is not a String. |
| `isNotNull(arg)` | Returns `true` only if the `arg` is not null. |
| `isNotUndefined(arg)` | Returns `true` only if the `arg` is not undefined. |
| `isNotPrimitive(arg)` | Returns `true` only if the `arg` is not a Primitive value. |
| `isNotReference(arg)` | Returns `true` only if the `arg` is not a Reference value. |
| **Array Functions** | |
| `isEmptyArray(arg)` | Returns `true` only if the `arg` is an empty Array. |
| `isArrayOfArrays(arg)` | Returns `true` only if the `arg` is an Array of Arrays. |
| `isArrayOfBooleans(arg)` | Returns `true` only if the `arg` is an Array of Boolean values. |
| `isArrayOfChars(arg)` | Returns `true` only if the `arg` is an Array of Char values. |
| `isArrayOfNumbers(arg)` | Returns `true` only if the `arg` is an Array of Numbers. |
| `isArrayOfObjects(arg)` | Returns `true` only if the `arg` is an Array of Objects. |
| `isArrayOfStrings(arg)` | Returns `true` only if the `arg` is an Array of Strings. |
| **Object Functions** | |
| `isEmptyObject(arg)` | Returns `true` only if the `arg` is an empty Object. |
| `isObjectOfArrays(arg)` | Returns `true` only if the `arg` is an Object only containing Array values. |
| `isObjectOfBooleans(arg)` | Returns `true` only if the `arg` is an Object only containing Boolean values. |
| `isObjectOfChars(arg)` | Returns `true` only if the `arg` is an Object only containing Char values. |
| `isObjectOfNumbers(arg)` | Returns `true` only if the `arg` is an Object only containing Number values. |
| `isObjectOfObjects(arg)` | Returns `true` only if the `arg` is an Object only containing Object values. |
| `isObjectOfStrings(arg)` | Returns `true` only if the `arg` is an Object only containing String values. |
| `isNotArray(arg)` | Returns `true` only if `arg` is not an Array. |
| `isNotBoolean(arg)` | Returns `true` only if `arg` is not a Boolean. |
| `isNotChar(arg)` | Returns `true` only if `arg` is not a Char. |
| `isNotNumber(arg)` | Returns `true` only if `arg` is not a Number. |
| `isNotObject(arg)` | Returns `true` only if `arg` is not an Object. |
| `isNotString(arg)` | Returns `true` only if `arg` is not a String. |
| `isNotNull(arg)` | Returns `true` only if `arg` is not null. |
| `isNotUndefined(arg)` | Returns `true` only if `arg` is not undefined. |
| `isNotPrimitive(arg)` | Returns `true` only if `arg` is not a Primitive value. |
| `isNotReference(arg)` | Returns `true` only if `arg` is not a Reference value. |
| **Arg Functions** | For checking the type of command line arguments. |
| `hasAColon(arg)` | Returns `true` only if `arg` contains a `colon`. |
| `isNumeric(arg)` | Returns `true` only if `arg` is a numeric string. |
| `isArrayIndex(arg)` | Returns `true` only if `arg` is an array index. |
| `isObjectKey(arg)` | Returns `true` only if `arg` is an object key. |
| `isFlag(arg)` | Returns `true` only if `arg` is a flag. |
| `isNotFlag(arg)` | Returns `true` only if `arg` is NOT a flag. |
| `isSingleFlag(arg)` | Returns `true` only if `arg` is a single flag. |
| `isDoubleFlag(arg)` | Returns `true` only if `arg` is a double flag. |
| `isTripleFlag(arg)` | Returns `true` only if `arg` is a triple flag. |
| **Array Functions** | For checking the type of Arrays. |
| `isEmptyArray(arg)` | Returns `true` only if `arg` is an empty Array. |
| `isArrayOfArrays(arg)` | Returns `true` only if `arg` is an Array of Arrays. |
| `isArrayOfBooleans(arg)` | Returns `true` only if `arg` is an Array of Boolean values. |
| `isArrayOfChars(arg)` | Returns `true` only if `arg` is an Array of Char values. |
| `isArrayOfNumbers(arg)` | Returns `true` only if `arg` is an Array of Numbers. |
| `isArrayOfObjects(arg)` | Returns `true` only if `arg` is an Array of Objects. |
| `isArrayOfStrings(arg)` | Returns `true` only if `arg` is an Array of Strings. |
| **Object Functions** | For checking the type of Objects |
| `isEmptyObject(arg)` | Returns `true` only if `arg` is an empty Object. |
| `isObjectOfArrays(arg)` | Returns `true` only if `arg` is an Object only containing Array values. |
| `isObjectOfBooleans(arg)` | Returns `true` only if `arg` is an Object only containing Boolean values. |
| `isObjectOfChars(arg)` | Returns `true` only if `arg` is an Object only containing Char values. |
| `isObjectOfNumbers(arg)` | Returns `true` only if `arg` is an Object only containing Number values. |
| `isObjectOfObjects(arg)` | Returns `true` only if `arg` is an Object only containing Object values. |
| `isObjectOfStrings(arg)` | Returns `true` only if `arg` is an Object only containing String values. |

@@ -89,3 +101,3 @@

| `Description` | `Whichtype is a small JavaScript library for checking the type of your variables.` |
| `Version` | `1.3.0` |
| `Version` | `1.4.0` |
| `Author` | `iaseth` |

@@ -92,0 +104,0 @@ | `Homepage` | `https://github.com/iaseth/whichtype` |

Sorry, the diff of this file is not supported yet