@hexxag0nal/ts-utils-collection v0.1.6
ts-utils-collection
A handy collection of helper/utils classes, objects, definitions and more
Documentation
- @hexxag0nal/ts-utils-collection
- Classes
- Enums
- Interfaces
- Modules
- Module: definitions/events/jquery.event
- Module: definitions/functions
- Module: helpers/css.helper
- Module: helpers/html.helper
- Module: helpers/object.helper
- Module: helpers/string.helper
- Module: helpers/type.helper
- Module: objects/browser/browser.helper
- Module: objects/browser/local-storage/local-storage/local-storage
- Module: objects/browser/route/route
- Module: prototype-extensions/iprototype-extension
- Module: prototype-extensions/object.prototype-extension
- Module: prototype-extensions/string.prototype-extension
@hexxag0nal/ts-utils-collection
@hexxag0nal/ts-utils-collection
Table of contents
Modules
- definitions/events/jquery.event
- definitions/events/jquery.event
- definitions/functions
- helpers/css.helper
- helpers/html.helper
- helpers/object.helper
- helpers/string.helper
- helpers/type.helper
- objects/browser/browser.helper
- objects/browser/browser.helper
- objects/browser/local-storage/local-storage/local-storage
- objects/browser/local-storage/local-storage/local-storage
- objects/browser/local-storage/local-storage/local-storage
- objects/browser/local-storage/local-storage/local-storage
- objects/browser/route/route
- objects/browser/route/route
- objects/browser/route/route
- prototype-extensions/iprototype-extension
- prototype-extensions/object.prototype-extension
- prototype-extensions/string.prototype-extension
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
Methods
getUrlFromProperty
▸ Static
getUrlFromProperty(e
, property
): null
| string
Parameters
Name | Type |
---|---|
e | HTMLElement |
property | BACKGROUND_IMAGE |
Returns
null
| string
Defined in
@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
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
createButton
▸ Static
createButton(text
, title
, onClick?
): HTMLButtonElement
Parameters
Name | Type |
---|---|
text | string |
title | string |
onClick? | NullFunction |
Returns
HTMLButtonElement
Defined in
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
getElement
▸ Static
getElement<T
>(query
): T
Type parameters
Name | Type |
---|---|
T | extends HTMLElement = HTMLElement |
Parameters
Name | Type |
---|---|
query | string |
Returns
T
Defined in
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
getElements
▸ Static
getElements<T
>(query
): T
[]
Type parameters
Name | Type |
---|---|
T | extends HTMLElement = HTMLElement |
Parameters
Name | Type |
---|---|
query | string |
Returns
T
[]
Defined in
@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
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
Methods
ensureNotNull
▸ Static
ensureNotNull(...objects
): void
Parameters
Name | Type |
---|---|
...objects | Object [] |
Returns
void
Defined in
ensureNotNullImpl
▸ Static
Private
ensureNotNullImpl(obj
): void
Parameters
Name | Type |
---|---|
obj | Object |
Returns
void
Defined in
@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
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
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
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
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
isEmpty
▪ Static
isEmpty: (s
: string
) => boolean
Type declaration
▸ (s
): boolean
Parameters
Name | Type |
---|---|
s | string |
Returns
boolean
Defined in
isFirstChar
▪ Static
isFirstChar: (s
: string
, c
: string
) => boolean
Type declaration
▸ (s
, c
): boolean
Parameters
Name | Type |
---|---|
s | string |
c | string |
Returns
boolean
Defined in
isLastChar
▪ Static
isLastChar: (s
: string
, c
: string
) => boolean
Type declaration
▸ (s
, c
): boolean
Parameters
Name | Type |
---|---|
s | string |
c | string |
Returns
boolean
Defined in
prepend
▪ Static
prepend: (s
: string
, prependix
: string
) => string
Type declaration
▸ (s
, prependix
): string
Parameters
Name | Type |
---|---|
s | string |
prependix | string |
Returns
string
Defined in
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
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
Methods
isBlank
▸ Static
isBlank(s
): boolean
Parameters
Name | Type |
---|---|
s | string |
Returns
boolean
Defined in
isNotBlank
▸ Static
isNotBlank(s
): boolean
Parameters
Name | Type |
---|---|
s | string |
Returns
boolean
Defined in
isNumber
▸ Static
isNumber(s
): boolean
Parameters
Name | Type |
---|---|
s | string |
Returns
boolean
Defined in
isString
▸ Static
isString(s
, avoidNumber?
): boolean
Parameters
Name | Type | Default value |
---|---|---|
s | any | undefined |
avoidNumber | boolean | false |
Returns
boolean
Defined in
@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
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
@hexxag0nal/ts-utils-collection / objects/browser/browser.helper / BrowserHelper
Class: BrowserHelper
objects/browser/browser.helper.BrowserHelper
Table of contents
Constructors
Methods
- getCurrentUrlParams
- getFromLocalStorage
- getFromLocalStorageByPrefix
- getPath
- redirect
- reload
- removeElementIfExists
- saveToLocalStorage
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
- activate
- append
- concatImpl
- createRouteString
- getLevel
- getLevelCount
- getUrlSearchParams
- goTo
- goUp
- matches
- setUrlSearchParams
- toString
- fromCurrentRoute
- fromRelativeToDomain
- fromString
- getPathInBrowser
- goTo
- processPathString
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
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
Defined in
objects/browser/route/route.ts:30
fromRelativeToDomain
▸ Static
fromRelativeToDomain(path
): Route
Parameters
Name | Type |
---|---|
path | string |
Returns
Defined in
objects/browser/route/route.ts:16
fromString
▸ Static
fromString(s
): Route
Parameters
Name | Type |
---|---|
s | string |
Returns
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
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
@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
@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
@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
@hexxag0nal/ts-utils-collection / definitions/functions / NullFunction
Interface: NullFunction
definitions/functions.NullFunction
Callable
NullFunction
▸ NullFunction(): void
Returns
void
Defined in
@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
@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
data
• Optional
data: Object
Index signature
▪ key: string
: string
Defined in
href
• Optional
href: string
Defined in
innerHtml
• Optional
innerHtml: string
Defined in
onClick
• Optional
onClick: CLICKF
Defined in
title
• Optional
title: string
Defined in
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