diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..b8f9432
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1 @@
+github: [KivixEletric]
\ No newline at end of file
diff --git a/.github/README.md b/.github/README.md
index 2efec12..c0f1f11 100644
--- a/.github/README.md
+++ b/.github/README.md
@@ -1,7 +1,7 @@
That is
diff --git a/README.md b/README.md
index 731ddcf..e01fe9c 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ npm install @kivixeletric/that-is
To use the library in your project is very simple, see the example below:
-```js
+```js
var is = require('@kivixeletric/that-is')
// Number Type
diff --git a/index.d.ts b/index.d.ts
index 2640756..888021e 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -1,4 +1,4 @@
-declare type TypesList =
+declare type types =
'defined' | 'def' | 'decimal' |
'bigint' | 'infinite' | 'element' |
'elem' | 'Object' | 'Obj' |
@@ -10,11 +10,11 @@ declare type TypesList =
declare module '@kivixeletric/that-is' {
interface Types {
- type(type: TypesList, ...value: unknown[]): boolean
- a(type: TypesList, ...value: unknown[]): boolean
+ type(type: types, ...value: unknown[]): boolean
+ a(type: types, ...value: unknown[]): boolean
- equal(value: unknown, other: unknown): boolean
divisible(value: number, number: number): boolean
+ equal(value: unknown, other: unknown): boolean
defined(...value: unknown[]): boolean
def(...value: unknown[]): boolean
diff --git a/index.js b/index.js
index c6679de..8b6c008 100644
--- a/index.js
+++ b/index.js
@@ -1,16 +1,16 @@
(function (factory) {
- var web = typeof window != 'undefined'
var node = typeof module != 'undefined' && module.exports
+ var web = typeof window != 'undefined'
var data = factory()
- if (web) window.is = data
if (node) module.exports = data
+ if (web) window.is = data
})
(function(){
var is = {}
- function BulkCheck(fn) {
+ function every(fn) {
return function (...values) {
if (values.length == 0) return false;
return values.every(v => fn(v))
@@ -31,61 +31,61 @@
return value === other
}
- is.defined = is.def = BulkCheck(value => {
+ is.defined = is.def = every(value => {
return is.Obj(value) && !!Object.entries(value)[0] || typeof value !== 'undefined'
})
- is.number = is.num = is.int = BulkCheck(value => {
+ is.number = is.num = is.int = every(value => {
return typeof value == 'number'
})
- is.function = is.fn = BulkCheck(value => {
+ is.function = is.fn = every(value => {
return typeof value == 'function'
})
- is.string = is.str = BulkCheck(value => {
+ is.string = is.str = every(value => {
return typeof value == 'string'
})
- is.boolean = is.bool = BulkCheck(value => {
+ is.boolean = is.bool = every(value => {
return typeof value == 'boolean'
})
- is.bigint = BulkCheck(value => {
+ is.bigint = every(value => {
return typeof value == 'bigint'
})
- is.symbol = BulkCheck(value => {
+ is.symbol = every(value => {
return typeof value == 'symbol'
})
- is.Object = is.Obj = BulkCheck(value => {
+ is.Object = is.Obj = every(value => {
return typeof value == 'object'
})
- is.object = is.obj = BulkCheck(value => {
- return is.Obj(value) && value.toString().includes('Object')
+ is.object = is.obj = every(value => {
+ return value.toString().includes('Object')
+ })
+
+ is.array = is.arr = every(Array.isArray || (value => {
+ return value.toString().includes('Array')
+ }))
+
+ is.regexp = every(value => {
+ return value.toString().includes('RegExp')
})
- is.element = is.elem = BulkCheck(value => {
+ is.element = is.elem = every(value => {
return !!value?.nodeType
})
- is.decimal = BulkCheck(value => {
+ is.decimal = every(value => {
return is.num(value) && (value % 1) != 0
})
- is.array = is.arr = BulkCheck(Array.isArray || (value => {
- return value.toString().includes('Array')
- }))
-
- is.infinite = BulkCheck(value => {
+ is.infinite = every(value => {
return value === Infinity || value === -Infinity
})
- is.regexp = BulkCheck(value => {
- return value.toString().includes('RegExp')
- })
-
return is
})
\ No newline at end of file
diff --git a/package.json b/package.json
index 3ceb567..20ef40b 100644
--- a/package.json
+++ b/package.json
@@ -1,15 +1,16 @@
{
"name": "@kivixeletric/that-is",
- "version": "1.0.3",
+ "version": "1.0.4",
"main": "./index.js",
- "description": "A library for checking multiple or single value types",
+ "description": "A JavaScript library that checks whether the value is of a specific type",
"author": "KivixEletric",
"license": "MIT",
"keywords": [
- "util",
- "type",
- "test",
- "check"
+ "typescript-support",
+ "javascript",
+ "type-checker",
+ "type-checks",
+ "type-check"
],
"homepage": "https://github.com/KivixEletric/That-is#readme",
"repository": {