@rr0/common
v1.1.3
Published
Common and utility classes
Downloads
30
Readme
@rr0/common
A typed library for common and utility tasks.
Installation
npm install @rr0/common --save
API
User preferences
UserPreferences
defines a type which requires a locale
property.
Key-value type
KeyValue<T>
defines a type whole all fields are of type T
.
Object utilities
ObjectUtils.isUndefined(val)
checks ifval
is strictlyundefined
.ObjectUtils.isDefined(val)
checks ifval
is strictly anything butundefined
.ObjectUtils.isUnset(val)
checks ifval
is strictlyundefined
ornull
.ObjectUtils.isSet(val)
checks ifval
is strictly anything butundefined
nornull
.ObjectUtils.asSet(val, errMsg?)
returns val as defined. If it was not, an AssertionError(errMsg) will be thrown.
String utilities
StringUtils.toString(val)
returns a string representation ofval
, enclosed in quotes ifval
is astring
.
Gender
Gender
is an enumeration to qualify things' gender.