Skip to main content

@terascope/job-components / index

index

Index

Namespaces

NamespaceDescription
Logger-

Enumerations

EnumerationDescription
DataEncodingAvailable data encoding types for a DataEntity
RecoveryCleanupType-
StringEntropy-

Classes

ClassDescription
BigLRUMap-
BigMapAvoid v8 maximum size for Map by spreading the cache across multiple Maps. This class has the same API as Map but minus more differences in ->set and ->forEach
BigSetAvoid v8 maximum size for Set by spreading the cache across multiple Sets. This class has the same API as Set but minus more differences in ->add and ->forEach
CollectorAn in-memory record collector, useful for batch data to a certain size or after a certain amount of time has passed.
DataEntityA wrapper for data that can hold additional metadata properties. A DataEntity should be essentially transparent to use within operations.
EventLoopA simple class for detecting when the event loop is blocked. The recommend use is to call EventLoop.init(logger) and then await EventLoop.wait() where you want to slow down potentially long running synchronous code
FlexibleArrayThis used to ignore the init size of the array in LRUMap. Doing this will avoid running out of memory at 12 million records.
Logger-
QueueA basic FIFO queue
TSErrorA custom Error class with additional properties, like statusCode and fatalError

Interfaces

InterfaceDescription
APIConfigAPIConfig is the configuration for loading APIs and Observers into a ExecutionContext.
AnyObjectA simple object with any values
ConnectionConfig-
DataEntityMetadataDataEntities have conventional metadata properties that can track source, destination and other process information.
ElasticsearchError-
EmptyObject-
EncodingConfigan encoding focused interfaces
ExecutionConfig-
InNumberRangeArg-
JobConfig-
JobConfigParams-
ListOfRecursiveArraysOrValuesA simple definitions of array
ManyA simple definitions of array
OpConfigOpConfig is the configuration that user specifies for a Operation. The only required property is _op since that is used to find the operation.
PRetryConfig-
RecursiveArrayA simple definitions of array
RouteSenderAPIUsed for sending data to particular index/topic/file/table in a storage system. This is used by the routed sender in the standard-assets
SliceA trackable set of work to be preformed by a "Worker"
SliceAnalyticsData-
SliceRequestThe metadata created by the Slicer and ran through a job pipeline
SysConfig-
TSErrorConfig-
TSErrorContextA simple object with any values
TerafoundationConfig-
TerasliceConfig-
ValidatedJobConfig-

References

APIConstructor

Re-exports APIConstructor


APICore

Renames and re-exports default


APICoreConstructor

Re-exports APICoreConstructor


APIFactory

Renames and re-exports default


APIFactoryRegistry

Re-exports APIFactoryRegistry


APIModule

Re-exports APIModule


ASSET_KEYWORD

Re-exports ASSET_KEYWORD


AssetBundleType

Re-exports AssetBundleType


AssetRepository

Re-exports AssetRepository


AssetRepositoryKey

Re-exports AssetRepositoryKey


AssetsAPI

Re-exports AssetsAPI


BatchProcessor

Renames and re-exports default


BundledAPIOperation

Re-exports BundledAPIOperation


BundledObserverOperation

Re-exports BundledObserverOperation


BundledProcessorOperation

Re-exports BundledProcessorOperation


BundledReaderOperation

Re-exports BundledReaderOperation


CachedClients

Re-exports CachedClients


CollectProcessor

Renames and re-exports default


Context

Re-exports Context


ConvictSchema

Renames and re-exports default


CoreOperation

Re-exports CoreOperation


CrossValidationFn

Re-exports CrossValidationFn


DelayProcessor

Renames and re-exports default


EachProcessor

Renames and re-exports default


EventHandlers

Re-exports EventHandlers


ExecutionContext

Re-exports ExecutionContext


ExecutionContextAPI

Re-exports ExecutionContextAPI


ExecutionContextAPIs

Re-exports ExecutionContextAPIs


ExecutionContextConfig

Re-exports ExecutionContextConfig


ExecutionStats

Re-exports ExecutionStats


Fetcher

Renames and re-exports default


FetcherConstructor

Re-exports FetcherConstructor


FetcherCore

Renames and re-exports default


FilterProcessor

Renames and re-exports default


FindOperationResults

Re-exports FindOperationResults


GetClientConfig

Re-exports GetClientConfig


JobAPIInstance

Re-exports JobAPIInstance


JobAPIInstances

Re-exports JobAPIInstances


JobObserver

Renames and re-exports default


JobRunnerAPI

Re-exports JobRunnerAPI


JobValidator

Re-exports JobValidator


LoaderOptions

Re-exports LoaderOptions


MapProcessor

Renames and re-exports default


MetadataFns

Re-exports MetadataFns


MockPromMetrics

Re-exports MockPromMetrics


NoopProcessor

Renames and re-exports default


Observer

Renames and re-exports default


ObserverConstructor

Re-exports ObserverConstructor


OpAPI

Re-exports OpAPI


OpAPIFn

Re-exports OpAPIFn


OpAPIInstance

Re-exports OpAPIInstance


OpRunnerAPI

Re-exports OpRunnerAPI


OpTypeToRepositoryKey

Re-exports OpTypeToRepositoryKey


OperationAPI

Renames and re-exports default


OperationAPIConstructor

Re-exports OperationAPIConstructor


OperationAPIType

Re-exports OperationAPIType


OperationCore

Renames and re-exports default


OperationCoreConstructor

Re-exports OperationCoreConstructor


OperationLifeCycle

Re-exports OperationLifeCycle


OperationLoader

Re-exports OperationLoader


OperationLocationType

Re-exports OperationLocationType


OperationModule

Re-exports OperationModule


OperationResults

Re-exports OperationResults


OperationTypeName

Re-exports OperationTypeName


ParallelSlicer

Renames and re-exports default


ParallelSlicerConstructor

Re-exports ParallelSlicerConstructor


ProcessorConstructor

Re-exports ProcessorConstructor


ProcessorCore

Renames and re-exports default


ProcessorFn

Re-exports ProcessorFn


ProcessorModule

Re-exports ProcessorModule


ReaderFn

Re-exports ReaderFn


ReaderModule

Re-exports ReaderModule


RepositoryOperation

Re-exports RepositoryOperation


RunSliceResult

Re-exports RunSliceResult


SchemaConstructor

Re-exports SchemaConstructor


SchemaCore

Renames and re-exports default


SchemaModule

Re-exports SchemaModule


SelfValidationFn

Re-exports SelfValidationFn


SingleSlicerConstructor

Re-exports SingleSlicerConstructor


SliceResult

Re-exports SliceResult


SliceStatus

Re-exports SliceStatus


Slicer

Renames and re-exports default


SlicerConstructor

Re-exports SlicerConstructor


SlicerCore

Renames and re-exports default


SlicerCoreConstructor

Re-exports SlicerCoreConstructor


SlicerExecutionContext

Re-exports SlicerExecutionContext


SlicerFn

Re-exports SlicerFn


SlicerFns

Re-exports SlicerFns


SlicerOperationLifeCycle

Re-exports SlicerOperationLifeCycle


SlicerOperations

Re-exports SlicerOperations


SlicerRecoveryData

Re-exports SlicerRecoveryData


SlicerResult

Re-exports SlicerResult


TestClientConfig

Re-exports TestClientConfig


TestClients

Re-exports TestClients


TestClientsByEndpoint

Re-exports TestClientsByEndpoint


TestContext

Re-exports TestContext


TestContextAPIs

Re-exports TestContextAPIs


TestContextApis

Re-exports TestContextApis


TestContextOptions

Re-exports TestContextOptions


TestContextType

Re-exports TestContextType


TestReaderFetcher

Renames and re-exports default


TestReaderSlicer

Renames and re-exports default


ValidLoaderOptions

Re-exports ValidLoaderOptions


WorkerExecutionContext

Re-exports WorkerExecutionContext


WorkerOperationLifeCycle

Re-exports WorkerOperationLifeCycle


WorkerOperations

Re-exports WorkerOperations


WorkerSliceState

Re-exports WorkerSliceState


WorkerStatus

Re-exports WorkerStatus


addFormats

Re-exports addFormats


apiSchema

Re-exports apiSchema


formats

Re-exports formats


getAssetPath

Re-exports getAssetPath


getClient

Re-exports getClient


getMetric

Re-exports getMetric


getOpConfig

Re-exports getOpConfig


getOperationAPIType

Re-exports getOperationAPIType


isOperationAPI

Re-exports isOperationAPI


isPromAvailable

Re-exports isPromAvailable


isSlicerExecutionContext

Re-exports isSlicerExecutionContext


isWorkerExecutionContext

Re-exports isWorkerExecutionContext


jobSchema

Re-exports jobSchema


makeContextLogger

Re-exports makeContextLogger


makeExContextLogger

Re-exports makeExContextLogger


makeExecutionContext

Re-exports makeExecutionContext


makeJobSchema

Re-exports makeJobSchema


newTestExecutionConfig

Re-exports newTestExecutionConfig


newTestJobConfig

Re-exports newTestJobConfig


newTestSlice

Re-exports newTestSlice


opSchema

Re-exports opSchema


registerApis

Re-exports registerApis


sliceAnalyticsMetrics

Re-exports sliceAnalyticsMetrics


validateAPIConfig

Re-exports validateAPIConfig


validateJobConfig

Re-exports validateJobConfig


validateOpConfig

Re-exports validateOpConfig

Type Aliases

AdjustDateArgs

AdjustDateArgs: object | object

Source

packages/utils/dist/src/dates.d.ts:128


Assignment

Assignment: "assets_service" | "cluster_master" | "node_master" | "execution_controller" | "worker"

Source

packages/types/dist/src/teraslice.d.ts:444


ClusterManagerType

ClusterManagerType: "native" | "kubernetes" | "kubernetesV2"

Source

packages/types/dist/src/teraslice.d.ts:4


CreateClientFactoryFn()

CreateClientFactoryFn: (config, logger, options) => Promise<ConnectorOutput>

Parameters

ParameterType
configRecord<string, any>
loggerLogger
optionsConnectionConfig

Returns

Promise<ConnectorOutput>

Source

packages/types/dist/src/terafoundation.d.ts:58


DataArrayInput

DataArrayInput: DataInput | DataInput[]

Source

packages/utils/dist/src/entities/data-entity.d.ts:154


DataEntityMetadataValue<M>

DataEntityMetadataValue<M>: keyof DataEntityMetadata | keyof M | string | number

Type parameters

Type parameter
M

Source

packages/utils/dist/src/entities/interfaces.d.ts:8


DataInput

DataInput: Record<string, any> | DataEntity

Source

packages/utils/dist/src/entities/data-entity.d.ts:153


DeadLetterAPIFn()

DeadLetterAPIFn: (input, err) => void

A supported DeadLetterAPIFn

Parameters

ParameterType
inputany
errError

Returns

void

Source

packages/types/dist/src/teraslice.d.ts:295


DeadLetterAction

DeadLetterAction: "throw" | "log" | "none" | string

available dead letter queue actions

Source

packages/types/dist/src/teraslice.d.ts:293


Diff<T, U>

Diff<T, U>: T extends U ? never : T

Remove types from T that are assignable to U

Type parameters

Type parameter
T
U

Source

packages/types/dist/src/utility.d.ts:74


EntityMetadataValue<M, K>

EntityMetadataValue<M, K>: K extends keyof DataEntityMetadata ? DataEntityMetadata[K] : K extends keyof M ? M[K] : any

Type parameters

Type parameter
M
K

Source

packages/utils/dist/src/entities/interfaces.d.ts:9


Filter<T, U>

Filter<T, U>: T extends U ? T : never

Remove types from T that are NOT assignable to U

Type parameters

Type parameter
T
U

Source

packages/types/dist/src/utility.d.ts:78


FilteredResult<T, I, E>

FilteredResult<T, I, E>: { [P in keyof T]: P extends I ? T[P] : P extends E ? never : T[P] }

Filters the keys of an object (T), by list of included keys (I) and excluded (E)

Type parameters

Type parameter
T
I extends keyof T
E extends keyof T

Source

packages/types/dist/src/utility.d.ts:86


LifeCycle

LifeCycle: "once" | "persistent"

Source

packages/types/dist/src/teraslice.d.ts:178


Nil

Nil: null | undefined

Source

packages/types/dist/src/utility.d.ts:43


Omit<T, K>

Omit<T, K>: Pick<T, Exclude<keyof T, K>>

Omit the properties available to type. Useful for excluding properties from a type

Example

`Omit<{ a: number, b: number, c: number }, 'b'|'c'> // => { a: 1 }`

Type parameters

Type parameter
T
K extends keyof T

Source

packages/types/dist/src/utility.d.ts:7


Optional<T, K>

