@zionapps/core
v1.0.6
Published
Helper Methods for Angular, Ionic and NgRx projects.
Downloads
92
Readme
@zionapps/core
Helper Methods for Angular, Ionic, NgRx or any TypeScript projects. This library is designed to prevent bugs from null
and undefined
variables and properties in runtime. Key areas of use include, but are not limited to:
- NgRx selectors
- Utility functions
npm install @zionapps/core --save
Contents
- Constants
- Identity
- Comparison
- Sanitize
- Transform
- Get
- Sort
- Filter
- Count
- Time
1. Constants
export const DEFAULT_COUNT = 0;
export const DEFAULT_ID = null;
export const DEFAULT_GUID = null;
export const DEFAULT_GUID_LENGTH = 36;
export const DEFAULT_NUMBER = 0;
export const DEFAULT_STRING = '';
export const MINIMUM_COUNT = 0;
export const MINIMUM_ID = 1;
// Time
export const HOURS_PER_DAY = 24;
export const MILLISECONDS = 1000;
export const MINUTES_PER_HOUR = 60;
export const SECONDS_PER_MINUTE = 60;
2. Identity
| | Item | Object | List | | :---------------------- | :-----: | :-----: | :-----: | | hasAllItemsInList | | | ✓ | | hasAllQueryValuesInList | | | ✓ | | hasAnyItems | | | ✓ | | hasItemInList | | | ✓ | | hasNoItems | | | ✓ | | hasQueryValueInList | | | ✓ | | hasUrl | ✓ | | | | isArray | ✓ | | | | isBoolean | ✓ | | | | isCount | ✓ | | | | isGuid | ✓ | | | | isId | ✓ | | | | isIframe | ✓ | | | | isIframeUrlMatching | ✓ | | | | isNumber | ✓ | | | | isObject | ✓ | | | | isString | ✓ | | | | isUrl | ✓ | | | | isUrlMatching | ✓ | | | | isItemDefined | ✓ | ✓ | ✓ | | isItemNotDefined | ✓ | ✓ | ✓ | | isPropertyDefined | | ✓ | |
3. Comparison Functions
| | Item | Object | List | | :------------------------- | :-----: | :-----: | :-----: | | caseInsensitiveEquals | ✓ | | | | caseInsensitiveIncludes | ✓ | | | | caseInsensitiveStartsWith | ✓ | | | | startsWith | ✓ | | |
4. Sanitize Functions
| | Item | Object | List | | :------------------ | :-----: | :-----: | :-----: | | sanitizeArray | | | ✓ | | sanitizeArrayList | | | ✓ | | sanitizeBoolean | ✓ | | | | sanitizeBooleanList | | | ✓ | | sanitizeCount | ✓ | | | | sanitizeCountList | | | ✓ | | sanitizeGuid | ✓ | | | | sanitizeGuidList | | | ✓ | | sanitizeId | ✓ | | | | sanitizeIdList | | | ✓ | | sanitizeList | | | ✓ | | sanitizeNumber | ✓ | | | | sanitizeNumberList | | | ✓ | | sanitizeObject | | ✓ | | | sanitizeObjectList | | | ✓ | | sanitizeString | ✓ | | | | sanitizeStringList | | | ✓ |
5. Get Functions
| | Item | Object | List | | :---------------------- | :-----: | :-----: | :-----: | | getArrayPropertyValue | | ✓ | | | getBooleanPropertyValue | | ✓ | | | getCountPropertyValue | | ✓ | | | getGuidPropertyValue | | ✓ | | | getIdPropertyValue | | ✓ | | | getNumericPropertyValue | | ✓ | | | getObjectPropertyValue | | ✓ | | | getPropertyValue | | ✓ | | | getStringPropertyValue | | ✓ | | | getSrcFromIframe | ✓ | | |
6. Transform
| | Item | Object | List | | :---------- | :-----: | :-----: | :-----: | | stringUtils | ✓ | | |
7. Sort Functions
| | Item | Object | List | | :-------------------------------- | :-----: | :-----: | :-----: | | sortNumbersAscending | | | ✓ | | sortNumbersDescending | | | ✓ | | sortStringAscending | | | ✓ | | sortNumbersDescending | | | ✓ | | sortCaseSensitiveStringAscending | | | ✓ | | sortStringDescending | | | ✓ | | sortCaseSensitiveStringDescending | | | ✓ | | sortNumberPropertyAscending | | | ✓ | | sortNumberPropertyDescending | | | ✓ | | sortStringPropertyAscending | | | ✓ | | sortStringPropertyDescending | | | ✓ |
8. Filter Functions
| | Item | Object | List | | :-------------------------------- | :-----: | :-----: | :-----: | | filterItemsEqualing | | | ✓ | | filterItemsNotEqualing | | | ✓ | | filterStringIncluding | | | ✓ | | filterPropertyEqualing | | | ✓ | | filterPropertyNotEqualing | | | ✓ |
9. Count Functions
| | Item | Object | List | | :------------------- | :-----: | :-----: | :-----: | | countItems | | | ✓ | | countPropertyValue | | | ✓ |
10. Time
| | Item | Object | List | | :------------------- | :-----: | :-----: | :-----: | | getISOTimestamp | ✓ | | |