@hexxag0nal/ts-utils-collection

0.1.6 • Public • Published

ts-utils-collection

A handy collection of helper/utils classes, objects, definitions and more

Documentation

@hexxag0nal/ts-utils-collection

@hexxag0nal/ts-utils-collection

Table of contents

Modules

Classes

@hexxag0nal/ts-utils-collection / definitions/events/jquery.event / JqueryEvents

Class: JqueryEvents

definitions/events/jquery.event.JqueryEvents

Table of contents

Constructors

Properties

Constructors

constructor

new JqueryEvents()

Properties

CLICK

Static Readonly CLICK: "click"

Defined in

definitions/events/jquery.event.ts:3

@hexxag0nal/ts-utils-collection / helpers/css.helper / CssHelper

Class: CssHelper

helpers/css.helper.CssHelper

Table of contents

Constructors

Methods

Constructors

constructor

Private new CssHelper()

Defined in

helpers/css.helper.ts:6

Methods

getUrlFromProperty

Static getUrlFromProperty(e, property): null | string

Parameters
Name Type
e HTMLElement
property BACKGROUND_IMAGE
Returns

null | string

Defined in

helpers/css.helper.ts:9

@hexxag0nal/ts-utils-collection / helpers/html.helper / HtmlHelper

Class: HtmlHelper

helpers/html.helper.HtmlHelper

Table of contents

Constructors

Methods

Constructors

constructor

Private new HtmlHelper()

Defined in

helpers/html.helper.ts:16

Methods

addClickHandler

Static addClickHandler(element, handler, keepOldHandler?): void

Parameters
Name Type Default value
element HTMLElement undefined
handler NullFunction undefined
keepOldHandler boolean true
Returns

void

Defined in

helpers/html.helper.ts:32


createButton

Static createButton(text, title, onClick?): HTMLButtonElement

Parameters
Name Type
text string
title string
onClick? NullFunction
Returns

HTMLButtonElement

Defined in

helpers/html.helper.ts:19


createElement

Static createElement<T>(tag, options?): T

Type parameters
Name Type
T extends HTMLElement = HTMLElement
Parameters
Name Type
tag string
options? ICreateElementOptions<NullFunction>
Returns

T

Defined in

helpers/html.helper.ts:53


getElement

Static getElement<T>(query): T

Type parameters
Name Type
T extends HTMLElement = HTMLElement
Parameters
Name Type
query string
Returns

T

Defined in

helpers/html.helper.ts:45


getElementAsync

Static getElementAsync<T>(query): Promise<T>

Type parameters
Name Type
T extends HTMLElement = HTMLElement
Parameters
Name Type
query string
Returns

Promise<T>

Defined in

helpers/html.helper.ts:93


getElements

Static getElements<T>(query): T[]

Type parameters
Name Type
T extends HTMLElement = HTMLElement
Parameters
Name Type
query string
Returns

T[]

Defined in

helpers/html.helper.ts:49

@hexxag0nal/ts-utils-collection / helpers/object.helper / ObjectHelper

Class: ObjectHelper

helpers/object.helper.ObjectHelper

Table of contents

Constructors

Properties

Methods

Constructors

constructor

Private new ObjectHelper()

Defined in

helpers/object.helper.ts:2

Properties

hasProperties

Static hasProperties: (obj: Object, prop: string, ...otherProps: string[]) => boolean

Type declaration

▸ (obj, prop, ...otherProps): boolean

Parameters
Name Type
obj Object
prop string
...otherProps string[]
Returns

boolean

Defined in

helpers/object.helper.ts:18

Methods

ensureNotNull

Static ensureNotNull(...objects): void

Parameters
Name Type
...objects Object[]
Returns

void

Defined in

helpers/object.helper.ts:6


ensureNotNullImpl

Static Private ensureNotNullImpl(obj): void

Parameters
Name Type
obj Object
Returns

void

Defined in

helpers/object.helper.ts:12

@hexxag0nal/ts-utils-collection / helpers/string.helper / StringHelper

Class: StringHelper

helpers/string.helper.StringHelper

Table of contents

Constructors

Properties

Methods

Constructors