Optional<T, K>: { [P in keyof T]: P extends K ? NonNullable<T[P]> | undefined : NonNullable<T[P]> }

Like Partial but makes certain properties optional

Example

`Optional<{ a: number, b: number }, 'b'>`

Type parameters

Type parameter
T
K extends keyof T

Source

packages/types/dist/src/utility.d.ts:40


Override<T1, T2>

Override<T1, T2>: { [P in keyof T1]: P extends keyof T1 ? T2[P] : T1[P] }

Override specific properties on a type

Example

`Override<{ a: number, b: number }, { b: string }>`

Type parameters

Type parameter
T1
T2 extends { [P in keyof T2]: P extends keyof T1 ? T2[P] : never }

Source

packages/types/dist/src/utility.d.ts:22


Overwrite<T1, T2>

Overwrite<T1, T2>: { [P in Exclude<keyof T1, keyof T2>]: T1[P] } & T2

Overwrite a simple type with different properties. Useful changing and adding additional properties

Example

`Overwrite<{ a: number, b: number }, { b?: number }>`

Type parameters

Type parameter
T1
T2

Source

packages/types/dist/src/utility.d.ts:14


PWhileOptions

PWhileOptions: object

Type declaration

enabledJitter?

optional enabledJitter: boolean

enable jitter to stagger requests

error?

optional error: string

error that can be expressed if the timer ends because the function does not return true

maxJitter?

optional maxJitter: number

the maximum the jitter wait time will be (in milliseconds), defaults to 3x the minJitter setting, but less than timeoutMs

minJitter?

optional minJitter: number

the minimum the jitter wait time will be (in milliseconds), defaults to 100ms

name?

optional name: string

Defaults

to "Request"

timeoutMs?

optional timeoutMs: number

Defaults

to -1 which is never

Source

packages/utils/dist/src/promises.d.ts:54


PartialDeep<T>

PartialDeep<T>: { [P in keyof T]?: PartialDeep<T[P]> }

A deep partial object

Type parameters

Type parameter
T

Source

packages/types/dist/src/utility.d.ts:68


Required<T, K>

Required<T, K>: { [P in keyof T]: P extends K ? NonNullable<T[P]> : NonNullable<T[P]> | undefined }

Like Partial but makes certain properties required

Example

`Required<{ a: number, b: number }, 'b'>`

Type parameters

Type parameter
T
K extends keyof T

Source

packages/types/dist/src/utility.d.ts:32


StringEntropyFN()

StringEntropyFN: (input) => number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/strings.d.ts:269


TYPE_ENTITY_METADATA_KEY

TYPE_ENTITY_METADATA_KEY: "___EntityMetadata"

Source

packages/utils/dist/src/entities/interfaces.d.ts:3


TYPE_IS_DATAENTITY_KEY

TYPE_IS_DATAENTITY_KEY: "__isDataEntity"

Source

packages/utils/dist/src/entities/interfaces.d.ts:2


Unpacked<T>

Unpacked<T>: T extends infer U[] ? U : T extends (...args) => infer U ? U : T extends Promise<infer U> ? U : T

From https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-inference-in-conditional-types

Type parameters

Type parameter
T

Source

packages/types/dist/src/utility.d.ts:92


ValueOf<T>

ValueOf<T>: T[keyof T]

Get the types object (the opposite of keyof)

Type parameters

Type parameter
T

Source

packages/types/dist/src/utility.d.ts:82


WithoutNil<T>

WithoutNil<T>: { [P in keyof T]: T[P] extends Nil ? never : T[P] }

Without null or undefined properties

Type parameters

Type parameter
T

Source

packages/types/dist/src/utility.d.ts:49


_DataEntityMetadata<M>

_DataEntityMetadata<M>: M & DataEntityMetadata & AnyObject

Type parameters

Type parameter
M

Source

packages/utils/dist/src/entities/interfaces.d.ts:7


_DataEntityMetadataType

_DataEntityMetadataType: DataEntityMetadata | AnyObject

Source

packages/utils/dist/src/entities/interfaces.d.ts:6

Variables

LOWER_CASE_CHARS

const LOWER_CASE_CHARS: object

Type declaration

a

readonly a: true

b

readonly b: true

c

readonly c: true

d

readonly d: true

e

readonly e: true

f

readonly f: true

g

readonly g: true

h

readonly h: true

i

readonly i: true

j

readonly j: true

k

readonly k: true

l

readonly l: true

m

readonly m: true

n

readonly n: true

o

readonly o: true

p

readonly p: true

q

readonly q: true

r

readonly r: true

s

readonly s: true

t

readonly t: true

u

readonly u: true

v

readonly v: true

w

readonly w: true

x

readonly x: true

y

readonly y: true

z

readonly z: true

Source

packages/utils/dist/src/strings.d.ts:76


MAX_STRING_LENGTH_BEFORE_MD5

const MAX_STRING_LENGTH_BEFORE_MD5: 1024 = 1024

If we have a hash that is a long value we want to ensure that the value doesn't explode the memory since we may be using that value as a key. So when a string exceeds this specified length we can reduce its length to 35 characters by using md5

Source

packages/utils/dist/src/type-coercion.d.ts:26


NUM_CHARS

const NUM_CHARS: object

Type declaration

0

readonly 0: true

1

readonly 1: true

2

readonly 2: true

3

readonly 3: true

4

readonly 4: true

5

readonly 5: true

6

readonly 6: true

7

readonly 7: true

8

readonly 8: true

9

readonly 9: true

Source

packages/utils/dist/src/strings.d.ts:132


STATUS_CODES

const STATUS_CODES: object

Type declaration

100

100: string

101

101: string

102

102: string

103

103: string

200

200: string

201

201: string

202

202: string

203

203: string

204

204: string

205

205: string

206

206: string

207

207: string

208

208: string

226

226: string

300

300: string

301

301: string

302

302: string

303

303: string

304

304: string

305

305: string

307

307: string

308

308: string

400

400: string

401

401: string

402

402: string

403

403: string

404

404: string

405

405: string

406

406: string

407

407: string

408

408: string

409

409: string

410

410: string

411

411: string

412

412: string

413

413: string

414

414: string

415

415: string

416

416: string

417

417: string

418

418: string

421

421: string

422

422: string

423

423: string

424

424: string

425

425: string

426

426: string

428

428: string

429

429: string

431

431: string

451

451: string

500

500: string

501

501: string

502

502: string

503

503: string

504

504: string

505

505: string

506

506: string

507

507: string

508

508: string

509

509: string

510

510: string

511

511: string

Source

packages/utils/dist/src/status-codes.d.ts:1


UPPER_CASE_CHARS

const UPPER_CASE_CHARS: object

Type declaration

A

readonly A: true

B

readonly B: true

C

readonly C: true

D

readonly D: true

E

readonly E: true

F

readonly F: true

G

readonly G: true

H

readonly H: true

I

readonly I: true

J

readonly J: true

K

readonly K: true

L

readonly L: true

M

readonly M: true

N

readonly N: true

O

readonly O: true

P

readonly P: true

Q

readonly Q: true

R

readonly R: true

S

readonly S: true

T

readonly T: true

U

readonly U: true

V

readonly V: true

W

readonly W: true

X

readonly X: true

Y

readonly Y: true

Z

readonly Z: true

Source

packages/utils/dist/src/strings.d.ts:104


WORD_CHARS

const WORD_CHARS: object

Type declaration

0

readonly 0: true

1

readonly 1: true

2

readonly 2: true

3

readonly 3: true

4

readonly 4: true

5

readonly 5: true

6

readonly 6: true

7

readonly 7: true

8

readonly 8: true

9

readonly 9: true

A

readonly A: true

B

readonly B: true

C

readonly C: true

D

readonly D: true

E

readonly E: true

F

readonly F: true

G

readonly G: true

H

readonly H: true

I

readonly I: true

J

readonly J: true

K

readonly K: true

L

readonly L: true

M

readonly M: true

N

readonly N: true

O

readonly O: true

P

readonly P: true

Q

readonly Q: true

R

readonly R: true

S

readonly S: true

T

readonly T: true

U

readonly U: true

V

readonly V: true

W

readonly W: true

X

readonly X: true

Y

readonly Y: true

Z

readonly Z: true

a

readonly a: true

b

readonly b: true

c

readonly c: true

d

readonly d: true

e

readonly e: true

f

readonly f: true

g

readonly g: true

h

readonly h: true

i

readonly i: true

j

readonly j: true

k

readonly k: true

l

readonly l: true

m

readonly m: true

n

readonly n: true

o

readonly o: true

p

readonly p: true

q

readonly q: true

r

readonly r: true

s

readonly s: true

t

readonly t: true

u

readonly u: true

v

readonly v: true

w

readonly w: true

x

readonly x: true

y

readonly y: true

z

readonly z: true

Source

packages/utils/dist/src/strings.d.ts:149


WORD_SEPARATOR_CHARS

const WORD_SEPARATOR_CHARS: object

Type declaration

readonly ** **: true

-

readonly -: true

_

readonly _: true

Source

packages/utils/dist/src/strings.d.ts:144


__ENTITY_METADATA_KEY

const __ENTITY_METADATA_KEY: TYPE_ENTITY_METADATA_KEY

Source

packages/utils/dist/src/entities/interfaces.d.ts:5


__IS_DATAENTITY_KEY

const __IS_DATAENTITY_KEY: TYPE_IS_DATAENTITY_KEY

Source

packages/utils/dist/src/entities/interfaces.d.ts:4


dataEncodings

const dataEncodings: readonly DataEncoding[]

A list of supported encoding formats

Source

packages/utils/dist/src/entities/interfaces.d.ts:52


geoHash

geoHash: object

Type declaration

adjacent()

adjacent: (geoHash, direction) => any

Parameters
ParameterType
geoHashstring
direction"N" | "S" | "E" | "W"
Returns

any

bounds()

bounds: (geoHash) => object

Parameters
ParameterType
geoHashstring
Returns

object

ne

ne: number

sw

sw: number

decode()

decode: (geoHash) => object

Parameters
ParameterType
geoHashstring
Returns

object

lat

lat: number

lon

lon: number

encode()

encode: (lat, lon, precision?) => string

encode latitude/longitude point to geohash of given precision (number of characters in resulting geohash); if precision is not specified, it is inferred from precision of latitude/longitude values.

Parameters
ParameterType
latnumber
lonnumber
precision?number
Returns

string

neighbours()

neighbours: (geoHash) => object

Parameters
ParameterType
geoHashstring
Returns

object

n

n: number

ne

ne: number

nw

nw: number

s

s: number

se

se: number

sw

sw: number

w

w: number

Source

types/latlon-geohash/index.d.ts:34


geoJSONTypes

const geoJSONTypes: string[]

Source

packages/utils/dist/src/geo.d.ts:3


getDurationFunc

const getDurationFunc: object

Type declaration

ISOWeekYears

ISOWeekYears: typeof differenceInISOWeekYears

businessDays

businessDays: typeof differenceInBusinessDays

calendarDays

calendarDays: typeof differenceInCalendarDays

calendarISOWeekYears

calendarISOWeekYears: typeof differenceInCalendarISOWeekYears

calendarMonths

calendarMonths: typeof differenceInCalendarMonths

calendarQuarters

calendarQuarters: typeof differenceInCalendarQuarters

calendarWeeks

calendarWeeks: typeof differenceInCalendarISOWeeks

calendarYears

calendarYears: typeof differenceInCalendarYears

days

days: typeof differenceInDays

hours

hours: typeof differenceInHours

milliseconds

milliseconds: typeof differenceInMilliseconds

minutes

minutes: typeof differenceInMinutes

months

months: typeof differenceInMonths

quarters

quarters: typeof differenceInQuarters

seconds

seconds: typeof differenceInSeconds

weeks

weeks: typeof differenceInWeeks

years

years: typeof differenceInYears

Source

packages/utils/dist/src/dates.d.ts:89


isCI

const isCI: boolean

Source

packages/utils/dist/src/env.d.ts:4


isDev

const isDev: boolean

Source

packages/utils/dist/src/env.d.ts:3


isProd

const isProd: boolean

Source

packages/utils/dist/src/env.d.ts:1


isTest

const isTest: boolean

Source

packages/utils/dist/src/env.d.ts:2


logLevels

const logLevels: object

Type declaration

debug

debug: number

error

error: number

fatal

fatal: number

info

info: number

trace

trace: number

warn

warn: number

Source

packages/utils/dist/src/logger.d.ts:8


timezoneOffset

const timezoneOffset: number

Source

packages/utils/dist/src/dates.d.ts:3

Functions

addToDate()

addToDate(input, args): number

Parameters

ParameterType
inputunknown
argsAdjustDateArgs

Returns

number

Source

packages/utils/dist/src/dates.d.ts:140


addToDateFP()

addToDateFP(args): (input) => number

Parameters

ParameterType
argsAdjustDateArgs

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number

Source

packages/utils/dist/src/dates.d.ts:141


and()

and<T>(...fns): T

Curry one or more functions, where all must returned truthy values

Type parameters

Type parameter
T extends AnyFn

Parameters

ParameterType
...fnsT[]

Returns

T

Source

packages/utils/dist/src/fp.d.ts:9


bigIntToJSON()

bigIntToJSON(int): string | number

Convert a BigInt to either a number or a string

Parameters

ParameterType
intbigint

Returns

string | number

Source

packages/utils/dist/src/numbers.d.ts:19


castArray()

castArray<T>(input): T[]

A simplified implementation of lodash castArray

Type parameters

Type parameter
T

Parameters

ParameterType
inputundefined | null | T | T[] | readonly T[]

Returns

T[]

Source

packages/utils/dist/src/arrays.d.ts:7


chunk()

chunk<T>(dataArray, size): T[][]

Chunk an array into specific sizes

Type parameters

Type parameter
T

Parameters

ParameterType
dataArrayIterable<T>
sizenumber

Returns

T[][]

Source

packages/utils/dist/src/arrays.d.ts:32


chunkIter()

chunkIter<T>(dataArray, size): Iterable<T[]>

Chunk an array into specific size, by using an iterator

Type parameters

Type parameter
T

Parameters

ParameterType
dataArrayIterable<T>
sizenumber

Returns

Iterable<T[]>

Source

packages/utils/dist/src/arrays.d.ts:34


clone()

clone(input): any

Shallow clone an object

Parameters

ParameterType
inputunknown

Returns

any

Source

packages/utils/dist/src/deps.d.ts:16


cloneDeep()

cloneDeep<T>(input): T

Type parameters

Type parameterValue
Tany

Parameters

ParameterType
inputT

Returns

T

Source

packages/utils/dist/src/deps.d.ts:17


coerceToGeoBoundary()

coerceToGeoBoundary(input): GeoBoundary

Convert value to a GeoBoundary data type, a GeoBoundary is two GeoPoints, one representing the top left, the other representing the bottom right

Parameters

ParameterType
inputunknown

Returns

GeoBoundary

Source

packages/utils/dist/src/type-coercion.d.ts:19


coerceToGeoPoint()

coerceToGeoPoint(input): GeoPoint

Convert value to a GeoPoint data type

Parameters

ParameterType
inputunknown

Returns

GeoPoint

Source

packages/utils/dist/src/type-coercion.d.ts:13


coerceToNumberType()

coerceToNumberType(type): (input) => number | bigint

Parameters

ParameterType
typeFieldType

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number | bigint

Source

packages/utils/dist/src/type-coercion.d.ts:9


coerceToType()

coerceToType<T>(fieldConfig, childConfig?): CoerceFN<T>

Will return a function that will coerce the input values to the DataTypeFieldConfig provided. The parameter childConfig is only necessary with Tuple or Object field types

Type parameters

Type parameterValue
Tunknown

Parameters

ParameterType
fieldConfigDataTypeFieldConfig
childConfig?DataTypeFields

Returns

CoerceFN<T>

Source

packages/utils/dist/src/type-coercion.d.ts:8


concat()

concat(arr, arr1)

concat<T>(arr, arr1?): readonly T[]

Concat and unique the items in the array Any non-array value will be converted to an array

Type parameters
Type parameter
T
Parameters
ParameterType
arrT | T[]
arr1?T | T[]
Returns

readonly T[]

Source

packages/utils/dist/src/arrays.d.ts:12

concat(arr, arr1)

concat<T>(arr, arr1?): readonly T[]

Type parameters
Type parameter
T
Parameters
ParameterType
arrreadonly T[]
arr1?readonly T[]
Returns

readonly T[]

Source

packages/utils/dist/src/arrays.d.ts:13

concat(arr, arr1)

concat<T>(arr, arr1?): readonly T[]

Type parameters
Type parameter
T
Parameters
ParameterType
arrreadonly T[]
arr1?T | T[]
Returns

readonly T[]

Source

packages/utils/dist/src/arrays.d.ts:14


configurable()

configurable(value): (target, propertyKey, descriptor) => void

A decorator making changing the changing configurable property

Parameters

ParameterType
valueboolean

Returns

Function

Parameters
ParameterType
targetunknown
propertyKeystring
descriptorPropertyDescriptor
Returns

void

Source

packages/utils/dist/src/decorators.d.ts:4


contains()

contains(input, substring): input is string

Check whether a string includes another string

Parameters

ParameterType
inputunknown
substringstring

Returns

input is string

Source

packages/utils/dist/src/strings.d.ts:246


containsFP()

containsFP(substring): (input) => input is string

A function version of contains

Parameters

ParameterType
substringstring

Returns

Function

Parameters
ParameterType
inputunknown
Returns

input is string

Source

packages/utils/dist/src/strings.d.ts:250


debugLogger()

debugLogger(testName, param?, otherName?): Logger

Parameters

ParameterType
testNamestring
param?DebugParam
otherName?string

Returns

Logger

Source

packages/utils/dist/src/logger.d.ts:16


endsWith()

endsWith(str, val): boolean

A native implementation of lodash endsWith

Parameters

ParameterType
strunknown
valunknown

Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:65


endsWithFP()

endsWithFP(val): (input) => boolean

A function version of startsWith

Parameters

ParameterType
valstring

Returns

Function

Parameters
ParameterType
inputunknown
Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:67


ensureBuffer()

ensureBuffer(input, encoding?): Buffer

Convert an input to a Buffer if possible

Parameters

ParameterType
inputstring | Buffer
encoding?BufferEncoding

Returns

Buffer

Source

packages/utils/dist/src/buffers.d.ts:6


enumerable()

enumerable(enabled?): (target, propertyKey, descriptor) => void

A decorator for making a method enumerable or none-enumerable

Parameters

ParameterType
enabled?boolean

Returns

Function

Parameters
ParameterType
targetunknown
propertyKeystring
descriptorPropertyDescriptor
Returns

void

Source

packages/utils/dist/src/decorators.d.ts:6


escapeString()

escapeString(input): string

Escape characters in string and avoid double escaping

Parameters

ParameterType
inputstring | number

Returns

string

Source

packages/utils/dist/src/deps.d.ts:24


extractMappedIPv4()

extractMappedIPv4(input): string

Parameters

ParameterType
inputunknown

Returns

string

Source

packages/utils/dist/src/ip.d.ts:9


fastAssign()

fastAssign<T, U>(target, source): T & U

Perform a shallow clone of an object to another, in the fastest way possible

Type parameters

Type parameter
T extends object
U extends object

Parameters

ParameterType
targetT
sourceU

Returns

T & U

Source

packages/utils/dist/src/objects.d.ts:29


fastCloneDeep()

fastCloneDeep<T>(input): T

A clone deep using JSON.parse(JSON.stringify(input))

Type parameters

Type parameter
T

Parameters

ParameterType
inputT

Returns

T

Source

packages/utils/dist/src/objects.d.ts:27


filterObject()

filterObject<T, I, E>(data, by?): FilteredResult<T, I, E>

Filters the keys of an object, by list of included key and excluded

Type parameters

Type parameter
T extends object
I extends string | number | symbol
E extends string | number | symbol

Parameters

ParameterType
dataT
by?object
by.excludes?E[]
by.includes?I[]

Returns

FilteredResult<T, I, E>

Source

packages/utils/dist/src/objects.d.ts:43


firstToLower()

firstToLower(str): string

Change first character in string to lower case

Parameters

ParameterType
strstring

Returns

string

Source

packages/utils/dist/src/strings.d.ts:233


firstToUpper()

firstToUpper(str): string

Change first character in string to upper case

Parameters

ParameterType
strstring

Returns

string

Source

packages/utils/dist/src/strings.d.ts:231


flatten()

flatten<T>(val): T[]

A native implementation of lodash flatten

Type parameters

Type parameter
T

Parameters

ParameterType
valMany<T[]>

Returns

T[]

Source

packages/utils/dist/src/arrays.d.ts:4


flattenDeep()

flattenDeep<T>(val): T[]

Type parameters

Type parameter
T

Parameters

ParameterType
valListOfRecursiveArraysOrValues<T>

Returns

T[]

Source

packages/utils/dist/src/arrays.d.ts:5


formatDateValue()

formatDateValue(value, format): string | number

Format the parsed date value

Parameters

ParameterType
valuenumber | Date | DateTuple
formatundefined | string

Returns

string | number

Source

packages/utils/dist/src/dates.d.ts:88


formatRegex()

formatRegex(input, flags?): RegExp

Parameters

ParameterType
inputstring | RegExp
flags?RegexFlag[]

Returns

RegExp

Source

packages/utils/dist/src/regex.d.ts:4


geoContains()

geoContains(firstGeoEntity, secondGeoEntity): boolean

Returns true if the second geometry is completely contained by the first geometry. The interiors of both geometries must intersect and, the interior and boundary of the secondary geometry must not intersect the exterior of the first geometry.

Parameters

ParameterType
firstGeoEntityGeoInput
secondGeoEntityGeoInput

Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:35


geoContainsFP()

geoContainsFP(queryGeoEntity): (input) => boolean

When provided with geoInput that acts as the argument geo-feature, it will return a function that accepts any geoInput and checks to see if the new input contains the argument geo-feature

Parameters

ParameterType
queryGeoEntityGeoInput

Returns

Function

Parameters
ParameterType
inputunknown
Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:40


geoDisjoint()

geoDisjoint(firstGeoEntity, secondGeoEntity): boolean

Returns true if both geo entities have no overlap

Parameters

ParameterType
firstGeoEntityGeoInput
secondGeoEntityGeoInput

Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:59


geoDisjointFP()

geoDisjointFP(queryGeoEntity): (input) => boolean

Parameters

ParameterType
queryGeoEntityGeoInput

Returns

Function

Parameters
ParameterType
inputunknown
Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:57


geoIntersects()

geoIntersects(firstGeoEntity, secondGeoEntity): boolean

Returns true if both geo entities intersect each other, if one of the input geo entity is a point, it will check if the other geo-entity contains the point

Parameters

ParameterType
firstGeoEntityGeoInput
secondGeoEntityGeoInput

Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:55


geoIntersectsFP()

geoIntersectsFP(queryGeoEntity): (input) => boolean

Parameters

ParameterType
queryGeoEntityGeoInput

Returns

Function

Parameters
ParameterType
inputunknown
Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:56


geoPointWithinRange()

geoPointWithinRange(startingPoint, distanceValue, point): boolean

Parameters

ParameterType
startingPointGeoPointInput
distanceValuestring
pointGeoPointInput

Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:23


geoPointWithinRangeFP()

geoPointWithinRangeFP(startingPoint, distanceValue): (input) => boolean

Parameters

ParameterType
startingPointGeoPointInput
distanceValuestring

Returns

Function

Parameters
ParameterType
inputunknown
Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:24


geoPolyHasPoint()

geoPolyHasPoint<G>(polygon): (fieldData) => boolean

Type parameters

Type parameter
G extends Polygon | MultiPolygon

Parameters

ParameterType
polygonG | Feature<G, GeoJsonProperties>

Returns

Function

Parameters
ParameterType
fieldDataunknown
Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:21


geoRelationFP()

geoRelationFP(geoShape, relation): (input) => boolean

Parameters

ParameterType
geoShapeGeoInput
relationGeoShapeRelation

Returns

Function

Parameters
ParameterType
inputunknown
Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:25


geoWithin()

geoWithin(firstGeoEntity, secondGeoEntity): boolean

Returns true if the first geometry is completely within the second geometry. The interiors of both geometries must intersect and, the interior and boundary of the first geometry must not intersect the exterior of the second geometry

Parameters

ParameterType
firstGeoEntityGeoInput
secondGeoEntityGeoInput

Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:46


geoWithinFP()

geoWithinFP(queryGeoEntity): (input) => boolean

When provided with geoInput that acts as the parent geo-feature, it will return a function that accepts any geoInput and checks to see if the new input is within the parent geo-feature

Parameters

ParameterType
queryGeoEntityGeoInput

Returns

Function

Parameters
ParameterType
inputunknown
Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:51


getBackoffDelay()

getBackoffDelay(current, factor?, max?, min?): number

Get backoff delay that will safe to retry and is slightly staggered

Parameters

ParameterType
currentnumber
factor?number
max?number
min?number

Returns

number

Source

packages/utils/dist/src/promises.d.ts:78


getCIDRBroadcast()

getCIDRBroadcast(input): string

Parameters

ParameterType
inputunknown

Returns

string

Source

packages/utils/dist/src/ip.d.ts:63


getCIDRMax()

getCIDRMax(input): string

