2.0.0 • Published 5 years ago

basic-data-handling v2.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

basic-data-handling

This package contains functions that simply check if the passed argument meets a
data type requirement.

To use any one of the functions below...

If using TypeScript, include the function's import statement
(commented below each function).

If using plain JavaScript, turn that 'import' statement into a
'require' statement like so:

import {functionName} from 'basic-data-handling/fileContainingFunction'  

becomes this:

var functionName = require('basic-data-handling/fileContainingFunction').functionName;

Functions that throw Error if arg is not required type (they all return void)

checkTypeOf(arg, expectedType)
// Performs typeof check on arg. If arg is not expectedType, throws Error.
// import {checkTypeOf} from 'basic-data-handling/checkTypeOf'

errorIfNotArray(arg)
// import {errorIfNotArray} from 'basic-data-handling/errorIfNotArray'

errorIfNotBoolean(arg)
// import {errorIfNotBoolean} from 'basic-data-handling/errorIfNotBoolean'

errorIfNotDefined(arg)
// errors if arg is undefined or null.
// import {errorIfNotDefined} from 'basic-data-handling/errorIfNotDefined'

errorIfNotFloat(arg)
// import {errorIfNotFloat} from 'basic-data-handling/errorIfNotFloat'

errorIfNotFunction(arg)
// import {errorIfNotFunction} from 'basic-data-handling/errorIfNotFunction'

errorIfNotInteger(arg)
// import {errorIfNotInteger} from 'basic-data-handling/errorIfNotInteger'

errorIfNotIntegerZeroOrGreater(arg)
// import {errorIfNotIntegerZeroOrGreater} from 'basic-data-handling/errorIfNotIntegerZeroOrGreater'

errorIfNotNumber(arg)
// errors if arg is not finite number.
// import {errorIfNotNumber} from 'basic-data-handling/errorIfNotNumber'

errorIfNotObject(arg)
// errors if arg is string, boolean, number, function, null, or undefined.
// import {errorIfNotObject} from 'basic-data-handling/errorIfNotObject'

errorIfNotPrimitive(arg)
// import {errorIfNotPrimitive} from 'basic-data-handling/errorIfNotPrimitive'

errorIfNotString(arg)
// import {errorIfNotString} from 'basic-data-handling/errorIfNotString'

Functions that return boolean

isArray(arg)
// import {isArray} from 'basic-data-handling/isArray_notArray'

notArray(arg)
// import {notArray} from 'basic-data-handling/isArray_notArray'

isObject(arg)
// Arrays ARE considered objects.
// Does NOT consider null an object.
// Does NOT consider functions objects.
// import {isObject} from 'basic-data-handling/isObject_notObject'

notObject(arg)
// Returns true if arg is string, boolean, number, function, null, or undefined.
// import {notObject} from 'basic-data-handling/isObject_notObject'

isString(arg)
// import {isString} from 'basic-data-handling/isString_notString'

notString(arg)
// import {notString} from 'basic-data-handling/isString_notString'

isFiniteNumber(arg)
// import {isFiniteNumber} from 'basic-data-handling/isFiniteNumber'

notFiniteNumber(arg)
// import {notFiniteNumber} from 'basic-data-handling/isFiniteNumber'

isInteger(arg)
// import {isInteger} from 'basic-data-handling/isInteger_isFloat'

notInteger(arg)
// import {notInteger} from 'basic-data-handling/isInteger_isFloat'

isFloat(arg)
// import {isFloat} from 'basic-data-handling/isInteger_isFloat'

isEmpty(arrayOrString)
// import {isEmpty} from 'basic-data-handling/isEmpty_notEmpty'

notEmpty(arrayOrString)
// import {notEmpty} from 'basic-data-handling/isEmpty_notEmpty'

isDefined(arg)
// returns true if arg is not undefined or null.
// import {isDefined} from 'basic-data-handling/isDefined_notDefined'

notDefined(arg)
// returns true if arg is undefined or null.
// import {notDefined} from 'basic-data-handling/isDefined_notDefined'

Installation

npm i basic-data-handling

2.0.0

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago