@types/hoek

  • Version 4.1.3
  • Published
  • No dependencies
  • MIT license

Install

npm i @types/hoek
yarn add @types/hoek
pnpm add @types/hoek

Overview

TypeScript definitions for hoek

Index

Functions

function abort

abort: (message: string | Error) => void;
  • Throw if process.env.NODE_ENV === 'test'. Else display most recent stack and exit process.

function applyToDefaults

applyToDefaults: <T1, T2>(
defaults: T1,
options: T2,
isNullOverride?: boolean
) => T1 & T2;
  • Apply options to a copy of the defaults.

function applyToDefaultsWithShallow

applyToDefaultsWithShallow: <T1, T2>(
defaults: T1,
options: T2,
keys?: string[]
) => T1 & T2;
  • Apply options to a copy of the defaults.

function assert

assert: (condition: boolean, message: string | Error) => void | Error;
  • Print message or throw error if condition fails.

function base64urlDecode

base64urlDecode: (value: string) => string;
  • Decode string into Base64 or URL encoding.

function base64urlEncode

base64urlEncode: (value: string) => string;
  • Encode value of string or buffer type in Base64 or URL encoding.

function callStack

callStack: (slice?: any) => any[];
  • Return a trace stack array.

function clone

clone: <T>(obj: T) => T;
  • Clone an object or an array.

function cloneWithShallow

cloneWithShallow: (obj: any, keys: string[]) => any;
  • Clone an object or array.

function contain

contain: (ref: any, values: any, options?: ContainOptions) => boolean;
  • Test if the reference value contains the provided values.

function deepEqual

deepEqual: <T>(b: T, a: T, options?: any) => T;
  • Perform a deep comparison of the two values.

function displayStack

displayStack: (slice?: any) => string[];
  • Display the trace stack.

function escapeHeaderAttribute

escapeHeaderAttribute: (attribute: string) => string;
  • Escape attribute value for use in HTTP header.

function escapeHtml

escapeHtml: (htmlString: string) => string;
  • Escape html characters.

function escapeRegex

escapeRegex: (regexString: string) => string;
  • Escape string for Regex construction.

function flatten

flatten: (array: any[], target?: any[]) => any[];
  • Flatten an array.

function ignore

ignore: () => void;
  • A simple no-op function.

function intersect

intersect: (array1: any[], array2: any[]) => any;
  • Find the common unique items in two arrays.

function isInteger

isInteger: (value: any) => boolean;
  • Check value to see if it is an integer.

function mapToObject

mapToObject: (array: any[], key?: string) => any;
  • Convert an Array into an Object.

function merge

merge: <T1, T2>(
target: T1,
source: T2,
isNullOverride?: boolean,
isMergeArrays?: boolean
) => T1 & T2;
  • Merge all the properties of source into target.

function nextTick

nextTick: (fn: () => void) => () => void;
  • Wrap fn in process.nextTick.

function once

once: (fn: () => void) => () => void;
  • Make sure fn is only run once.

function reach

reach: (obj: any, chain: any, options?: ReachOptions) => any;
  • Convert an object key chain string to reference.

function reachTemplate

reachTemplate: (obj: any, template: string, options?: ReachOptions) => any;
  • Replace string parameters ({name}) with their corresponding object key values.

function shallow

shallow: (obj: any) => any;
  • Perform a shallow copy by copying the references of all the top level children.

function stringify

stringify: (obj: any) => string;
  • Convert an object to string. Any errors are caught and reported back in the form of the returned string.

function transform

transform: (obj: any, transform: any, options?: ReachOptions) => any;
  • Transform an existing object into a new one based on the supplied obj and transform map.

function unique

unique: <T>(array: T[], key?: string) => T[];
  • Remove duplicate items from Array.

function uniqueFilename

uniqueFilename: (path: string, extension?: string) => string;
  • path to prepend to a randomly generated file name.

Classes

class Bench

class Bench {}
  • Same as Timer, except ts stores the internal node clock.

property ts

ts: number;
  • The number of milliseconds on the node clock elapsed since the epoch.

method elapsed

elapsed: () => number;
  • The time (ms) elapsed since the timer was created.

class Timer

class Timer {}
  • A Timer object.

property ts

ts: number;
  • The number of milliseconds elapsed since the epoch.

method elapsed

elapsed: () => number;
  • The time (ms) elapsed since the timer was created.

Interfaces

interface ContainOptions

interface ContainOptions {}

    property deep

    deep?: boolean;
    • Perform a deep comparison of the values?

    property once

    once?: boolean;
    • Allow only one occurrence of each value?

    property only

    only?: boolean;
    • Don't allow values not explicitly listed?

    property part

    part?: boolean;
    • Allow partial match of the values?

    interface ReachOptions

    interface ReachOptions {}

      property default

      default?: any;
      • Value to return if the path or value is not present. Default is undefined.

      property functions

      functions?: boolean;
      • Allow traversing functions for properties?

      property separator

      separator?: string;
      • String to split chain path on. Defaults to ".".

      property strict

      strict?: boolean;
      • Throw an error on missing member? Default is false.

      Package Files (1)

      Dependencies (0)

      No dependencies.

      Dev Dependencies (0)

      No dev dependencies.

      Peer Dependencies (0)

      No peer dependencies.

      Badge

      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/hoek.

      • Markdown
        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/hoek)
      • HTML
        <a href="https://www.jsdocs.io/package/@types/hoek"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>