constructor

Private new StringHelper()

Defined in

helpers/string.helper.ts:2

Properties

append

Static append: (s: string, appendix: string) => string

Type declaration

▸ (s, appendix): string

Parameters
Name Type
s string
appendix string
Returns

string

Defined in

helpers/string.helper.ts:33


appendIf

Static appendIf: (s: string, appendix: string, predicate: boolean) => string

Type declaration

▸ (s, appendix, predicate): string

Parameters
Name Type
s string
appendix string
predicate boolean
Returns

string

Defined in

helpers/string.helper.ts:41


appendWithInfixIf

Static appendWithInfixIf: (s: string, appendix: string, infix: string, predicate: boolean) => string

Type declaration

▸ (s, appendix, infix, predicate): string

Parameters
Name Type
s string
appendix string
infix string
predicate boolean
Returns

string

Defined in

helpers/string.helper.ts:49


equals

Static equals: (s: string, otherString: string, ...otherStrings: string[]) => boolean

Type declaration

▸ (s, otherString, ...otherStrings): boolean

Parameters
Name Type
s string
otherString string
...otherStrings string[]
Returns

boolean

Defined in

helpers/string.helper.ts:14


isEmpty

Static isEmpty: (s: string) => boolean

Type declaration

▸ (s): boolean

Parameters
Name Type
s string
Returns

boolean

Defined in

helpers/string.helper.ts:29


isFirstChar

Static isFirstChar: (s: string, c: string) => boolean

Type declaration

▸ (s, c): boolean

Parameters
Name Type
s string
c string
Returns

boolean

Defined in

helpers/string.helper.ts:10


isLastChar

Static isLastChar: (s: string, c: string) => boolean

Type declaration

▸ (s, c): boolean

Parameters
Name Type
s string
c string
Returns

boolean

Defined in

helpers/string.helper.ts:6


prepend

Static prepend: (s: string, prependix: string) => string

Type declaration

▸ (s, prependix): string

Parameters
Name Type
s string
prependix string
Returns

string

Defined in

helpers/string.helper.ts:37


prependIf

Static prependIf: (s: string, prependix: string, predicate: boolean) => string

Type declaration

▸ (s, prependix, predicate): string

Parameters
Name Type
s string
prependix string
predicate boolean
Returns

string

Defined in

helpers/string.helper.ts:45


removeChars

Static removeChars: (s: string, atBeginning: null | number, atEnd: null | number) => string

Type declaration

▸ (s, atBeginning, atEnd): string

Parameters
Name Type
s string
atBeginning null | number
atEnd null | number
Returns

string

Defined in

helpers/string.helper.ts:53

Methods

isBlank

Static isBlank(s): boolean

Parameters
Name Type
s string
Returns

boolean

Defined in

helpers/string.helper.ts:64


isNotBlank

Static isNotBlank(s): boolean

Parameters
Name Type
s string
Returns

boolean

Defined in

helpers/string.helper.ts:69


isNumber

Static isNumber(s): boolean

Parameters
Name Type
s string
Returns

boolean

Defined in

helpers/string.helper.ts:73


isString

Static isString(s, avoidNumber?): boolean

Parameters
Name Type Default value
s any undefined
avoidNumber boolean false
Returns

boolean

Defined in

helpers/string.helper.ts:77

@hexxag0nal/ts-utils-collection / helpers/type.helper / TypeHelper

Class: TypeHelper

helpers/type.helper.TypeHelper

Table of contents

Constructors

Methods

Constructors

constructor

Private new TypeHelper()

Defined in

helpers/type.helper.ts:2

Methods

isString

Static isString(type): boolean

Checks if the given variable is a string

Parameters
Name Type Description
type any Variable to check
Returns

boolean

Defined in

helpers/type.helper.ts:9

@hexxag0nal/ts-utils-collection / objects/browser/browser.helper / BrowserHelper

Class: BrowserHelper

objects/browser/browser.helper.BrowserHelper

Table of contents

Constructors

Methods

Constructors

constructor

Private new BrowserHelper()

Defined in

objects/browser/browser.helper.ts:4

Methods

getCurrentUrlParams

