We have moved to separately published packages from within a monorepo. Please update any bookmarks to point to the new repo.
NOTE: This package is being split into 3 packages:
@terminus/fe-utilities
@terminus/fe-jwt
@terminus/testing
See GetTerminus/terminus-oss#217 for full migration notes.
A collection of tools and utilities for Terminus applications.
Table of Contents
Install the library and required dependencies:
# Primary dependencies:
$ yarn add @terminus/ngx-tools
# Peer dependencies that need to be installed (you will likely already have some of these installed):
$ yarn add @angular/{core,common,forms,platform-browser} @ngrx/{effects,store} rxjs typescript@~3.4.5
Then import your item from the associated endpoint: import { debounce } from '@terminus/ngx-tools/utilities';
You can play with the library live on StackBlitz: https://stackblitz.com/github/GetTerminus/ngx-tools
Import location | Description | Docs | Size |
---|---|---|---|
@terminus/ngx-tools/browser |
Helpers to deal directly with browsers (TsCookieService ..) |
π | |
@terminus/ngx-tools/coercion |
Functions to coerce values to specific types (Array ..) |
π | |
@terminus/ngx-tools/jwt |
Utilities for dealing with JWT tokens (TokenEscalator ..) |
π | |
@terminus/ngx-tools/keycodes |
Constants for commonly needed key codes (ESC ..) |
π | |
@terminus/ngx-tools/regex |
Regex definitions (creditCardRegex ..) |
π | |
@terminus/ngx-tools/testing |
Test helpers and test mocks (dispatchFakeEvent ..) |
π | |
@terminus/ngx-tools/type-guards |
TypeScript type guards (isSet , isArray ..) |
π | |
@terminus/ngx-tools/utilities |
Basic utilities (debounce , groupBy ..) |
π |
Import from: @terminus/ngx-tools/browser
// Example usage:
import { TsCookieService } from '@terminus/ngx-tools/browser';
...
this.cookieService.set('myName', 'myValue'); // Sets a cookie
Import from: @terminus/ngx-tools/coercion
// Example usage:
import { coerceBooleanProperty } from '@terminus/ngx-tools/coercion';
coerceBooleanProperty('true'); // Returns: true
Store, escalate, renew and use a named set of JWT tokens with ease!
Import from: @terminus/ngx-tools/keycodes
// Example usage:
import { KEYS } from '@terminus/ngx-tools/keycodes';
import { dispatchKeyboardEvent } from '@terminus/ngx-tools/testing';
KEYS.ENTER.code // 'Enter'
KEYS.ENTER.keyCode // 13
// Example usage:
dispatchKeyboardEvent(myElementRef, KEYS.ENTER.keycode);
Import from: @terminus/ngx-tools/regex
// Example usage:
import { emailRegex } from '@terminus/ngx-tools/regex';
emailRegex.test('foo@bar.com'); // Returns: true
Import from: @terminus/ngx-tools/testing
// Example usage:
import { dispatchFakeEvent } from '@terminus/ngx-tools/testing';
dispatchFakeEvent(window, 'resize');
Import from: @terminus/ngx-tools/type-guards
π Type Guards Documentation
// Example usage:
import { arrayHasAllElementsSet } from '@terminus/ngx-tools/type-guards';
arrayHasAllElementsSet<string>(['foo', 'bar']) // Returns: true
arrayHasAllElementsSet<number>([1, 'bar']) // Returns: false
Import from: @terminus/ngx-tools/utilities
// Example usage:
import { groupBy } from '@terminus/ngx-tools/utilites';
groupBy<MyObj, keyof MyObj>(myArray, 'a');
See the development workflow for the @terminus/ui
library: Terminus Library Contribution Docs
Thanks goes to these wonderful people (emoji key):
Benjamin Charity π» π§ π€ π π¬ π π‘ π π§ π |
Brian Malinconico π» π€ |
Wendy π» π |
shani-terminus π π» π π§ |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
Command | Function |
---|---|
build |
Build release |
test |
Run unit tests |
test:ci:local |
Run all unit tests and output coverage |
start:app |
Start demo project |
lint |
Lint all library files and attempt to fix issues |
lint:ci |
Lint all library files |
docs:toc |
Update the Table of Contents in all files |
cm |
Commit with commitizen cli |
See package.json for the full list of available commands.