Options
All
  • Public
  • Public/Protected
  • All
Menu
     

Module "dffrnt.utils"

A collection of useful API Utilities & PolyFills

Index

Type aliases

DateLocale

DateLocale: "de_DE" | "en_CA" | "en_US" | "es_MX" | "fr_FR" | "it_IT" | "nl_NL" | "pt_BR" | "ru_RU" | "tr_TR" | "zh_CN"

Built-in locales for use in

FMType

FMType: string

A format style for an expected value type (txt|dte|num|num|bln|arr|obj|raw).

FMTemplate

FMTemplate: string

A String template for the FRMT class. (see: printf (C++))

Formatters:

... Name Output
%(t) Stringy Any value, formatted as (t).
%[%s](t) Array The Array, formatted as specified.
%{%(k¦v)s}(t) Object The Object, formatted as specified.
%(named)(t) Named The property matching the named variable.

Types:

... Name Output Example
s String String of characters. hello, world
d Date A date string or object. May 4 05:00PM
i Integer Signed decimal integer. 392
f Float Decimal floating point, lowercase. 392.65
b Boolean A truthy or falsy statement. true
a Array An array or items [1,2,3,4,5]
o Object An object of items. {hello:"world"}
r Raw Anything. Evalutes and auto formats. 1 or "hello"
%% String A literal percent sign. %

Flags:

... Name Output
! Strict Blank, if the value does not match the type.
- Left Left-justify within the given field width; Right justification is the default.
(number) Width Minimum number of characters to be printed.
.(number) Width The minimum number of digits or decimal places to be printed.

Modifiers:

Context Name Description Example
%|-/Mr.|s Prefix Prepend the template value with Mr. Smith => Mr. Smith
%|+/ Sr.|s Suffix Append the template value with Sr. Jacob => Jacob Sr.
%[%s|;/ or ]s Delimiter Delimit the template value by or [1,2] => 1 or 2
%[ %s|&/ and]s Last Prepend the last Array item with and [1,2,3] => 1 2 and 3
%|^/U|s Case Format the case as U|L|T hello => HELLO
%|@/grey|s Color Color the template value ...
%|=/ll/77|s Replace Replace occurences of characters with another hello => he77o
%|#/Name:|s Index Comming soon... ...
%|?/Name:|s Column Coming soon... ...

JSNPage

JSNPage: number

A page Number for the JSON results

JSNLimit

JSNLimit: number

A limit Number for the JSON results

JSNPrev

JSNPrev: string

A link to the previous page of JSON results

JSNNext

JSNNext: string

A link to the next page of JSON results

JSNQParam

JSNQParam: string | number

A query parameter in a query Object

LHandlers

LHandlers: object

A collection of Handlers for each ELOGR Event

Type declaration

CBtimed

CBtimed: function

A function to time using the LG.Timed method

Type declaration

    • (): void
    • Returns void

Variables

Const colors

colors: "/Users/LeShaun/Dropbox/Development/DFFRNT/evectr.api/node_modules/colors/index"

Const Imm

Imm: "/Users/LeShaun/Dropbox/Development/DFFRNT/evectr.api/node_modules/immutable/dist/immutable-nonambient"

Const TZ

TZ: any

See: tzdata

Const ROOTD

ROOTD: any

Const PATH

PATH: "path"

Const os

os: "os"

See: Node.js/os

Const fs

fs: "fs"

See: Node.js/fs

Const Platform

Platform: "nix" | "win"

The platform this application exists on.

Const FRMT_MODS

FRMT_MODS: FRMTMods

...

Const FRMT_OPTS

FRMT_OPTS: FRMTOpts

...

Const FRMT_TYPS

FRMT_TYPS: FRMTTypes

...

Const FRMT_FNTS

FRMT_FNTS: FRMTFonts

...

Functions

Const Assign

  • Assign<T, U>(target: T, source: U): number
  • Assign<T, U, V>(target: T, source1: U, source2: V): number
  • Assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): number
  • Assign(target: object, ...sources: any[]): any
  • Type parameters

    • T

    • U

    Parameters

    • target: T
    • source: U

    Returns number

  • Type parameters

    • T

    • U

    • V

    Parameters

    • target: T
    • source1: U
    • source2: V

    Returns number

  • Type parameters

    • T

    • U

    • V

    • W

    Parameters

    • target: T
    • source1: U
    • source2: V
    • source3: W

    Returns number

  • Parameters

    • target: object
    • Rest ...sources: any[]

    Returns any