Static getCurrentUrlParams(): URLSearchParams

Returns

URLSearchParams

Defined in

objects/browser/browser.helper.ts:72


getFromLocalStorage

Static getFromLocalStorage(key): string

Parameters
Name Type
key string
Returns

string

Defined in

objects/browser/browser.helper.ts:24


getFromLocalStorageByPrefix

Static getFromLocalStorageByPrefix(prefix): Map<string, string>

Parameters
Name Type
prefix string
Returns

Map<string, string>

Defined in

objects/browser/browser.helper.ts:13


getPath

Static getPath(): string[]

deprecated

Returns

string[]

Defined in

objects/browser/browser.helper.ts:41


redirect

Static redirect(url, relativeToCurrent?): void

Parameters
Name Type
url string
relativeToCurrent? boolean
Returns

void

Defined in

objects/browser/browser.helper.ts:56


reload

Static reload(): void

Returns

void

Defined in

objects/browser/browser.helper.ts:52


removeElementIfExists

Static removeElementIfExists(e): void

Parameters
Name Type
e HTMLElement
Returns

void

Defined in

objects/browser/browser.helper.ts:66


saveToLocalStorage

Static saveToLocalStorage(key, value): void

Parameters
Name Type
key string
value string | Object
Returns

void

Defined in

objects/browser/browser.helper.ts:28

@hexxag0nal/ts-utils-collection / objects/browser/local-storage/local-storage/local-storage / LocalStorage

Class: LocalStorage

objects/browser/local-storage/local-storage/local-storage.LocalStorage

Table of contents

Constructors

Methods

Constructors

constructor

Private new LocalStorage()

Defined in

objects/browser/local-storage/local-storage/local-storage.ts:2

Methods

findKeysByPrefix

Static findKeysByPrefix(prefix): string[]

Parameters
Name Type
prefix string
Returns

string[]

Defined in

objects/browser/local-storage/local-storage/local-storage.ts:5

@hexxag0nal/ts-utils-collection / objects/browser/route/route / Route

Class: Route

objects/browser/route/route.Route

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Route(pathSections)

Parameters
Name Type
pathSections string[]
Defined in

objects/browser/route/route.ts:10

Properties

path

Private Readonly path: string

Defined in

objects/browser/route/route.ts:7


pathSections

Private Readonly pathSections: string[]

Defined in

objects/browser/route/route.ts:6


urlSearchParams

Private urlSearchParams: null | URLSearchParams = null

Defined in

objects/browser/route/route.ts:8


DELIMITER

Static Readonly DELIMITER: "/"

Defined in

objects/browser/route/route.ts:5

Methods

activate

activate(): void

Go to this route

Returns

void

Defined in

objects/browser/route/route.ts:132


append

append(otherRoute): Route

Parameters
Name Type
otherRoute string | Route
Returns

Route

Defined in

objects/browser/route/route.ts:89


concatImpl

Private concatImpl(sections): string

Parameters
Name Type
sections string[]
Returns

string

Defined in

objects/browser/route/route.ts:101


createRouteString

Private createRouteString(sections): string

Parameters
Name Type
sections string[]
Returns

string

Defined in

objects/browser/route/route.ts:77


getLevel

getLevel(level): null | string

Return NULL if given level does not exist

Parameters
Name Type
level number
Returns

null | string

Defined in

objects/browser/route/route.ts:65


getLevelCount

getLevelCount(): number

Returns

number

Defined in

objects/browser/route/route.ts:57


getUrlSearchParams

getUrlSearchParams(): null | URLSearchParams

Returns

null | URLSearchParams

Defined in

objects/browser/route/route.ts:143


goTo

goTo(): void

Alias for activate

Returns

void

Defined in

objects/browser/route/route.ts:139


goUp

goUp(levelsToGoUp): null | Route

Parameters
Name Type
levelsToGoUp number
Returns

null | Route

Defined in

objects/browser/route/route.ts:81


matches

matches(otherRoute): boolean

Parameters
Name Type
otherRoute Route
Returns

boolean

Defined in

objects/browser/route/route.ts:45


setUrlSearchParams

