0.1.6 • Published 3 years ago

@hexxag0nal/ts-utils-collection v0.1.6

Weekly downloads
-
License
CC-BY-SA-4.0
Repository
github
Last release
3 years ago

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
NameType
eHTMLElement
propertyBACKGROUND_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
NameTypeDefault value
elementHTMLElementundefined
handlerNullFunctionundefined
keepOldHandlerbooleantrue
Returns

void

Defined in

helpers/html.helper.ts:32


createButton

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

Parameters
NameType
textstring
titlestring
onClick?NullFunction
Returns

HTMLButtonElement

Defined in

helpers/html.helper.ts:19


createElement

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

Type parameters
NameType
Textends HTMLElement = HTMLElement
Parameters
NameType
tagstring
options?ICreateElementOptions<NullFunction>
Returns

T

Defined in

helpers/html.helper.ts:53


getElement

Static getElement<T>(query): T

Type parameters
NameType
Textends HTMLElement = HTMLElement
Parameters
NameType
querystring
Returns

T

Defined in

helpers/html.helper.ts:45


getElementAsync

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

Type parameters
NameType
Textends HTMLElement = HTMLElement
Parameters
NameType
querystring
Returns

Promise<T>

Defined in

helpers/html.helper.ts:93


getElements

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

Type parameters
NameType
Textends HTMLElement = HTMLElement
Parameters
NameType
querystring
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
NameType
objObject
propstring
...otherPropsstring[]
Returns

boolean

Defined in

helpers/object.helper.ts:18

Methods

ensureNotNull

Static ensureNotNull(...objects): void

Parameters
NameType
...objectsObject[]
Returns

void

Defined in

helpers/object.helper.ts:6


ensureNotNullImpl

Static Private ensureNotNullImpl(obj): void

Parameters
NameType
objObject
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
NameType
sstring
appendixstring
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
NameType
sstring
appendixstring
predicateboolean
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
NameType
sstring
appendixstring
infixstring
predicateboolean
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
NameType
sstring
otherStringstring
...otherStringsstring[]
Returns

boolean

Defined in

helpers/string.helper.ts:14


isEmpty

Static isEmpty: (s: string) => boolean

Type declaration

▸ (s): boolean

Parameters
NameType
sstring
Returns

boolean

Defined in

helpers/string.helper.ts:29


isFirstChar

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

Type declaration

▸ (s, c): boolean

Parameters
NameType
sstring
cstring
Returns

boolean

Defined in

helpers/string.helper.ts:10


isLastChar

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

Type declaration

▸ (s, c): boolean

Parameters
NameType
sstring
cstring
Returns

boolean

Defined in

helpers/string.helper.ts:6


prepend

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

Type declaration

▸ (s, prependix): string

Parameters
NameType
sstring
prependixstring
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
NameType
sstring
prependixstring
predicateboolean
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
NameType
sstring
atBeginningnull | number
atEndnull | number
Returns

string

Defined in

helpers/string.helper.ts:53

Methods

isBlank

Static isBlank(s): boolean

Parameters
NameType
sstring
Returns

boolean

Defined in

helpers/string.helper.ts:64


isNotBlank

Static isNotBlank(s): boolean

Parameters
NameType
sstring
Returns

boolean

Defined in

helpers/string.helper.ts:69


isNumber

Static isNumber(s): boolean

Parameters
NameType
sstring
Returns

boolean

Defined in

helpers/string.helper.ts:73


isString

Static isString(s, avoidNumber?): boolean

Parameters
NameTypeDefault value
sanyundefined
avoidNumberbooleanfalse
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
NameTypeDescription
typeanyVariable 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
NameType
keystring
Returns

string

Defined in

objects/browser/browser.helper.ts:24


getFromLocalStorageByPrefix

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

Parameters
NameType
prefixstring
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
NameType
urlstring
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
NameType
eHTMLElement
Returns

void

Defined in

objects/browser/browser.helper.ts:66


saveToLocalStorage

Static saveToLocalStorage(key, value): void

Parameters
NameType
keystring
valuestring | 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
NameType
prefixstring
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
NameType
pathSectionsstring[]
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
NameType
otherRoutestring | Route
Returns

Route

Defined in

objects/browser/route/route.ts:89


concatImpl

Private concatImpl(sections): string

Parameters
NameType
sectionsstring[]
Returns

string

Defined in

objects/browser/route/route.ts:101


createRouteString

Private createRouteString(sections): string

Parameters
NameType
sectionsstring[]
Returns

string

Defined in

objects/browser/route/route.ts:77


getLevel

getLevel(level): null | string

Return NULL if given level does not exist

Parameters
NameType
levelnumber
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
NameType
levelsToGoUpnumber
Returns

null | Route

Defined in

objects/browser/route/route.ts:81


matches

matches(otherRoute): boolean

Parameters
NameType
otherRouteRoute
Returns

boolean

Defined in

objects/browser/route/route.ts:45


setUrlSearchParams

setUrlSearchParams(params): void

Parameters
NameType
paramsURLSearchParams
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
NameType
pathstring
Returns

Route

Defined in

objects/browser/route/route.ts:16


fromString

Static fromString(s): Route

Parameters
NameType
sstring
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
NameTypeDescription
routeRouteThe route to go to
urlParams?URLSearchParamsIf 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
NameType
pathstring
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
NameType
param1A
param2B
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
NameType
param1A
param2B
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
NameType
paramA
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
NameType
paramA
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

NameType
CLICKFNullFunction

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

0.1.4

3 years ago

0.1.3

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago