Utils
nge/utils is a set of pure functions with no Angular dependency, so you can use them anywhere.
import { deepEqual, shortDate, colorContrast } from '@cisstech/nge/utils'
deepEqual({ a: 1 }, { a: 1 }) // trueWhat is available
- Colors:
rgbFromHex,rgbToHex,colorContrast(readable foreground for a background),colorTint,colorShade. - Dates:
epoch,addDays,timestamp,toTimestamp,dateFromTimestamp,fullDate,shortDate,hours,isToday,compareDays,convertDate,weeksDiff,dateRangeOverlaps. - Strings:
isNullOrEmpty,anyNullOrEmpty,isURL,hashCode. - Comparison and copy:
deepEqual,deepCopy. - Contracts:
ensures,ensuresNonNull,ensuresNonNullArray,ensuresNonNullStringfor runtime assertions that also narrow the type. - File types:
extensionOf,isImage,isPdf,isText,isWordDoc,isExcelDoc,isPowerPointDoc. - Builder: the
Builder<T>class with the@Entityand@Propertydecorators for building typed objects.