https://github.com/rr0/common
Common and utility classes
https://github.com/rr0/common
Last synced: 5 months ago
JSON representation
Common and utility classes
- Host: GitHub
- URL: https://github.com/rr0/common
- Owner: RR0
- License: mit
- Created: 2020-11-04T20:14:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-08-03T17:34:20.000Z (11 months ago)
- Last Synced: 2025-08-03T19:16:03.431Z (11 months ago)
- Language: TypeScript
- Size: 894 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @rr0/common
[](https://app.circleci.com/pipelines/github/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` defines a type whole all fields are of type `T`.
### Object utilities
- `ObjectUtils.isUndefined(val)` checks if `val` is strictly `undefined`.
- `ObjectUtils.isDefined(val)` checks if `val` is strictly anything but `undefined`.
- `ObjectUtils.isUnset(val)` checks if `val` is strictly `undefined` or `null`.
- `ObjectUtils.isSet(val)` checks if `val` is strictly anything but `undefined` nor `null`.
- `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 of `val`, enclosed in quotes if `val` is a `string`.
### Gender
`Gender` is an enumeration to qualify things' gender.