setUrlSearchParams(params): void

Parameters
Name Type
params URLSearchParams
Returns

void

Defined in

objects/browser/route/route.ts:147


toString

toString(): string

Returns

string

Defined in

objects/browser/route/route.ts:73


fromCurrentRoute

Static fromCurrentRoute(): Route

Returns

Route

Defined in

objects/browser/route/route.ts:30


fromRelativeToDomain

Static fromRelativeToDomain(path): Route

Parameters
Name Type
path string
Returns

Route

Defined in

objects/browser/route/route.ts:16


fromString

Static fromString(s): Route

Parameters
Name Type
s string
Returns

Route

Defined in

objects/browser/route/route.ts:105


getPathInBrowser

Static Private getPathInBrowser(): string[]

Returns

string[]

Defined in

objects/browser/route/route.ts:34


goTo

Static goTo(route, urlParams?): void

Parameters
Name Type Description
route Route The route to go to
urlParams? URLSearchParams If provided, it will be used instead of the url params that are on the route object
Returns

void

Defined in

objects/browser/route/route.ts:113


processPathString

Static Private processPathString(path): string[]

Parameters
Name Type
path string
Returns

string[]

Defined in

objects/browser/route/route.ts:20

@hexxag0nal/ts-utils-collection / prototype-extensions/iprototype-extension / IPrototypeExtension

Class: IPrototypeExtension

prototype-extensions/iprototype-extension.IPrototypeExtension

Implemented by

Table of contents

Constructors

Methods

Constructors

constructor

new IPrototypeExtension()

Methods

extendAll

Static extendAll(): void

Returns

void

Defined in

prototype-extensions/iprototype-extension.ts:5

@hexxag0nal/ts-utils-collection / prototype-extensions/object.prototype-extension / ObjectPrototypeExtension

Class: ObjectPrototypeExtension

prototype-extensions/object.prototype-extension.ObjectPrototypeExtension

Implements

Table of contents

Constructors

Methods

Constructors

constructor

new ObjectPrototypeExtension()

Methods

extend

Static extend(): void

Returns

void

Defined in

prototype-extensions/object.prototype-extension.ts:10

@hexxag0nal/ts-utils-collection / prototype-extensions/string.prototype-extension / StringPrototypeExtension

Class: StringPrototypeExtension

prototype-extensions/string.prototype-extension.StringPrototypeExtension

Implements

Table of contents

Constructors

Methods

Constructors

constructor

new StringPrototypeExtension()

Methods

extend

Static extend(): void

Returns

void

Defined in

prototype-extensions/string.prototype-extension.ts:66

Enums

@hexxag0nal/ts-utils-collection / helpers/css.helper / PropertyWithUrl

Enumeration: PropertyWithUrl

helpers/css.helper.PropertyWithUrl

Table of contents

Enumeration members

Enumeration members

BACKGROUND_IMAGE

BACKGROUND_IMAGE = 0

Defined in

helpers/css.helper.ts:2

Interfaces

@hexxag0nal/ts-utils-collection / definitions/functions / BiFunction

Interface: BiFunction<A, B, C>

definitions/functions.BiFunction

Type parameters

Name
A
B
C

Callable

BiFunction

BiFunction(param1, param2): C

Parameters
Name Type
param1 A
param2 B
Returns

C

Defined in

definitions/functions.ts:18

@hexxag0nal/ts-utils-collection / definitions/functions / BiFunctionNoReturn

Interface: BiFunctionNoReturn<A, B>

definitions/functions.BiFunctionNoReturn

Type parameters

Name
A
B

Callable

BiFunctionNoReturn

BiFunctionNoReturn(param1, param2): void

Parameters
Name Type
param1 A
param2 B
Returns

void

Defined in

definitions/functions.ts:22

@hexxag0nal/ts-utils-collection / definitions/functions / MonoFunction

Interface: MonoFunction<A, B>

definitions/functions.MonoFunction

Type parameters

Name
A
B

Callable

MonoFunction

MonoFunction(param): B

Parameters
Name Type
param A
Returns

B

Defined in

definitions/functions.ts:10