Parameters

ParameterTypeDescription
inputunknownip address block in CIDR notation

Returns

string

last ip address in the block

Deprecated

use getLastUsableIPInCIDR

Source

packages/utils/dist/src/ip.d.ts:31


getCIDRMin()

getCIDRMin(input): string

Parameters

ParameterTypeDescription
inputunknownip address block in CIDR notation

Returns

string

first IP address in the block

Deprecated

use getFirstUsableIPInCIDR

Source

packages/utils/dist/src/ip.d.ts:24


getCIDRNetwork()

getCIDRNetwork(input): string

Parameters

ParameterType
inputunknown

Returns

string

Source

packages/utils/dist/src/ip.d.ts:64


getDate()

getDate(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/dates.d.ts:175


getErrorStatusCode()

getErrorStatusCode(err, config?, defaultCode?): number

Parameters

ParameterType
errunknown
config?TSErrorConfig
defaultCode?number

Returns

number

Source

packages/utils/dist/src/errors.d.ts:132


getField()

getField(input, field, defaultVal)

getField<V>(input, field, defaultVal?): V

A type safe get function (will always return the correct type)

IMPORTANT This does not behave like lodash.get, it does not deal with dot notation (nested fields) and it will use the default when dealing with OR statements

Type parameters
Type parameter
V
Parameters
ParameterType
inputundefined
fieldstring
defaultVal?V
Returns

V

Source

packages/utils/dist/src/objects.d.ts:54

getField(input, field)

getField<T, P>(input, field): T[P]

Type parameters
Type parameter
T
P extends string | number | symbol
Parameters
ParameterType
inputT
fieldP
Returns

T[P]

Source

packages/utils/dist/src/objects.d.ts:55

getField(input, field)

getField<T, P>(input, field): T[P]

Type parameters
Type parameter
T
P extends string | number | symbol
Parameters
ParameterType
inputundefined | T
fieldP
Returns

T[P]

Source

packages/utils/dist/src/objects.d.ts:56

getField(input, field, defaultVal)

getField<T, P>(input, field, defaultVal): T[P]

Type parameters
Type parameter
T
P extends string | number | symbol
Parameters
ParameterType
inputundefined | T
fieldP
defaultValnever[]
Returns

T[P]

Source

packages/utils/dist/src/objects.d.ts:57

getField(input, field, defaultVal)

getField<T, P, V>(input, field, defaultVal): T[P] | V

Type parameters
Type parameter
T
P extends string | number | symbol
V
Parameters
ParameterType
inputundefined | T
fieldP
defaultValV
Returns

T[P] | V

Source

packages/utils/dist/src/objects.d.ts:58

getField(input, field, defaultVal)

getField<T, P, V>(input, field, defaultVal): T[P]

Type parameters
Type parameter
T
P extends string | number | symbol
V
Parameters
ParameterType
inputundefined | T
fieldP
defaultValV
Returns

T[P]

Source

packages/utils/dist/src/objects.d.ts:59


getFirst()

getFirst<T>(input): T | undefined

If the input is an array it will return the first item else if it will return the input

Type parameters

Type parameter
T

Parameters

ParameterType
inputT | T[] | readonly T[]

Returns

T | undefined

Source

packages/utils/dist/src/arrays.d.ts:41


getFirstChar()

getFirstChar(input): string

Parameters

ParameterType
inputstring

Returns

string

Source

packages/utils/dist/src/strings.d.ts:234


getFirstIPInCIDR()

getFirstIPInCIDR(input): string

Parameters

ParameterTypeDescription
inputunknownip address block in CIDR notation, inclusive

Returns

string

first IP address in the block

Source

packages/utils/dist/src/ip.d.ts:37


getFirstKey()

getFirstKey<T>(input): keyof T | undefined

Get the first key in an object

Type parameters

Type parameter
T extends object

Parameters

ParameterType
inputT

Returns

keyof T | undefined

Source

packages/utils/dist/src/objects.d.ts:15


getFirstUsableIPInCIDR()

getFirstUsableIPInCIDR(input): string

Parameters

ParameterTypeDescription
inputunknownip address block in CIDR notation

Returns

string

first usable ip address of the CIDR block

Source

packages/utils/dist/src/ip.d.ts:49


getFirstValue()

getFirstValue<T>(input): T | undefined

Get the first value in an object

Type parameters

Type parameter
T

Parameters

ParameterType
inputobject

Returns

T | undefined

Source

packages/utils/dist/src/objects.d.ts:9


getFullErrorStack()

getFullErrorStack(err): string

Use following the chain of caused by stack of an error. Don't use this when logging the error, only when sending it

Parameters

ParameterType
errunknown

Returns

string

Source

packages/utils/dist/src/errors.d.ts:88


getHashCodeFrom()

getHashCodeFrom(value): string

Generate a unique hash code from a value, this is not a guarantee but it is close enough for doing groupBys and caching

Parameters

ParameterType
valueunknown

Returns

string

Source

packages/utils/dist/src/type-coercion.d.ts:32


getHours()

getHours(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/dates.d.ts:173


getLast()

getLast<T>(input): T | undefined

If the input is an array it will return the first item else if it will return the input

Type parameters

Type parameter
T

Parameters

ParameterType
inputT | T[] | readonly T[]

Returns

T | undefined

Source

packages/utils/dist/src/arrays.d.ts:46


getLastIPInCIDR()

getLastIPInCIDR(input): string

Parameters

ParameterTypeDescription
inputunknownip address block in CIDR notation

Returns

string

last ip address in the block, inclusive

Source

packages/utils/dist/src/ip.d.ts:43


getLastUsableIPInCIDR()

getLastUsableIPInCIDR(input): string

Parameters

ParameterTypeDescription
inputunknownip address block in CIDR notation

Returns

string

last usable ip address of the CIDR block

Source

packages/utils/dist/src/ip.d.ts:55


getMilliseconds()

getMilliseconds(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/dates.d.ts:168


getMinutes()

getMinutes(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/dates.d.ts:171


getMonth()

getMonth(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/dates.d.ts:177


getSeconds()

getSeconds(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/dates.d.ts:169


getTime()

getTime(val?): number | false

Ensure unix time

Parameters

ParameterType
val?DateInputTypes

Returns

number | false

Source

packages/utils/dist/src/dates.d.ts:36


getTimeBetween()

getTimeBetween(input, args): string | number

Parameters

ParameterType
inputunknown
argsGetTimeBetweenArgs

Returns

string | number

Source

packages/utils/dist/src/dates.d.ts:108


getTimeBetweenFP()

getTimeBetweenFP(args): (input) => string | number

A functional version of getTimeBetween

Parameters

ParameterType
argsGetTimeBetweenArgs

Returns

Function

Parameters
ParameterType
inputunknown
Returns

string | number

Source

packages/utils/dist/src/dates.d.ts:112


getTimezoneOffset()

getTimezoneOffset(input, timezone): number

Given a date and timezone, it will return the offset from UTC in minutes. This is more accurate than timezoneToOffset as it can better account for day lights saving time

Parameters

ParameterType
inputunknown
timezonestring

Returns

number

Source

packages/utils/dist/src/dates.d.ts:155


getTimezoneOffsetFP()

getTimezoneOffsetFP(timezone): (input) => number

Given a timezone, it will return a function that will take in dates that will be converted the offset in minutes. This is more accurate than timezoneToOffset as it can better account for day lights saving time

Parameters

ParameterType
timezonestring

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number

Source

packages/utils/dist/src/dates.d.ts:160


getTypeOf()

getTypeOf(val): string

Determine the type of an input

Parameters

ParameterType
valany

Returns

string

a human friendly string that describes the input

Source

packages/utils/dist/src/deps.d.ts:22


getUTCDate()

getUTCDate(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/dates.d.ts:174


getUTCHours()

getUTCHours(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/dates.d.ts:172


getUTCMinutes()

getUTCMinutes(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/dates.d.ts:170


getUTCMonth()

getUTCMonth(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/dates.d.ts:176


getUTCYear()

getUTCYear(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/dates.d.ts:178


getUnixTime()

getUnixTime(val?): number | false

Parameters

ParameterType
val?DateInputTypes

Returns

number | false

Source

packages/utils/dist/src/dates.d.ts:37


getValidDate()

getValidDate(val, relativeNow?): Date | false

Coerces value into a valid date, returns false if it is invalid. Has added support for converting from date math (i.e. now+1h, now-1m, now+2d/y, 2021-01-01||+2d)

Parameters

ParameterType
valunknown
relativeNow?Date

Returns

Date | false

Source

packages/utils/dist/src/dates.d.ts:14


getValidDateOrNumberOrThrow()

getValidDateOrNumberOrThrow(val): Date | number

Returns a valid date or throws, {@see getValidDate}

Parameters

ParameterType
valunknown

Returns

Date | number

Source

packages/utils/dist/src/dates.d.ts:33


getValidDateOrThrow()

getValidDateOrThrow(val): Date

Returns a valid date or throws, {@see getValidDate}

Parameters

ParameterType
valunknown

Returns

Date

Source

packages/utils/dist/src/dates.d.ts:18


getValidDateWithTimezone()

getValidDateWithTimezone(val, getUTC?): Date | false

Returns a valid date with the timezone applied {@see getValidDate}

Parameters

ParameterType
valunknown
getUTC?boolean

Returns

Date | false

Source

packages/utils/dist/src/dates.d.ts:29


getValidDateWithTimezoneOrThrow()

getValidDateWithTimezoneOrThrow(val, getUTC?): Date

Returns a valid date with the timezone applied or throws{@see getValidDate}

Parameters

ParameterType
valunknown
getUTC?boolean

Returns

Date

Source

packages/utils/dist/src/dates.d.ts:25


getWordParts()

getWordParts(input): string[]

Split a string and get the word parts

Parameters

ParameterType
inputstring

Returns

string[]

Source

packages/utils/dist/src/strings.d.ts:216


getYear()

getYear(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/dates.d.ts:179


hasOwn()

hasOwn(obj, prop): boolean

Check if a object has property (and not included in the prototype) Different from has since it doesn't deal with dot notation values.

Parameters

ParameterType
objany
propstring | number | symbol

Returns

boolean

Source

packages/utils/dist/src/objects.d.ts:64


inGeoBoundingBox()

inGeoBoundingBox(top_left, bottom_right, point): boolean

Parameters

ParameterType
top_leftGeoPointInput
bottom_rightGeoPointInput
pointGeoPointInput

Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:18


inGeoBoundingBoxFP()

inGeoBoundingBoxFP(top_left, bottom_right): (input) => boolean

Parameters

ParameterType
top_leftGeoPointInput
bottom_rightGeoPointInput

Returns

Function

Parameters
ParameterType
inputunknown
Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:19


inIPRange()

inIPRange(input, args): boolean

Parameters

ParameterType
inputunknown
argsobject
args.cidr?string
args.max?string
args.min?string

Returns

boolean

Source

packages/utils/dist/src/ip.d.ts:10


inNumberRange()

inNumberRange(input, args): input is number

Returns true if number is between min or max value provided

Parameters

ParameterType
inputunknown
argsInNumberRangeArg

Returns

input is number

Example

inNumberRange(42, { min: 0, max: 100}); // true
inNumberRange(-42, { min:0 , max: 100 }); // false
inNumberRange(42, { min: 0, max: 42 }); // false
inNumberRange(42, { min: 0, max: 42, inclusive: true }) // true

Source

packages/utils/dist/src/numbers.d.ts:55


inNumberRangeFP()

inNumberRangeFP(args): (input) => input is number

Parameters

ParameterType
argsInNumberRangeArg

Returns

Function

Parameters
ParameterType
inputunknown
Returns

input is number

Source

packages/utils/dist/src/numbers.d.ts:56


includes()

includes(input, key): boolean

Safely check if an array, object, map, set has a key

Parameters

ParameterType
inputunknown
keystring

Returns

boolean

Source

packages/utils/dist/src/arrays.d.ts:36


intToIP()

intToIP(input, ipVersion): string

Parameters

ParameterType
inputunknown
ipVersionstring | number

Returns

string

Source

packages/utils/dist/src/ip.d.ts:68


ipToInt()

ipToInt(input): bigint

Parameters

ParameterType
inputunknown

Returns

bigint

Source

packages/utils/dist/src/ip.d.ts:67


isAfter()

isAfter(input, date): boolean

Parameters

ParameterType
inputunknown
dateDateInputTypes

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:145


isAlpha()

isAlpha(input, locale?): boolean

Parameters

ParameterType
inputunknown
locale?AlphaLocale

Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:256


isAlphaNumeric()

isAlphaNumeric(input, locale?): boolean

Parameters

ParameterType
inputunknown
locale?AlphanumericLocale

Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:257


isArray()

isArray<T>(input): input is T

Check if an input is an array, just Array.isArray

Type parameters

Type parameterValue
Tany[]

Parameters

ParameterType
inputunknown

Returns

input is T

Source

packages/utils/dist/src/arrays.d.ts:50


isArrayLike()

isArrayLike<T>(input): input is T

Check if an input is an TypedArray or Array instance

Type parameters

Type parameterValue
Tany[]

Parameters

ParameterType
inputunknown

Returns

input is T

Source

packages/utils/dist/src/arrays.d.ts:59


isAsyncIterator()

isAsyncIterator<T>(input): input is AsyncIterable<T>

Returns true if the input is an async iterator

Type parameters

Type parameter
T

Parameters

ParameterType
inputunknown

Returns

input is AsyncIterable<T>

Source

packages/utils/dist/src/iterators.d.ts:8


isBase64()

isBase64(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:251


isBefore()

isBefore(input, date): boolean

Parameters

ParameterType
inputunknown
dateDateInputTypes

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:144


isBetween()

isBetween(input, args): boolean

Parameters

ParameterType
inputunknown
argsobject
args.endDateInputTypes
args.startDateInputTypes

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:146


isBigInt()

isBigInt(input): input is bigint

Check if value is a bigint

Parameters

ParameterType
inputunknown

Returns

input is bigint

Source

packages/utils/dist/src/numbers.d.ts:11


isBoolean()

isBoolean(input): input is boolean

Returns true if the input is a boolean

Parameters

ParameterType
inputunknown

Returns

input is boolean

Source

packages/utils/dist/src/booleans.d.ts:27


isBooleanLike()

isBooleanLike(input): boolean

Returns true if the input is like a boolean. Use toBoolean to convert it to one.

Parameters

ParameterType
inputunknown

Returns

boolean

Example

isBooleanLike(); // false
isBooleanLike(null); // true
isBooleanLike(0); // true
isBooleanLike('0'); // true
isBooleanLike('false'); // true
isBooleanLike('no'); // true

Source

packages/utils/dist/src/booleans.d.ts:41


isBuffer()

isBuffer(input): input is Buffer

Check if an input is an nodejs Buffer

Parameters

ParameterType
inputunknown

Returns

input is Buffer

Source

packages/utils/dist/src/buffers.d.ts:10


isCIDR()

isCIDR(input): input is string

Parameters

ParameterType
inputunknown

Returns

input is string

Source

packages/utils/dist/src/ip.d.ts:17


isCountryCode()

isCountryCode(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:253


isDateTuple()

isDateTuple(input): input is DateTuple

Verify if an input is a Date Tuple

Parameters

ParameterType
inputunknown

Returns

input is DateTuple

Source

packages/utils/dist/src/dates.d.ts:66


isDeepEqual()

isDeepEqual(target, input)

isDeepEqual<T>(target, input): input is T

Compares two values and returns a boolean if they are the same. Arrays are compared using original sorting, while object key ordering doesn't matter.

Type parameters
Type parameter
T
Parameters
ParameterType
targetT
inputunknown
Returns

input is T

Example
isDeepEqual({ key1: 1, key2: 2 }, { key2: 2, key1: 1 }) === true;
isDeepEqual(null, null) === true;
isDeepEqual(undefined, undefined) === true;
isDeepEqual(NaN, NaN) === true;
isDeepEqual(3, 3) === true
isDeepEqual('hello', 'hello') === true
isDeepEqual([1, 2, 3], [1, 2, 3]) === true
isDeepEqual([{ some: 'obj' }], [{ some: 'obj' }]) === true

isDeepEqual(undefined, null) === false;
isDeepEqual([1, 2, 3], [1, 3, 2]) === false
isDeepEqual([1, 2, 3], [1, 2, undefined, 3]) === false
isDeepEqual(true, 'true') === false;
Source

packages/utils/dist/src/equality.d.ts:33

isDeepEqual(target, input)

isDeepEqual<T>(target, input): boolean

Type parameters
Type parameter
T
Parameters
ParameterType
targetT
inputunknown
Returns

boolean

Source

packages/utils/dist/src/equality.d.ts:34


isDeepEqualFP()

isDeepEqualFP(target)

isDeepEqualFP<T>(target): (input) => input is T

A functional version of isDeepEqual

Type parameters
Type parameter
T
Parameters
ParameterType
targetT
Returns

Function

Parameters
ParameterType
inputunknown
Returns

input is T

Source

packages/utils/dist/src/equality.d.ts:38

isDeepEqualFP(target)

isDeepEqualFP<T>(target): (input) => boolean

Type parameters
Type parameter
T
Parameters
ParameterType
targetT
Returns

Function

Parameters
ParameterType
inputunknown
Returns

boolean

Source

packages/utils/dist/src/equality.d.ts:39


isElasticsearchError()

isElasticsearchError(err): err is ElasticsearchError

Check is a elasticsearch error

Parameters

ParameterType
errunknown

Returns

err is ElasticsearchError

Source

packages/utils/dist/src/errors.d.ts:106


isEmail()

isEmail(input): input is string

Parameters

ParameterType
inputunknown

Returns

input is string

Source

packages/utils/dist/src/strings.d.ts:235


isEmpty()

isEmpty<T>(val?): val is undefined

Check if an input is empty, similar to lodash.isEmpty

Type parameters

Type parameter
T

Parameters

ParameterType
val?null | T

Returns

val is undefined

Source

packages/utils/dist/src/empty.d.ts:5


isEqual()

isEqual(target, input)

isEqual<T>(target, input): input is T

Verify that two values are the same (uses a reference check). Similar to === except two NaNs is considered the same For deep equality use isDeepEqual

Type parameters
Type parameter
T
Parameters
ParameterType
targetT
inputunknown
Returns

input is T

Source

packages/utils/dist/src/equality.d.ts:6

isEqual(target, input)

isEqual<T>(target, input): boolean

Type parameters
Type parameter
T
Parameters
ParameterType
targetT
inputunknown
Returns

boolean

Source

packages/utils/dist/src/equality.d.ts:7


isEqualFP()

isEqualFP(target)

isEqualFP<T>(target): (input) => input is T

A functional version of isEqual

Type parameters
Type parameter
T
Parameters
ParameterType
targetT
Returns

Function

Parameters
ParameterType
inputunknown
Returns

input is T

Source

packages/utils/dist/src/equality.d.ts:11

isEqualFP(target)

isEqualFP<T>(target): (input) => boolean

Type parameters
Type parameter
T
Parameters
ParameterType
targetT
Returns

Function

Parameters
ParameterType
inputunknown
Returns

boolean

Source

packages/utils/dist/src/equality.d.ts:12


isError()

isError(err): err is Error

Check if an input has an error compatible api

Parameters

ParameterType
errunknown

Returns

err is Error

Source

packages/utils/dist/src/errors.d.ts:102


isExecutedFile()

isExecutedFile(url): boolean

Parameters

ParameterType
urlstring

Returns

boolean

Source

packages/utils/dist/src/env.d.ts:5


isFQDN()

isFQDN(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:252


isFalsy()

isFalsy(input): boolean

Returns true if the value is a falsy like value

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/booleans.d.ts:23


isFatalError()

isFatalError(err): boolean

Parameters

ParameterType
errunknown

Returns

boolean

Source

packages/utils/dist/src/errors.d.ts:99


isFloat()

isFloat(val): val is number

Verify the input is a finite number (and float like)

Parameters

ParameterType
valunknown

Returns

val is number

Source

packages/utils/dist/src/numbers.d.ts:32


isFriday()

isFriday(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:118


isFunction()

isFunction(input): input is Function

Verify an input is a function

Parameters

ParameterType
inputunknown

Returns

input is Function

Source

packages/utils/dist/src/functions.d.ts:17


isFuture()

isFuture(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:122


isGeoJSON()

isGeoJSON(input): input is GeoShape | ESGeoShape

Parameters

ParameterType
inputunknown

Returns

input is GeoShape | ESGeoShape

Source

packages/utils/dist/src/geo.d.ts:4


isGeoPoint()

isGeoPoint(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:16


isGeoShapeMultiPolygon()

isGeoShapeMultiPolygon(input): input is GeoShapeMultiPolygon

Parameters

ParameterType
inputunknown

Returns

input is GeoShapeMultiPolygon

Source

packages/utils/dist/src/geo.d.ts:7


isGeoShapePoint()

isGeoShapePoint(input): input is GeoShapePoint

Parameters

ParameterType
inputunknown

Returns

input is GeoShapePoint

Source

packages/utils/dist/src/geo.d.ts:5


isGeoShapePolygon()

isGeoShapePolygon(input): input is GeoShapePolygon

Parameters

ParameterType
inputunknown

Returns

input is GeoShapePolygon

Source

packages/utils/dist/src/geo.d.ts:6


isGreaterThan()

isGreaterThan(value, other): boolean

Check if a value is greater than another

Parameters

ParameterType
valueunknown
otherunknown

Returns

boolean

Source

packages/utils/dist/src/equality.d.ts:55


isGreaterThanFP()

isGreaterThanFP(other): (value) => boolean

Check if a value is greater than or equal to another

Parameters

ParameterType
otherunknown

Returns

Function

Parameters
ParameterType
valueunknown
Returns

boolean

Source

packages/utils/dist/src/equality.d.ts:59


isGreaterThanOrEqualTo()

isGreaterThanOrEqualTo(value, other): boolean

Check if a value is greater than or equal to another

Parameters

ParameterType
valueunknown
otherunknown

Returns

boolean

Source

packages/utils/dist/src/equality.d.ts:47


isGreaterThanOrEqualToFP()

isGreaterThanOrEqualToFP(other): (value) => boolean

Check if a value is greater than or equal to another

Parameters

ParameterType
otherunknown

Returns

Function

Parameters
ParameterType
valueunknown
Returns

boolean

Source

packages/utils/dist/src/equality.d.ts:51


isIP()

isIP(input): input is string

Parameters

ParameterType
inputunknown

Returns

input is string

Source

packages/utils/dist/src/ip.d.ts:1


isIPOrThrow()

isIPOrThrow(input): string

Will throw if input is not a valid IP

Parameters

ParameterType
inputunknown

Returns

string

Source

packages/utils/dist/src/ip.d.ts:5


isIPRangeOrThrow()

isIPRangeOrThrow(input): string

Will throw if input is not a valid CIDR

Parameters

ParameterType
inputunknown

Returns

string

Source

packages/utils/dist/src/ip.d.ts:3


isIPv4()

isIPv4(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/ip.d.ts:7


isIPv6()

isIPv6(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/ip.d.ts:6


isISDN()

isISDN(input, country?): boolean

Parameters

ParameterType
inputunknown
country?string

Returns

boolean

Source

packages/utils/dist/src/phone-number.d.ts:2


isISO8601()

isISO8601(input): input is string

Checks to see if an input is a ISO 8601 date

Parameters

ParameterType
inputunknown

Returns

input is string

Source

packages/utils/dist/src/dates.d.ts:49


isInteger()

isInteger(val): val is number

A simplified implementation of lodash isInteger

Parameters

ParameterType
valunknown

Returns

val is number

Source

packages/utils/dist/src/numbers.d.ts:26


isIterator()

isIterator<T>(input): input is Iterable<T>

Returns true if the input is an iterator

Type parameters

Type parameter
T

Parameters

ParameterType
inputunknown

Returns

input is Iterable<T>

Source

packages/utils/dist/src/iterators.d.ts:4


isKey()

isKey<T>(O, k): k is keyof T

Verify that k is a key of object O

Type parameters

Type parameter
T extends object

Parameters

ParameterType
OT
kPropertyKey

Returns

k is keyof T

Source

packages/utils/dist/src/objects.d.ts:19


isLeapYear()

isLeapYear(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:124


isLessThan()

isLessThan(value, other): boolean

Check if a value is less than another

Parameters

ParameterType
valueunknown
otherunknown

Returns

boolean

Source

packages/utils/dist/src/equality.d.ts:71


isLessThanFP()

isLessThanFP(other): (value) => boolean

Check if a value is greater than or equal to another

Parameters

ParameterType
otherunknown

Returns

Function

Parameters
ParameterType
valueunknown
Returns

boolean

Source

packages/utils/dist/src/equality.d.ts:75


isLessThanOrEqualTo()

isLessThanOrEqualTo(value, other): boolean

Check if a value is less than or equal to another

Parameters

ParameterType
valueunknown
otherunknown

Returns

boolean

Source

packages/utils/dist/src/equality.d.ts:63


isLessThanOrEqualToFP()

isLessThanOrEqualToFP(other): (value) => boolean

Check if a value is less than or equal to another

Parameters

ParameterType
otherunknown

Returns

Function

Parameters
ParameterType
valueunknown
Returns

boolean

Source

packages/utils/dist/src/equality.d.ts:67


isMACAddress()

isMACAddress(input, delimiter?): input is string

Parameters

ParameterType
inputunknown
delimiter?MACDelimiter

Returns

input is string

Source

packages/utils/dist/src/strings.d.ts:236


isMACAddressFP()

isMACAddressFP(args?): (input) => input is string

A functional version of isMacAddress

Parameters

ParameterType
args?MACDelimiter

Returns

Function

Parameters
ParameterType
inputunknown
Returns

input is string

Source

packages/utils/dist/src/strings.d.ts:240


isMIMEType()

isMIMEType(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:258


isMappedIPv4()

isMappedIPv4(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/ip.d.ts:8


isMonday()

isMonday(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:114


isNil()

isNil<T>(input): input is Nil

Type parameters

Type parameter
T

Parameters

ParameterType
inputNil | T

Returns

input is Nil

Source

packages/utils/dist/src/empty.d.ts:2


isNonRoutableIP()

isNonRoutableIP(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/ip.d.ts:16


isNonZeroCidr()

isNonZeroCidr(input): boolean

Parameters

ParameterType
inputstring

Returns

boolean

Source

packages/utils/dist/src/ip.d.ts:66


isNotNil()

isNotNil<T>(input): boolean

Type parameters

Type parameter
T

Parameters

ParameterType
inputT | Nil

Returns

boolean

Source

packages/utils/dist/src/empty.d.ts:3


isNumber()

isNumber(input): input is number

Check if an input is a number

Parameters

ParameterType
inputunknown

Returns

input is number

Source

packages/utils/dist/src/numbers.d.ts:5


isNumberLike()

isNumberLike(input): boolean

A stricter check for verifying a number string

Parameters

ParameterType
inputunknown

Returns

boolean

Todo

this needs to be smarter

Source

packages/utils/dist/src/numbers.d.ts:24


isObjectEntity()

isObjectEntity(input): boolean

Verify if the input is a object like type

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/objects.d.ts:23


isPast()

isPast(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:123


isPhoneNumberLike()

isPhoneNumberLike(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/phone-number.d.ts:3


isPlainObject()

isPlainObject(input): boolean

Detect if value is a plain object, that is, an object created by the Object constructor or one via Object.create(null)

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/deps.d.ts:12


isPort()

isPort(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:255


isPostalCode()

isPostalCode(input, locale?): boolean

Parameters

ParameterType
inputunknown
locale?"any" | PostalCodeLocale

Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:254


isPrimitiveValue()

isPrimitiveValue(value): boolean

Check if a value is a JavaScript primitive value OR it is object with Symbol.toPrimitive

Parameters

ParameterType
valueunknown

Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:21


isRegExp()

isRegExp(input): input is RegExp

Parameters

ParameterType
inputunknown

Returns

input is RegExp

Source

packages/utils/dist/src/regex.d.ts:1


isRegExpLike()

isRegExpLike(input, strict?): boolean

Parameters

ParameterType
inputunknown
strict?boolean

Returns

boolean

Source

packages/utils/dist/src/regex.d.ts:2


isRetryableError()

isRetryableError(err): boolean

Parameters

ParameterType
errunknown

Returns

boolean

Source

packages/utils/dist/src/errors.d.ts:100


isRoutableIP()

isRoutableIP(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/ip.d.ts:15


isSame()

isSame(target, input)

isSame<T>(target, input): input is T

Type parameters
Type parameter
T
Parameters
ParameterType
targetT
inputunknown
Returns

input is T

Deprecated

use isDeepEqual instead

Source

packages/utils/dist/src/equality.d.ts:43

isSame(target, input)

isSame<T>(target, input): boolean

Type parameters
Type parameter
T
Parameters
ParameterType
targetT
inputunknown
Returns

boolean

Deprecated

use isDeepEqual instead

Source

packages/utils/dist/src/equality.d.ts:43


isSaturday()

isSaturday(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:119


isSimpleObject()

isSimpleObject(input): input is Record<string, unknown>

Similar to is-plain-object but works better when you cloneDeep a DataEntity

Parameters

ParameterType
inputunknown

Returns

input is Record<string, unknown>

Source

packages/utils/dist/src/objects.d.ts:5


isString()

isString(val): val is string

A simplified implementation of lodash isString

Parameters

ParameterType
valunknown

Returns

val is string

Source

packages/utils/dist/src/strings.d.ts:4


isSunday()

isSunday(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:113


isTSError()

isTSError(err): err is TSError

Check is a TSError

Parameters

ParameterType
errunknown

Returns

err is TSError

Source

packages/utils/dist/src/errors.d.ts:104


isThursday()

isThursday(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:117


isToday()

isToday(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:126


isTomorrow()

isTomorrow(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:125


isTruthy()

isTruthy(input): boolean

Returns true if the value is a truthy like value

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/booleans.d.ts:19


isTuesday()

isTuesday(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:115


isTypedArray()

isTypedArray<T>(input): input is T

Check if an input is an TypedArray instance like: Uint8Array or Uint16Array. This excludes nodejs Buffers since they aren't really the same.

Type parameters

Type parameterValue
TTypedArray

Parameters

ParameterType
inputunknown

Returns

input is T

Source

packages/utils/dist/src/arrays.d.ts:55


isURL()

isURL(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:241


isUUID()

isUUID(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:242


isUnixTime()

isUnixTime(input, allowBefore1970?): input is number

Checks to see if an input is a unix time

Parameters

ParameterType
inputunknown
allowBefore1970?boolean

Returns

input is number

Source

packages/utils/dist/src/dates.d.ts:41


isUnixTimeFP()

isUnixTimeFP(allowBefore1970?): (input) => input is number

A functional version of isUnixTime

Parameters

ParameterType
allowBefore1970?boolean

Returns

Function

Parameters
ParameterType
inputunknown
Returns

input is number

Source

packages/utils/dist/src/dates.d.ts:45


isValidDate()

isValidDate(val): boolean

A simplified implementation of moment(new Date(val)).isValid()

Parameters

ParameterType
valunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:9


isValidDateInstance()

isValidDateInstance(val): val is Date

Parameters

ParameterType
valunknown

Returns

val is Date

Source

packages/utils/dist/src/dates.d.ts:34


isValidateNumberType()

isValidateNumberType(type): (input) => boolean

Parameters

ParameterType
typeFieldType

Returns

Function

Parameters
ParameterType
inputunknown
Returns

boolean

Source

packages/utils/dist/src/numbers.d.ts:85


isWednesday()

isWednesday(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:116


isWeekday()

isWeekday(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:120


isWeekend()

isWeekend(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:121


isWildCardString()

isWildCardString(term): boolean

Parameters

ParameterType
termstring

Returns

boolean

Source

packages/utils/dist/src/regex.d.ts:15


isYesterday()

isYesterday(input): boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/dates.d.ts:127


joinList()

joinList(input, sep?, join?): string

Create a sentence from a list (all items will be unique, empty values will be skipped)

Parameters

ParameterType
inputJoinListType[] | readonly JoinListType[]
sep?string
join?string

Returns

string

Source

packages/utils/dist/src/strings.d.ts:268


locked()

locked(): (target, propertyKey, descriptor) => void

A decorator for locking down a method

Returns

Function

Parameters
ParameterType
targetunknown
propertyKeystring
descriptorPropertyDescriptor
Returns

void

Source

packages/utils/dist/src/decorators.d.ts:2


logError()

logError(logger, err, ...messages): void

Safely log an error (with the error first Logger syntax)

Parameters

ParameterType
loggerLogger
errunknown
...messagesany[]

Returns

void

Source

packages/utils/dist/src/errors.d.ts:94


lookup()

lookup(input): (key) => any

Parameters

ParameterType
inputunknown

Returns

Function

Parameters
ParameterType
keyunknown
Returns

any

Source

packages/utils/dist/src/objects.d.ts:65


lookupTimezone()

lookupTimezone(input): string

Takes in a geo point like entity and returns the timezone of its location

Parameters

ParameterType
inputunknown

Returns

string

Source

packages/utils/dist/src/geo.d.ts:69


makeCoordinatesFromGeoPoint()

makeCoordinatesFromGeoPoint(point): CoordinateTuple

Parameters

ParameterType
pointGeoPoint

Returns

CoordinateTuple

Source

packages/utils/dist/src/geo.d.ts:20


makeGeoBBox()

makeGeoBBox(point1, point2): Feature<Polygon, GeoJsonProperties>

Parameters

ParameterType
point1GeoPoint
point2GeoPoint

Returns

Feature<Polygon, GeoJsonProperties>

Source

packages/utils/dist/src/geo.d.ts:17


makeGeoCircle()

makeGeoCircle(point, distance, unitVal?): Feature<Polygon> | undefined

Parameters

ParameterType
pointGeoPoint
distancenumber
unitVal?GeoDistanceUnit

Returns

Feature<Polygon> | undefined

Source

packages/utils/dist/src/geo.d.ts:22


makeGeoFeature()

makeGeoFeature(geoShape): Feature<any> | undefined

Converts a geoJSON object to its turf geo feature counterpart

Parameters

ParameterType
geoShapeunknown

Returns

Feature<any> | undefined

Source

packages/utils/dist/src/geo.d.ts:27


makeGeoFeatureOrThrow()

makeGeoFeatureOrThrow(geoShape): Feature<any>

Converts a geoJSON object to its turf geo feature counterpart, will throw if not valid

Parameters

ParameterType
geoShapeunknown

Returns

Feature<any>

Source

packages/utils/dist/src/geo.d.ts:29


makeISODate()

makeISODate(value?): string

A helper function for making an ISODate string

Parameters

ParameterType
value?null | string | number | Date | DateTuple

Returns

string

Source

packages/utils/dist/src/dates.d.ts:7


mapKeys()

mapKeys<T, R>(input, fn): R

Map the keys of an object

Type parameters

Type parameterValue
T extends object-
RT

Parameters

ParameterType
inputT
fn(value, key) => any

Returns

R

Source

packages/utils/dist/src/objects.d.ts:37


mapValues()

mapValues<T, R>(input, fn): R

Map the values of an object

Type parameters

Type parameterValue
T extends object-
RT

Parameters

ParameterType
inputT
fn(value, key) => any

Returns

R

Source

packages/utils/dist/src/objects.d.ts:35


match()

match(regexp, value): string | null

Parameters

ParameterType
regexpstring | RegExp
valuestring

Returns

string | null

Source

packages/utils/dist/src/regex.d.ts:5


matchAll()

matchAll(regexp, value): string[] | null

Parameters

ParameterType
regexpstring | RegExp
valuestring

Returns

string[] | null

Source

packages/utils/dist/src/regex.d.ts:10


matchAllFP()

matchAllFP(regexp): (value) => string[] | null

A functional version of matchAll

Parameters

ParameterType
regexpstring | RegExp

Returns

Function

Parameters
ParameterType
valuestring
Returns

string[] | null

Source

packages/utils/dist/src/regex.d.ts:14


matchFP()

matchFP(regexp): (value) => string | null

A functional version of match

Parameters

ParameterType
regexpstring | RegExp

Returns

Function

Parameters
ParameterType
valuestring
Returns

string | null

Source

packages/utils/dist/src/regex.d.ts:9


matchWildcard()

matchWildcard(wildCard, value): boolean

Parameters

ParameterType
wildCardstring
valuestring

Returns

boolean

Source

packages/utils/dist/src/regex.d.ts:17


md5()

md5(value): string

Parameters

ParameterType
valuestring | Buffer

Returns

string

Source

packages/utils/dist/src/type-coercion.d.ts:33


memoize()

memoize<T>(fn): T

A replacement for lodash memoize

Type parameters

Type parameter
T extends MemoizeFn

Parameters

ParameterType
fnT

Returns

T

Source

packages/utils/dist/src/functions.d.ts:15


noop()

noop(...args): any

A simple function that does nothing but return the first argument

Parameters

ParameterType
...argsany[]

Returns

any

Source

packages/utils/dist/src/functions.d.ts:10


not()

not<T>(...fns): T

Curry one or more functions, where all must returned falsy values

Type parameters

Type parameter
T extends AnyFn

Parameters

ParameterType
...fnsT[]

Returns

T

Source

packages/utils/dist/src/fp.d.ts:5


once()

once<T>(fn): (...args) => ReturnType<T> | undefined

Creates a function that is only invoked once

Type parameters

Type parameter
T extends (...args) => any

Parameters

ParameterType
fnT

Returns

Function

Parameters
ParameterType
...argsArgType<T>
Returns

ReturnType<T> | undefined

Source

packages/utils/dist/src/functions.d.ts:5


or()

or<T>(...fns): T

Curry one or more functions, where one must returned a truthy value

Type parameters

Type parameter
T extends AnyFn

Parameters

ParameterType
...fnsT[]

Returns

T

Source

packages/utils/dist/src/fp.d.ts:13


pDefer()

pDefer(): object

An alternative to Bluebird.defer: http://bluebirdjs.com/docs/api/deferred-migration.html Considered bad practice in most cases, use the Promise constructor

Returns

object

promise

promise: Promise<any>

reject()

reject: (reason?) => void

Parameters
ParameterType
reason?any
Returns

void

resolve()

resolve: (value?) => void

Parameters
ParameterType
value?unknown
Returns

void

Source

packages/utils/dist/src/promises.d.ts:96


pDelay()

pDelay<T>(delay?, arg?): Promise<T>

promisified setTimeout

Type parameters

Type parameterValue
Tundefined

Parameters

ParameterType
delay?number
arg?T

Returns

Promise<T>

Source

packages/utils/dist/src/promises.d.ts:2


pImmediate()

pImmediate<T>(arg?): Promise<T>

promisified process.nextTick,setImmediate or setTimeout depending on your environment

Type parameters

Type parameterValue
Tundefined

Parameters

ParameterType
arg?T

Returns

Promise<T>

Source

packages/utils/dist/src/promises.d.ts:4


pRace()

pRace(promises, logError?): Promise<any>

Run multiple promises at once, and resolve/reject when the first completes

Parameters

ParameterType
promisesPromise<any>[]
logError?(err) => void

Returns

Promise<any>

Source

packages/utils/dist/src/promises.d.ts:87


pRaceWithTimeout()

pRaceWithTimeout(promises, timeout, logError?): Promise<any>

Similar to pRace but with

Parameters

ParameterType
promisesPromise<any> | Promise<any>[]
timeoutnumber
logError?(err) => void

Returns

Promise<any>

Source

packages/utils/dist/src/promises.d.ts:91


pRetry()

pRetry<T>(fn, options?): Promise<T>

A promise retry fn.

Type parameters

Type parameterValue
Tany

Parameters

ParameterType
fnPromiseFn<T>
options?Partial<PRetryConfig>

Returns

Promise<T>

Source

packages/utils/dist/src/promises.d.ts:53


pWhile()

pWhile(fn, options?): Promise<void>

Run a function until it returns true or throws an error

Parameters

ParameterType
fnPromiseFn<any>
options?PWhileOptions

Returns

Promise<void>

Source

packages/utils/dist/src/promises.d.ts:74


parseCustomDateFormat()

parseCustomDateFormat(value, format, referenceDate): number

Parameters

ParameterType
valueunknown
formatstring
referenceDateDate

Returns

number

Source

packages/utils/dist/src/dates.d.ts:79


parseDateValue()

parseDateValue(value, format, referenceDate): number

Parse a date value (that has already been validated) and return the epoch millis time.

Parameters

ParameterType
valueunknown
formatundefined | string
referenceDateDate

Returns

number

Source

packages/utils/dist/src/dates.d.ts:84


parseError()

parseError(input, withStack?): string

parse input to get error message or stack

Parameters

ParameterType
inputunknown
withStack?boolean

Returns

string

Source

packages/utils/dist/src/errors.d.ts:96


parseErrorInfo()

parseErrorInfo(input, config?): ErrorInfo

parse error for info

Parameters

ParameterType
inputunknown
config?TSErrorConfig

Returns

ErrorInfo

Source

packages/utils/dist/src/errors.d.ts:90


parseGeoDistance()

parseGeoDistance(str): GeoDistanceObj

Parameters

ParameterType
strstring

Returns

GeoDistanceObj

Source

packages/utils/dist/src/geo.d.ts:8


parseGeoDistanceUnit()

parseGeoDistanceUnit(input): GeoDistanceUnit

Parameters

ParameterType
inputstring

Returns

GeoDistanceUnit

Source

packages/utils/dist/src/geo.d.ts:9


parseGeoPoint()

parseGeoPoint(point)

parseGeoPoint(point): GeoPoint

Convert an input into a Geo Point object with lat and lon

Parameters
ParameterType
pointunknown
Returns

GeoPoint

Source

packages/utils/dist/src/geo.d.ts:13

parseGeoPoint(point, throwInvalid)

parseGeoPoint(point, throwInvalid): GeoPoint

Parameters
ParameterType
pointunknown
throwInvalidtrue
Returns

GeoPoint

Source

packages/utils/dist/src/geo.d.ts:14

parseGeoPoint(point, throwInvalid)

parseGeoPoint(point, throwInvalid): GeoPoint | null

Parameters
ParameterType
pointunknown
throwInvalidfalse
Returns

GeoPoint | null

Source

packages/utils/dist/src/geo.d.ts:15


parseJSON()

parseJSON<T>(buf): T

JSON encoded buffer into a json object

Type parameters

Type parameterValue
TRecord<string, unknown>

Parameters

ParameterType
bufstring | Buffer

Returns

T

Source

packages/utils/dist/src/json.d.ts:5


parseList()

parseList(input): string[]

Maps an array of strings and and trims the result, or parses a comma separated list and trims the result

Parameters

ParameterType
inputunknown

Returns

string[]

Source

packages/utils/dist/src/strings.d.ts:263


parseNumberList()

parseNumberList(input): number[]

Like parseList, except it returns numbers

Parameters

ParameterType
inputunknown

Returns

number[]

Source

packages/utils/dist/src/numbers.d.ts:40


parsePhoneNumber()

parsePhoneNumber(input): string

Parameters

ParameterType
inputstring | number

Returns

string

Source

packages/utils/dist/src/phone-number.d.ts:1


polyHasHoles()

polyHasHoles(input): boolean

Parameters

ParameterType
inputGeoShape

Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:67


prefixErrorMsg()

prefixErrorMsg(input, prefix?, defaultMsg?): string

Parameters

ParameterType
inputunknown
prefix?string
defaultMsg?string

Returns

string

Source

packages/utils/dist/src/errors.d.ts:98


primitiveToString()

primitiveToString(value): string

Convert a JavaScript primitive value to a string. (Does not covert object like entities unless Symbol.toPrimitive is specified)

Parameters

ParameterType
valueunknown

Returns

string

Source

packages/utils/dist/src/strings.d.ts:26


random()

random(min, max): number

A native implementation of lodash random

Parameters

ParameterType
minnumber
maxnumber

Returns

number

Source

packages/utils/dist/src/numbers.d.ts:3


reverseIP()

reverseIP(input): string

Parameters

ParameterType
inputunknown

Returns

string

Source

packages/utils/dist/src/ip.d.ts:69


setDate()

setDate(date): (input) => number

Parameters

ParameterType
datenumber

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number

Source

packages/utils/dist/src/dates.d.ts:165


setHours()

setHours(hours): (input) => number

Parameters

ParameterType
hoursnumber

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number

Source

packages/utils/dist/src/dates.d.ts:164


setMilliseconds()

setMilliseconds(ms): (input) => number

Parameters

ParameterType
msnumber

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number

Source

packages/utils/dist/src/dates.d.ts:161


setMinutes()

setMinutes(minutes): (input) => number

Parameters

ParameterType
minutesnumber

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number

Source

packages/utils/dist/src/dates.d.ts:163


setMonth()

setMonth(month): (input) => number

Parameters

ParameterType
monthnumber

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number

Source

packages/utils/dist/src/dates.d.ts:166


setPrecision()

setPrecision(input, fractionDigits, truncate?): number

Returns a truncated number to nth decimal places.

Parameters

ParameterTypeDescription
inputunknown-
fractionDigitsnumberThe number of decimal points to round to.
truncate?booleanIf this is true the number will not be rounded

Returns

number

Source

packages/utils/dist/src/numbers.d.ts:63


setPrecisionFP()

setPrecisionFP(fractionDigits, truncate?): (input) => number

A functional programming version of setPrecision

Parameters

ParameterTypeDescription
fractionDigitsnumberThe number of decimal points to round to.
truncate?booleanIf this is true the number will not be rounded

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number

Source

packages/utils/dist/src/numbers.d.ts:70


setSeconds()

setSeconds(seconds): (input) => number

Parameters

ParameterType
secondsnumber

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number

Source

packages/utils/dist/src/dates.d.ts:162


setTimezone()

setTimezone(input, timezone): DateTuple

Set the timezone offset of a date, returns a date tuple

Parameters

ParameterType
inputunknown
timezonestring | number

Returns

DateTuple

Source

packages/utils/dist/src/dates.d.ts:58


setTimezoneFP()

setTimezoneFP(timezone): (input) => DateTuple

A curried version of setTimezone

Parameters

ParameterType
timezonestring | number

Returns

Function

Parameters
ParameterType
inputunknown
Returns

DateTuple

Source

packages/utils/dist/src/dates.d.ts:62


setYear()

setYear(year): (input) => number

Parameters

ParameterType
yearnumber

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number

Source

packages/utils/dist/src/dates.d.ts:167


shannonEntropy()

shannonEntropy(input): number

Performs a Shannon entropy calculation on string inputs

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/strings.d.ts:271


shortenIPv6Address()

shortenIPv6Address(input): string

Parameters

ParameterTypeDescription
inputunknownip address

Returns

string

IPv6 addresses are returned without leading 0's in a group or empty groups ipv4 addresses are simply returned

Source

packages/utils/dist/src/ip.d.ts:62


sort()

sort<T>(arr, compare?): T[]

Sort an arr or set

Type parameters

Type parameter
T

Parameters

ParameterType
arrT[] | readonly T[] | Set<T>
compare?(a, b) => number

Returns

T[]

Source

packages/utils/dist/src/arrays.d.ts:18


sortBy()

sortBy<T, V>(arr, fnOrPath): T[]

Sort by path or function that returns the values to sort with

Type parameters

Type parameterValue
T-
Vany

Parameters

ParameterType
arrT[] | Set<T>
fnOrPathstring | (value) => V

Returns

T[]

Source

packages/utils/dist/src/arrays.d.ts:20


sortKeys()

sortKeys<T>(input, options?): T

Sort keys on an object

Type parameters

Type parameter
T extends Record<string, unknown>

Parameters

ParameterType
inputT
options?object
options.deep?boolean

Returns

T

Source

packages/utils/dist/src/objects.d.ts:31


startsWith()

startsWith(str, val): boolean

A native implementation of lodash startsWith

Parameters

ParameterType
strunknown
valunknown

Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:61


startsWithFP()

startsWithFP(val): (input) => boolean

A function version of startsWith

Parameters

ParameterType
valstring

Returns

Function

Parameters
ParameterType
inputunknown
Returns

boolean

Source

packages/utils/dist/src/strings.d.ts:63


stringEntropy()

stringEntropy(algo?): StringEntropyFN

returns a function to perform entropy calculations, currently only supports the "shannon" algorithm

Parameters

ParameterType
algo?shannon

Returns

StringEntropyFN

Source

packages/utils/dist/src/strings.d.ts:278


stripErrorMessage()

stripErrorMessage(error, reason?, requireSafe?): string

Parameters

ParameterType
errorunknown
reason?string
requireSafe?boolean

Returns

string

Source

packages/utils/dist/src/errors.d.ts:133


subtractFromDate()

subtractFromDate(input, args): number

Parameters

ParameterType
inputunknown
argsAdjustDateArgs

Returns

number

Source

packages/utils/dist/src/dates.d.ts:142


subtractFromDateFP()

subtractFromDateFP(args): (input) => number

Parameters

ParameterType
argsAdjustDateArgs

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number

Source

packages/utils/dist/src/dates.d.ts:143


times()

times(n)

times(n): number[]

A native implementation of lodash times

Parameters
ParameterType
nnumber
Returns

number[]

Source

packages/utils/dist/src/arrays.d.ts:26

times(n, fn)

times<T>(n, fn): T[]

Type parameters
Type parameter
T
Parameters
ParameterType
nnumber
fn(index) => T
Returns

T[]

Source

packages/utils/dist/src/arrays.d.ts:27


timesIter()

timesIter(n)

timesIter(n): Iterable<number>

Like times but an iterable

Parameters
ParameterType
nnumber
Returns

Iterable<number>

Source

packages/utils/dist/src/arrays.d.ts:29

timesIter(n, fn)

timesIter<T>(n, fn): Iterable<T>

Type parameters
Type parameter
T
Parameters
ParameterType
nnumber
fn(index) => T
Returns

Iterable<T>

Source

packages/utils/dist/src/arrays.d.ts:30


timezoneToOffset()

timezoneToOffset(timezone): number

Given a timezone, it will return the minutes of its offset from UTC time

Parameters

ParameterType
timezoneunknown

Returns

number

Source

packages/utils/dist/src/dates.d.ts:151


toBigInt()

toBigInt(input): bigint | false

Convert any input to a bigint

Parameters

ParameterType
inputunknown

Returns

bigint | false

Source

packages/utils/dist/src/numbers.d.ts:13


toBigIntOrThrow()

toBigIntOrThrow(input): bigint

Convert any input to a bigint

Parameters

ParameterType
inputunknown

Returns

bigint

Source

packages/utils/dist/src/numbers.d.ts:15


toBoolean()

toBoolean(input): boolean

Convert any input into a boolean, this will work with stringified boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Example

toBoolean(1); // true
toBoolean(0); // false
toBoolean('1'); // true
toBoolean('0'); // false
toBoolean('yes'); // true
toBoolean('NO'); // false
toBoolean('true'); // true
toBoolean('FALSE'); // false

Source

packages/utils/dist/src/booleans.d.ts:15


toBooleanOrThrow()

toBooleanOrThrow(input): boolean

Will throw if input is not booleanLike, converts input to a Boolean

Parameters

ParameterType
inputunknown

Returns

boolean

Source

packages/utils/dist/src/booleans.d.ts:43


toCIDR()

toCIDR(input, suffix): string

Parameters

ParameterType
inputunknown
suffixstring | number

Returns

string

Source

packages/utils/dist/src/ip.d.ts:65


toCamelCase()

toCamelCase(input): string

Parameters

ParameterType
inputstring

Returns

string

Source

packages/utils/dist/src/strings.d.ts:217


toCelsius()

toCelsius(input): number

Convert a fahrenheit value to celsius, this will return a precision of 2 decimal points

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/numbers.d.ts:75


toEpochMSOrThrow()

toEpochMSOrThrow(input): DateTuple | number

Will convert a date to its epoch millisecond format or throw if invalid

Parameters

ParameterType
inputunknown

Returns

DateTuple | number

Source

packages/utils/dist/src/dates.d.ts:181


toFahrenheit()

toFahrenheit(input): number

Convert a celsius value to fahrenheit, this will return a precision of 2 decimal points

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/numbers.d.ts:80


toFloat()

toFloat(input): number | false

Convert an input to a float, return false if unable to convert input

Parameters

ParameterType
inputunknown

Returns

number | false

Source

packages/utils/dist/src/numbers.d.ts:34


toFloatOrThrow()

toFloatOrThrow(input): number

Convert an input to a float or throw

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/numbers.d.ts:36


toGeoJSON()

toGeoJSON(input): GeoShape | undefined

Only able to convert geo-points to either a geo-json point or a simple polygon. There is no current support for creating polygon with holes or multi-polygon as of right now. geoJSON input is made sure to be properly formatted for its type value

Parameters

ParameterType
inputunknown

Returns

GeoShape | undefined

Source

packages/utils/dist/src/geo.d.ts:64


toGeoJSONOrThrow()

toGeoJSONOrThrow(input): GeoShape

Parameters

ParameterType
inputunknown

Returns

GeoShape

Source

packages/utils/dist/src/geo.d.ts:65


toHumanTime()

toHumanTime(ms): string

converts smaller than a week milliseconds to human readable time

Parameters

ParameterType
msnumber

Returns

string

Source

packages/utils/dist/src/dates.d.ts:78


toISO8601()

toISO8601(value): string

Convert a value to an ISO 8601 date string. This should be used over makeISODate

Parameters

ParameterType
valueunknown

Returns

string

Source

packages/utils/dist/src/dates.d.ts:54


toInteger()

toInteger(input): number | false

Convert an input to a integer, return false if unable to convert input

Parameters

ParameterType
inputunknown

Returns

number | false

Source

packages/utils/dist/src/numbers.d.ts:28


toIntegerOrThrow()

toIntegerOrThrow(input): number

Convert an input to a integer or throw

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/numbers.d.ts:30


toJSONCompatibleValue()

toJSONCompatibleValue(input): any

This will try to convert any BigInt values to a value that is compatible with JSON, it will iterate through an array, and check all the keys of an object

Parameters

ParameterType
inputunknown

Returns

any

Source

packages/utils/dist/src/json.d.ts:9


toKebabCase()

toKebabCase(input): string

Parameters

ParameterType
inputstring

Returns

string

Source

packages/utils/dist/src/strings.d.ts:219


toLowerCase()

toLowerCase(input): string

Converts a value to lower case

Parameters

ParameterType
inputunknown

Returns

string

Example

toLowerCase('lowercase'); // 'lowercase'
toLowerCase('MixEd'); // 'mixed'
toLowerCase('UPPERCASE'); // 'uppercase'

Source

packages/utils/dist/src/strings.d.ts:57


toNumber()

toNumber(input): number

Convert any input to a number, return Number.NaN if unable to convert input

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/numbers.d.ts:7


toNumberOrThrow()

toNumberOrThrow(input): number

Will throw if converted number is NaN

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/numbers.d.ts:9


toPascalCase()

toPascalCase(input): string

Parameters

ParameterType
inputstring

Returns

string

Source

packages/utils/dist/src/strings.d.ts:218


toSafeString()

toSafeString(input): string

Make a string url/elasticsearch safe. safeString converts the string to lower case, removes any invalid characters, and replaces whitespace with _ (if it exists in the string) or - Warning this may reduce the str length

Parameters

ParameterType
inputstring

Returns

string

Source

packages/utils/dist/src/strings.d.ts:229


toSnakeCase()

toSnakeCase(input): string

Parameters

ParameterType
inputstring

Returns

string

Source

packages/utils/dist/src/strings.d.ts:220


toStatusErrorCode()

toStatusErrorCode(input): string

Parameters

ParameterType
inputundefined | string

Returns

string

Source

packages/utils/dist/src/errors.d.ts:97


toString()

toString(val): string

Safely convert any input to a string

Parameters

ParameterType
valunknown

Returns

string

Example

toString(1); // '1'
toString(0.01); // '0.01'
toString(true); // 'true'
toString(BigInt(2) ** BigInt(64)); // '18,446,744,073,709,551,616'
toString(new Date('2020-09-23T14:54:21.020Z')) // '2020-09-23T14:54:21.020Z'

Source

packages/utils/dist/src/strings.d.ts:16


toTimeZone()

toTimeZone(val, timezone): DateTuple | null

Parameters

ParameterType
valunknown
timezonestring

Returns

DateTuple | null

Source

packages/utils/dist/src/dates.d.ts:19


toTimeZoneUsingLocation()

toTimeZoneUsingLocation(val, location): DateTuple | null

Parameters

ParameterType
valunknown
locationunknown

Returns

DateTuple | null

Source

packages/utils/dist/src/dates.d.ts:20


toTimeZoneUsingLocationFP()

toTimeZoneUsingLocationFP(location): (val) => DateTuple | null

Parameters

ParameterType
locationunknown

Returns

Function

Parameters
ParameterType
valunknown
Returns

DateTuple | null

Source

packages/utils/dist/src/dates.d.ts:21


toTitleCase()

toTitleCase(input): string

Parameters

ParameterType
inputstring

Returns

string

Source

packages/utils/dist/src/strings.d.ts:221


toUpperCase()

toUpperCase(input): string

Converts a value to upper case

Parameters

ParameterType
inputunknown

Returns

string

Example

toUpperCase('lowercase'); // 'LOWERCASE'
toUpperCase('MixEd'); // 'MIXED'
toUpperCase('UPPERCASE'); // 'UPPERCASE'

Source

packages/utils/dist/src/strings.d.ts:47


trackTimeout()

trackTimeout(timeoutMs): () => number | false

track a timeout to see if it expires

Parameters

ParameterType
timeoutMsnumber

Returns

Function

a function that will returns false if the time elapsed

Returns

number | false

Source

packages/utils/dist/src/dates.d.ts:76


trim()

trim(input, char?): string

safely trims whitespace from an input

Parameters

ParameterType
inputunknown
char?string

Returns

string

Source

packages/utils/dist/src/strings.d.ts:28


trimAndToLower()

trimAndToLower(input?): string

safely trim and to lower a input, useful for string comparison

Parameters

ParameterType
input?string

Returns

string

Source

packages/utils/dist/src/strings.d.ts:35


trimAndToUpper()

trimAndToUpper(input?): string

safely trim and to lower a input, useful for string comparison

Parameters

ParameterType
input?string

Returns

string

Source

packages/utils/dist/src/strings.d.ts:37


trimEnd()

trimEnd(input, char?): string

Parameters

ParameterType
inputunknown
char?string

Returns

string

Source

packages/utils/dist/src/strings.d.ts:32


trimEndFP()

trimEndFP(char?): (input) => string

Parameters

ParameterType
char?string

Returns

Function

Parameters
ParameterType
inputunknown
Returns

string

Source

packages/utils/dist/src/strings.d.ts:33


trimFP()

trimFP(char?): (input) => string

Parameters

ParameterType
char?string

Returns

Function

Parameters
ParameterType
inputunknown
Returns

string

Source

packages/utils/dist/src/strings.d.ts:29


trimISODateSegment()

trimISODateSegment(segment): (input) => number

Returns a function to trim the ISO 8601 date segment useful for creating yearly, monthly, daily or hourly dates

Parameters

ParameterType
segmentISO8601DateSegment

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number

Source

packages/utils/dist/src/dates.d.ts:71


trimStart()

trimStart(input, char?): string

Parameters

ParameterType
inputunknown
char?string

Returns

string

Source

packages/utils/dist/src/strings.d.ts:30


trimStartFP()

trimStartFP(char?): (input) => string

Parameters

ParameterType
char?string

Returns

Function

Parameters
ParameterType
inputunknown
Returns

string

Source

packages/utils/dist/src/strings.d.ts:31


truncate()

truncate(value, len, ellipsis?): string

Truncate a string value, by default it will add an ellipsis (...) if truncated.

Parameters

ParameterType
valueunknown
lennumber
ellipsis?boolean

Returns

string

Source

packages/utils/dist/src/strings.d.ts:71


truncateFP()

truncateFP(len, ellipsis?): (value) => string

A functional version of truncate

Parameters

ParameterType
lennumber
ellipsis?boolean

Returns

Function

Parameters
ParameterType
valueunknown
Returns

string

Source

packages/utils/dist/src/strings.d.ts:75


tryParseJSON()

tryParseJSON<T>(input): T

Type parameters

Type parameterValue
Tany

Parameters

ParameterType
inputunknown

Returns

T

Source

packages/utils/dist/src/json.d.ts:3


tzCacheLoaded()

tzCacheLoaded(): boolean

Returns

boolean

Source

packages/utils/dist/src/geo.d.ts:70


unescapeString()

unescapeString(str?): string

Unescape characters in string and avoid double escaping

Parameters

ParameterType
str?string

Returns

string

Source

packages/utils/dist/src/strings.d.ts:59


uniq()

uniq<T>(arr): T[]

A native implementation of lodash uniq

Type parameters

Type parameter
T

Parameters

ParameterType
arrT[] | Set<T>

Returns

T[]

Source

packages/utils/dist/src/arrays.d.ts:16


uniqBy()

uniqBy<T, V>(values, fnOrPath): T[]

Get the unique values by a path or function that returns the unique values

Type parameters

Type parameterValue
T-
Vany

Parameters

ParameterType
valuesT[] | readonly T[]
fnOrPathstring | (value) => V

Returns

T[]

Source

packages/utils/dist/src/arrays.d.ts:24


validateByteNumber()

validateByteNumber(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/numbers.d.ts:81


validateIntegerNumber()

validateIntegerNumber(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/numbers.d.ts:83


validateListCoords()

validateListCoords(coords): any[]

Parameters

ParameterType
coordsCoordinateTuple[]

Returns

any[]

Source

packages/utils/dist/src/geo.d.ts:66


validateNumberType()

validateNumberType(type): (input) => number

Parameters

ParameterType
typeFieldType

Returns

Function

Parameters
ParameterType
inputunknown
Returns

number

Source

packages/utils/dist/src/numbers.d.ts:84


validateShortNumber()

validateShortNumber(input): number

Parameters

ParameterType
inputunknown

Returns

number

Source

packages/utils/dist/src/numbers.d.ts:82


waterfall()

waterfall(input, fns, addBreak?): Promise<any>

Async waterfall function

Parameters

ParameterType
inputunknown
fnsPromiseFn<any>[]
addBreak?boolean

Returns

Promise<any>

Source

packages/utils/dist/src/promises.d.ts:83


wildCardToRegex()

wildCardToRegex(term): RegExp

Parameters

ParameterType
termstring

Returns

RegExp

Source

packages/utils/dist/src/regex.d.ts:16


withoutNil()

withoutNil<T>(input): WithoutNil<T>

Build a new object without null or undefined values (shallow)

Type parameters

Type parameter
T

Parameters

ParameterType
inputT

Returns

WithoutNil<T>

Source

packages/utils/dist/src/objects.d.ts:39