ARGS

  • ARGS(args: object, from?: number): any[]
  • Converts a function's Arguments into an Array.

    Parameters

    • args: object
      • [index: number]: any
    • Optional from: number

      An optional starting index to slice the list.

    Returns any[]

CNAME

  • CNAME(obj: any, deep?: boolean): string
  • Retrieves the constructor name of an Object.

    Parameters

    • obj: any

      Any Object.

    • Optional deep: boolean

      If true; attempts to retrieve the instance name of the Object.

    Returns string

TYPE

  • TYPE(obj: any, typ: any): boolean
  • Determines if an Object is of a specified type.

    Parameters

    • obj: any

      Any Object.

    • typ: any

      An Object to compare.

    Returns boolean

OF

  • OF(val: any): string
  • Retrieves the specific type of Object the argument is.

    Parameters

    • val: any

      Any Object.

    Returns string

EXTEND

  • EXTEND<T>(sup: any, base: T, handlers: EHANDLERS<T>): T
  • A factory that creates a Proxied Class.

    Type parameters

    • T

    Parameters

    • sup: any

      The parent class.

    • base: T

      The class to extend.

    • handlers: EHANDLERS<T>

      The proxy handler functions.

    Returns T

    The new proxied class.

HIDDEN

  • HIDDEN(value: any, isGetSet?: boolean): HPropDesc
  • Creates a PropertyDescriptor that will hide the specified Property.

    Parameters

    • value: any

      The value associated with the property. Can be any valid JavaScript value (number, object, function, etc).

    • Optional isGetSet: boolean

      true if the properties utilizes Getters or Setters.

    Returns HPropDesc

DEFINE

  • DEFINE(proto: any, properties: PropDescrs): void
  • A short-named, wrapper for the Object.defineProperties method.

    Parameters

    • proto: any

      Any extendable Object.

    • properties: PropDescrs

      A collection Property Descriptor

    Returns void

NIL

  • NIL(val: any): boolean
  • Determines if a value is null or undefined.

    Parameters

    • val: any

      Any value.

    Returns boolean

UoN

  • UoN(val: any, def?: any): any
  • Determines if a value is null or undefined, and optionally coalesces a default-value.

    Parameters

    • val: any

      Any value.

    • Optional def: any

      An optional default value.

    Returns any

    A boolean, if def isn't defined; otherwise, the default-value.

IaN

  • IaN(val: any): boolean
  • Determines if a value is truly not a number.

    Parameters

    • val: any

    Returns boolean

ISS

  • ISS(arg: any): "null" | "date" | "email" | "socket" | "image" | "boolean" | "string" | "raw" | "number" | "numeric" | "function" | "symbol" | "array" | "object"
  • Determines the type of a value:.

    Parameters

    • arg: any

      Any value.

    Returns "null" | "date" | "email" | "socket" | "image" | "boolean" | "string" | "raw" | "number" | "numeric" | "function" | "symbol" | "array" | "object"

IS

  • IS(arg: any): object
  • Determines the generalized type of a value, as well as those that it is not.

    Parameters

    • arg: any

      Any value.

    Returns object

    • bln: boolean
    • dte: boolean
    • txt: boolean
    • raw: boolean
    • num: boolean
    • arr: boolean
    • obj: boolean

preARGS

  • preARGS(func: function, defs: object): any
  • DEPRECATED A wrapper function that allows for default arguments.

    Parameters

    • func: function

      The callback to wrap.

        • (...args: any[]): any
        • Parameters

          • Rest ...args: any[]

          Returns any

    • defs: object

      An plain-object representing the arguments and their defaults.

      • [argName: string]: any

    Returns any

    The result of the function; if any.

TOP

  • TOP<T>(arr: T[], by: function, dsc?: boolean): any
  • Determines the "top"/"bottom" value of an Array given specified criteria.

    Type parameters

    • T

    Parameters

    • arr: T[]

      An Array of a specific type.

    • by: function

      A callback that yields the property/value of the items to compare during the sort.

        • (item: T): any
        • Parameters

          • item: T

          Returns any

    • Optional dsc: boolean

      If true; finds the "bottom" value.

    Returns any

FromJS

  • FromJS<T>(js: T): T extends { [prop: string]: any; } ? any : T extends any[] ? any : T
  • Converts a JS iterable into an ordered, ImmutableJS object (or just the value, if not an iterable).

    Type parameters

    • T

    Parameters

    • js: T

      Any JS object

    Returns T extends { [prop: string]: any; } ? any : T extends any[] ? any : T

SetSettings

  • Registers your custom App settings.

    Parameters

    • settings: Settings

      Your custom settings, imported ./config/settings.cfg.js.

    Returns void