@hexxag0nal/ts-utils-collection / definitions/functions / MonoFunctionNoReturn

Interface: MonoFunctionNoReturn<A>

definitions/functions.MonoFunctionNoReturn

Type parameters

Name
A

Callable

MonoFunctionNoReturn

MonoFunctionNoReturn(param): void

Parameters
Name Type
param A
Returns

void

Defined in

definitions/functions.ts:14

@hexxag0nal/ts-utils-collection / definitions/functions / NullFunction

Interface: NullFunction

definitions/functions.NullFunction

Callable

NullFunction

NullFunction(): void

Returns

void

Defined in

definitions/functions.ts:6

@hexxag0nal/ts-utils-collection / definitions/functions / ReturnFunction

Interface: ReturnFunction<R>

definitions/functions.ReturnFunction

Type parameters

Name
R

Callable

ReturnFunction

ReturnFunction(): R

Returns

R

Defined in

definitions/functions.ts:2

@hexxag0nal/ts-utils-collection / helpers/html.helper / ICreateElementOptions

Interface: ICreateElementOptions<CLICKF>

helpers/html.helper.ICreateElementOptions

Type parameters

Name Type
CLICKF NullFunction

Table of contents

Properties

Properties

class

Optional class: string | string[]

Defined in

helpers/html.helper.ts:5


data

Optional data: Object

Index signature

[key: string]: string

Defined in

helpers/html.helper.ts:10


href

Optional href: string

Defined in

helpers/html.helper.ts:9


innerHtml

Optional innerHtml: string

Defined in

helpers/html.helper.ts:6


onClick

Optional onClick: CLICKF

Defined in

helpers/html.helper.ts:8


title

Optional title: string

Defined in

helpers/html.helper.ts:7

Modules

@hexxag0nal/ts-utils-collection / definitions/events/jquery.event

Module: definitions/events/jquery.event

Table of contents

References

References

JqueryEvents

Re-exports JqueryEvents

@hexxag0nal/ts-utils-collection / definitions/functions

Module: definitions/functions

Table of contents

Interfaces

@hexxag0nal/ts-utils-collection / helpers/css.helper

Module: helpers/css.helper

Table of contents

Enumerations

Classes

@hexxag0nal/ts-utils-collection / helpers/html.helper

Module: helpers/html.helper

Table of contents

Classes

Interfaces

@hexxag0nal/ts-utils-collection / helpers/object.helper

Module: helpers/object.helper

Table of contents

Classes

@hexxag0nal/ts-utils-collection / helpers/string.helper

Module: helpers/string.helper

Table of contents

Classes

@hexxag0nal/ts-utils-collection / helpers/type.helper

Module: helpers/type.helper

Table of contents

Classes

@hexxag0nal/ts-utils-collection / objects/browser/browser.helper

Module: objects/browser/browser.helper

Table of contents

References

References

BrowserHelper

Re-exports BrowserHelper

@hexxag0nal/ts-utils-collection / objects/browser/local-storage/local-storage/local-storage

Module: objects/browser/local-storage/local-storage/local-storage

Table of contents

References

References

LocalStorage

Re-exports LocalStorage

@hexxag0nal/ts-utils-collection / objects/browser/route/route

Module: objects/browser/route/route

Table of contents

References

References

Route

Re-exports Route

@hexxag0nal/ts-utils-collection / prototype-extensions/iprototype-extension

Module: prototype-extensions/iprototype-extension

Table of contents

Classes

@hexxag0nal/ts-utils-collection / prototype-extensions/object.prototype-extension

Module: prototype-extensions/object.prototype-extension

Table of contents

Classes

@hexxag0nal/ts-utils-collection / prototype-extensions/string.prototype-extension

Module: prototype-extensions/string.prototype-extension

Table of contents

Classes

Note of thanks

Thanks to Chidume Nnamdi for providing an easy tutorial for the basic steps

Package Sidebar

Install

npm i @hexxag0nal/ts-utils-collection

Weekly Downloads

0

Version

0.1.6

License

CC-BY-SA-4.0

Unpacked Size

73.5 kB

Total Files

28

Last publish

Collaborators

  • hexxag0n