UNPKG

cf-common-lib

Version:

Object Validators and Utilities

1,199 lines (1,180 loc) 35.5 kB
import { ɵɵdefineInjectable, Injectable, Component, NgModule, ɵstringify, Pipe, ChangeDetectorRef, NgZone } from '@angular/core'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CfUtilityService = /** @class */ (function () { function CfUtilityService() { } CfUtilityService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ CfUtilityService.ctorParameters = function () { return []; }; /** @nocollapse */ CfUtilityService.ngInjectableDef = ɵɵdefineInjectable({ factory: function CfUtilityService_Factory() { return new CfUtilityService(); }, token: CfUtilityService, providedIn: "root" }); return CfUtilityService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CfUtilityComponent = /** @class */ (function () { function CfUtilityComponent() { } /** * @return {?} */ CfUtilityComponent.prototype.ngOnInit = /** * @return {?} */ function () { }; CfUtilityComponent.decorators = [ { type: Component, args: [{ selector: 'lib-cf-utility', template: "\n <p>\n cf-utility works!\n </p>\n " }] } ]; /** @nocollapse */ CfUtilityComponent.ctorParameters = function () { return []; }; return CfUtilityComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CfUtilityModule = /** @class */ (function () { function CfUtilityModule() { } CfUtilityModule.decorators = [ { type: NgModule, args: [{ declarations: [CfUtilityComponent], imports: [], exports: [CfUtilityComponent] },] } ]; return CfUtilityModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var PropagatorUtilService = /** @class */ (function () { function PropagatorUtilService() { } /** * @param {?} objects * @param {?} keyName * @param {?} value * @param {?} ignoreCase * @return {?} */ PropagatorUtilService.prototype.findInObjectsArrayFromKey = /** * @param {?} objects * @param {?} keyName * @param {?} value * @param {?} ignoreCase * @return {?} */ function (objects, keyName, value, ignoreCase) { if (ignoreCase) { return objects.find((/** * @param {?} item * @return {?} */ function (item) { return item[keyName].toLowerCase() == value.toLowerCase(); })); } return objects.find((/** * @param {?} item * @return {?} */ function (item) { return item[keyName] == value; })); }; /** * @param {?} objects * @param {?} keyName * @return {?} */ PropagatorUtilService.prototype.extractKeysFromObjectsList = /** * @param {?} objects * @param {?} keyName * @return {?} */ function (objects, keyName) { return objects.map((/** * @param {?} item * @return {?} */ function (item) { return item[keyName]; })); }; /** * @param {?} objects * @param {?} key * @param {?} value * @return {?} */ PropagatorUtilService.prototype.objectArrayIndexOf = /** * @param {?} objects * @param {?} key * @param {?} value * @return {?} */ function (objects, key, value) { return this.extractKeysFromObjectsList(objects, key).indexOf(value); }; /** * @param {?} objects * @param {?} key * @param {?} value * @return {?} */ PropagatorUtilService.prototype.objectArrayFindFromKey = /** * @param {?} objects * @param {?} key * @param {?} value * @return {?} */ function (objects, key, value) { /** @type {?} */ var index = this.extractKeysFromObjectsList(objects, key).indexOf(value); if (index === -1) { return; } return objects[index]; }; /** * @param {?} objects * @param {?} keyName * @param {?} value * @return {?} */ PropagatorUtilService.prototype.filterInObjectsArrayFromKey = /** * @param {?} objects * @param {?} keyName * @param {?} value * @return {?} */ function (objects, keyName, value) { return objects.filter((/** * @param {?} item * @return {?} */ function (item) { return item[keyName] === value; })); }; /** * @param {?} objects * @param {?} keys * @param {?} keyName * @return {?} */ PropagatorUtilService.prototype.filterObjectsFromKeys = /** * @param {?} objects * @param {?} keys * @param {?} keyName * @return {?} */ function (objects, keys, keyName) { return objects.filter((/** * @param {?} item * @return {?} */ function (item) { return keys.indexOf(item[keyName]) !== -1; })); }; /** * @param {?} _arr * @return {?} */ PropagatorUtilService.prototype.flattenArray = /** * @param {?} _arr * @return {?} */ function (_arr) { return _flattenArray(_arr); /** * @param {?} _arr * @return {?} */ function _flattenArray(_arr) { return _arr.reduce((/** * @param {?} _acc * @param {?} _value * @return {?} */ function (_acc, _value) { return Array.isArray(_value) ? _acc.concat(_flattenArray(_value)) : _acc.concat(_value); }), []); } }; /** * @param {?} callback * @param {...?} urls * @return {?} */ PropagatorUtilService.prototype.jsCssScriptInjector = /** * @param {?} callback * @param {...?} urls * @return {?} */ function (callback) { var urls = []; for (var _i = 1; _i < arguments.length; _i++) { urls[_i - 1] = arguments[_i]; } /** @type {?} */ var _count = 0; /** @type {?} */ var _element; this.flattenArray(urls).forEach((/** * @param {?} _url * @return {?} */ function (_url) { if (_url.endsWith(".js")) { _element = document.createElement('script'); _element.src = _url; _element.type = 'text/javascript'; _element.async = true; } if (_url.endsWith(".css")) { _element = document.createElement('link'); _element.rel = "stylesheet"; _element.href = _url; } if (callback) { _element.addEventListener("load", (/** * @return {?} */ function () { _count++; if (_count == urls.length) { callback(urls); } })); } document.getElementsByTagName('head')[0].appendChild(_element); })); }; /** * @param {?} x * @param {?} y * @return {?} */ PropagatorUtilService.prototype.isObjectsEqual = /** * @param {?} x * @param {?} y * @return {?} */ function (x, y) { return _objectEquals(x, y); /** * @param {?} x * @param {?} y * @return {?} */ function _objectEquals(x, y) { if (x === null || x === undefined || y === null || y === undefined) { return x === y; } // after this just checking type of one would be enough if (x.constructor !== y.constructor) { return false; } // if they are functions, they should exactly refer to same one (because of closures) if (x instanceof Function) { return x === y; } // if they are regexps, they should exactly refer to same one (it is hard to better equality check on current ES) if (x instanceof RegExp) { return x === y; } if (x === y || x.valueOf() === y.valueOf()) { return true; } if (Array.isArray(x) && x.length !== y.length) { return false; } // if they are dates, they must had equal valueOf if (x instanceof Date) { return false; } // if they are strictly equal, they both need to be object at least if (!(x instanceof Object)) { return false; } if (!(y instanceof Object)) { return false; } // recursive object equality check /** @type {?} */ var p = Object.keys(x); return Object.keys(y).every((/** * @param {?} i * @return {?} */ function (i) { return p.indexOf(i) !== -1; })) && p.every((/** * @param {?} i * @return {?} */ function (i) { return _objectEquals(x[i], y[i]); })); } }; /** * @param {?} _exclude * @param {?} _list * @return {?} */ PropagatorUtilService.prototype.excludeValuesFromObjectList = /** * @param {?} _exclude * @param {?} _list * @return {?} */ function (_exclude, _list) { return _excludeValuesFromObjectList(_exclude, _list); /** * @param {?} _exclude * @param {?} _list * @return {?} */ function _excludeValuesFromObjectList(_exclude, _list) { /** @type {?} */ var temp = []; for (var _ex in _exclude) { _exclude[_ex].forEach((/** * @param {?} _item * @return {?} */ function (_item) { temp = _list.filter((/** * @param {?} book * @return {?} */ function (book) { return book[_ex] != _item; })); _list = temp; })); } return _list; } }; PropagatorUtilService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ PropagatorUtilService.ctorParameters = function () { return []; }; /** @nocollapse */ PropagatorUtilService.ngInjectableDef = ɵɵdefineInjectable({ factory: function PropagatorUtilService_Factory() { return new PropagatorUtilService(); }, token: PropagatorUtilService, providedIn: "root" }); return PropagatorUtilService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var pincodeRegx = new RegExp('^[1-9][0-9]{5}$'); /** @type {?} */ var panRegx = new RegExp('^([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}?$'); /** @type {?} */ var gstinRegx = new RegExp('^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$'); var ValidatorService = /** @class */ (function () { function ValidatorService() { } /** * @param {?} _value * @return {?} */ ValidatorService.prototype.removeSpace = /** * @param {?} _value * @return {?} */ function (_value) { _value ? _value.replace(/\s/g, '') : ''; return _value; }; /** * @param {?} _value * @return {?} */ ValidatorService.prototype.pincodeCheck = /** * @param {?} _value * @return {?} */ function (_value) { return pincodeRegx.test(this.removeSpace(_value)); }; /** * @param {?} _value * @return {?} */ ValidatorService.prototype.panCheck = /** * @param {?} _value * @return {?} */ function (_value) { return panRegx.test(this.removeSpace(_value)); }; /** * @param {?} _value * @return {?} */ ValidatorService.prototype.gstinCheck = /** * @param {?} _value * @return {?} */ function (_value) { return gstinRegx.test(this.removeSpace(_value)); }; /** * @param {?} _aadhaar * @return {?} */ ValidatorService.prototype.aadhaarCheck = /** * @param {?} _aadhaar * @return {?} */ function (_aadhaar) { /** @type {?} */ var Verhoeff = { "d": [ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 0, 6, 7, 8, 9, 5], [2, 3, 4, 0, 1, 7, 8, 9, 5, 6], [3, 4, 0, 1, 2, 8, 9, 5, 6, 7], [4, 0, 1, 2, 3, 9, 5, 6, 7, 8], [5, 9, 8, 7, 6, 0, 4, 3, 2, 1], [6, 5, 9, 8, 7, 1, 0, 4, 3, 2], [7, 6, 5, 9, 8, 2, 1, 0, 4, 3], [8, 7, 6, 5, 9, 3, 2, 1, 0, 4], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] ], "p": [ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 5, 7, 6, 2, 8, 3, 0, 9, 4], [5, 8, 0, 3, 7, 9, 6, 1, 4, 2], [8, 9, 1, 6, 0, 4, 3, 5, 2, 7], [9, 4, 5, 3, 1, 2, 6, 8, 7, 0], [4, 2, 8, 6, 5, 7, 3, 9, 0, 1], [2, 7, 9, 3, 8, 0, 6, 4, 1, 5], [7, 0, 4, 6, 9, 1, 3, 2, 5, 8] ], "j": [0, 4, 3, 2, 1, 5, 6, 7, 8, 9], check: (/** * @param {?} str * @return {?} */ function (str) { /** @type {?} */ var c = 0; str.replace(/\D+/g, "").split("").reverse().join("").replace(/[\d]/g, (/** * @param {?} u * @param {?} i * @param {?} o * @return {?} */ function (u, i, o) { c = Verhoeff.d[c][Verhoeff.p[i & 7][parseInt(u, 10)]]; })); return (c === 0); }) }; return Verhoeff.check(_aadhaar); }; ValidatorService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ ValidatorService.ctorParameters = function () { return []; }; /** @nocollapse */ ValidatorService.ngInjectableDef = ɵɵdefineInjectable({ factory: function ValidatorService_Factory() { return new ValidatorService(); }, token: ValidatorService, providedIn: "root" }); return ValidatorService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var DeviceDetectorService = /** @class */ (function () { function DeviceDetectorService() { } /** * @return {?} */ DeviceDetectorService.prototype._knowYourBrowser = /** * @return {?} */ function () { if ((navigator.userAgent.indexOf("Opera") || navigator.userAgent.indexOf('OPR')) != -1) { return 'Opera'; } else if (navigator.userAgent.indexOf("Chrome") != -1) { return 'Chrome'; } else if (navigator.userAgent.indexOf("Safari") != -1) { return 'Safari'; } else if (navigator.userAgent.indexOf("Firefox") != -1) { return 'Firefox'; } else if ((navigator.userAgent.indexOf("MSIE") != -1) || (!!window.document.documentMode == true)) //IF IE > 10 { return 'IE'; } else { return 'Unknown'; } }; /** * @return {?} */ DeviceDetectorService.prototype.info = /** * @return {?} */ function () { return { userAgent: navigator.userAgent, browser: this._knowYourBrowser(), device: '', os_version: window.navigator.platform, browser_version: _getBrowserVersion(), isDesktop: _isDesktop(), isMobile: _isMobile(), //('ontouchstart' in document.documentElement && navigator.userAgent.match(/Mobi/)), isTablet: _isTablet() }; /** * @return {?} */ function _isMobile() { if (window.innerWidth >= 320 && window.innerWidth <= 767) { return true; } else { return false; } } /** * @return {?} */ function _isTablet() { if (window.innerWidth >= 768 && window.innerWidth <= 979) { return true; } else { return false; } } /** * @return {?} */ function _isDesktop() { if (window.innerWidth >= 980) { return true; } else { return false; } } /** * @return {?} */ function _getBrowserVersion() { /** @type {?} */ var ua = navigator.userAgent; /** @type {?} */ var tem; /** @type {?} */ var M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; if (/trident/i.test(M[1])) { tem = /\brv[ :]+(\d+)/g.exec(ua) || []; return 'IE ' + (tem[1] || ''); } if (M[1] === 'Chrome') { tem = ua.match(/\b(OPR|Edge)\/(\d+)/); if (tem != null) return tem.slice(1).join(' ').replace('OPR', 'Opera'); } M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?']; if ((tem = ua.match(/version\/(\d+)/i)) != null) M.splice(1, 1, tem[1]); return M.join(' '); } }; DeviceDetectorService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ DeviceDetectorService.ctorParameters = function () { return []; }; /** @nocollapse */ DeviceDetectorService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DeviceDetectorService_Factory() { return new DeviceDetectorService(); }, token: DeviceDetectorService, providedIn: "root" }); return DeviceDetectorService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} type * @param {?} value * @return {?} */ function invalidPipeArgumentError(type, value) { return Error("InvalidPipeArgument: '" + value + "' for pipe '" + ɵstringify(type) + "'"); } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var LowerCasePipe = /** @class */ (function () { function LowerCasePipe() { } /** * @param {?} value * @return {?} */ LowerCasePipe.prototype.transform = /** * @param {?} value * @return {?} */ function (value) { // Transforms text to lowercase. if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(LowerCasePipe, value); } return value.toLowerCase(); }; LowerCasePipe.decorators = [ { type: Pipe, args: [{ name: 'lowercase' },] } ]; return LowerCasePipe; }()); /** * @param {?} word * @return {?} */ function titleCaseWord(word) { //Helper method to transform a single word to titlecase. if (!word) return word; return word[0].toUpperCase() + word.substr(1).toLowerCase(); } var TitleCasePipe = /** @class */ (function () { function TitleCasePipe() { } /** * @param {?} value * @return {?} */ TitleCasePipe.prototype.transform = /** * @param {?} value * @return {?} */ function (value) { //Transforms text to titlecase. if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(TitleCasePipe, value); } return value.split(/\b/g).map((/** * @param {?} word * @return {?} */ function (word) { return titleCaseWord(word); })).join(''); }; TitleCasePipe.decorators = [ { type: Pipe, args: [{ name: 'titlecase' },] } ]; return TitleCasePipe; }()); var UpperCasePipe = /** @class */ (function () { function UpperCasePipe() { } /** * @param {?} value * @return {?} */ UpperCasePipe.prototype.transform = /** * @param {?} value * @return {?} */ function (value) { /* Transforms text to uppercase. */ if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(UpperCasePipe, value); } return value.toUpperCase(); }; UpperCasePipe.decorators = [ { type: Pipe, args: [{ name: 'uppercase' },] } ]; return UpperCasePipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var GenerateUrlPipe = /** @class */ (function () { function GenerateUrlPipe() { this.placeholder = '{%s%}'; } /** * @param {?} _url * @param {?=} _params * @return {?} */ GenerateUrlPipe.prototype.transform = /** * @param {?} _url * @param {?=} _params * @return {?} */ function (_url, _params) { /** @type {?} */ var _generatedUrl = _url; (_url.match(new RegExp(this.placeholder, 'g')) || []).forEach((/** * @param {?} _item * @param {?} _index * @return {?} */ function (_item, _index) { _generatedUrl = _generatedUrl.replace(_item, _params[_index]); })); return _generatedUrl; }; GenerateUrlPipe.decorators = [ { type: Pipe, args: [{ name: 'generateUrl' },] } ]; return GenerateUrlPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var TrimPipe = /** @class */ (function () { function TrimPipe() { } /** * @param {?} _stringInput * @param {?} _maxLength * @return {?} */ TrimPipe.prototype.transform = /** * @param {?} _stringInput * @param {?} _maxLength * @return {?} */ function (_stringInput, _maxLength) { if ((_stringInput || '').length <= _maxLength) return _stringInput; else return _stringInput.substring(0, _maxLength - 2) + ".."; }; TrimPipe.decorators = [ { type: Pipe, args: [{ name: 'trim' },] } ]; return TrimPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // var TimeagoPipe = /** @class */ (function () { function TimeagoPipe(changeDetectorRef, ngZone) { this.changeDetectorRef = changeDetectorRef; this.ngZone = ngZone; } /** * @return {?} */ TimeagoPipe.prototype.ngOnDestroy = /** * @return {?} */ function () { this.removeTimer(); }; /** * @return {?} */ TimeagoPipe.prototype.removeTimer = /** * @return {?} */ function () { if (typeof timer !== 'undefined') { window.clearTimeout(timer); timer = null; } }; /** * @param {?} seconds * @return {?} */ TimeagoPipe.prototype.getSecondsUntilUpdate = /** * @param {?} seconds * @return {?} */ function (seconds) { /** @type {?} */ var min = 60; /** @type {?} */ var hr = min * 60; /** @type {?} */ var day = hr * 24; if (seconds < min) { // less than 1 min, update every 2 secs return 2; } else if (seconds < hr) { // less than an hour, update every 30 secs return 30; } else if (seconds < day) { // less then a day, update every 5 mins return 300; } else { // update every hour return 3600; } }; /** * @param {?} value * @param {?=} args * @return {?} */ TimeagoPipe.prototype.transform = /** * @param {?} value * @param {?=} args * @return {?} */ function (value, args) { var _this = this; this.removeTimer(); /** @type {?} */ var d = new Date(value); /** @type {?} */ var timer = ""; /** @type {?} */ var now = new Date(); /** @type {?} */ var seconds = Math.round(Math.abs((now.getTime() - d.getTime()) / 1000)); /** @type {?} */ var timeToUpdate = (Number.isNaN(seconds)) ? 1000 : this.getSecondsUntilUpdate(seconds) * 1000; timer = this.ngZone.runOutsideAngular((/** * @return {?} */ function () { if (typeof window !== 'undefined') { return window.setTimeout((/** * @return {?} */ function () { _this.ngZone.run((/** * @return {?} */ function () { return _this.changeDetectorRef.markForCheck(); })); }), timeToUpdate); } return null; })); /** @type {?} */ var minutes = Math.round(Math.abs(seconds / 60)); /** @type {?} */ var hours = Math.round(Math.abs(minutes / 60)); /** @type {?} */ var days = Math.round(Math.abs(hours / 24)); /** @type {?} */ var months = Math.round(Math.abs(days / 30.416)); /** @type {?} */ var years = Math.round(Math.abs(days / 365)); if (Number.isNaN(seconds)) { return ''; } else if (seconds <= 45) { return 'a few seconds ago'; } else if (seconds <= 90) { return 'a minute ago'; } else if (minutes <= 45) { return minutes + ' minutes ago'; } else if (minutes <= 90) { return 'an hour ago'; } else if (hours <= 22) { return hours + ' hours ago'; } else if (hours <= 36) { return 'a day ago'; } else if (days <= 25) { return days + ' days ago'; } else if (days <= 45) { return 'a month ago'; } else if (days <= 345) { return months + ' months ago'; } else if (days <= 545) { return 'a year ago'; } else { // (days > 545) return years + ' years ago'; } }; TimeagoPipe.decorators = [ { type: Pipe, args: [{ name: 'timeago' },] } ]; /** @nocollapse */ TimeagoPipe.ctorParameters = function () { return [ { type: ChangeDetectorRef }, { type: NgZone } ]; }; return TimeagoPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var SearchtextPipe = /** @class */ (function () { function SearchtextPipe() { } /** * @param {?} value * @param {?} keys * @param {?} term * @return {?} */ SearchtextPipe.prototype.transform = /** * @param {?} value * @param {?} keys * @param {?} term * @return {?} */ function (value, keys, term) { if (!term) return value; return (value || []).filter((/** * @param {?} item * @return {?} */ function (item) { return keys.split(',').some((/** * @param {?} key * @return {?} */ function (key) { return item.hasOwnProperty(key) && new RegExp(term, 'gi').test(item[key]); })); })); }; SearchtextPipe.decorators = [ { type: Pipe, args: [{ name: 'searchtext' },] } ]; return SearchtextPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var OrderByPipe = /** @class */ (function () { function OrderByPipe() { } /** * @param {?} array * @param {?} orderField * @param {?} orderType * @return {?} */ OrderByPipe.prototype.transform = /** * @param {?} array * @param {?} orderField * @param {?} orderType * @return {?} */ function (array, orderField, orderType) { array.sort((/** * @param {?} a * @param {?} b * @return {?} */ function (a, b) { /** @type {?} */ var ae = a[orderField]; /** @type {?} */ var be = b[orderField]; if (ae == undefined && be == undefined) return 0; if (ae == undefined && be != undefined) return orderType ? 1 : -1; if (ae != undefined && be == undefined) return orderType ? -1 : 1; if (ae == be) return 0; return orderType ? (ae.toString().toLowerCase() > be.toString().toLowerCase() ? -1 : 1) : (be.toString().toLowerCase() > ae.toString().toLowerCase() ? -1 : 1); })); return array; }; OrderByPipe.decorators = [ { type: Pipe, args: [{ name: 'orderBy' },] } ]; return OrderByPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KeysPipe = /** @class */ (function () { function KeysPipe() { } /** * @param {?} value * @param {?} args * @return {?} */ KeysPipe.prototype.transform = /** * @param {?} value * @param {?} args * @return {?} */ function (value, args) { /** @type {?} */ var keys = []; for (var key in value) { keys.push({ key: key, value: value[key] }); } return keys; }; KeysPipe.decorators = [ { type: Pipe, args: [{ name: 'keys' },] } ]; return KeysPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var IsEmptyPipe = /** @class */ (function () { function IsEmptyPipe() { } /** * @param {?} value * @param {?=} args * @return {?} */ IsEmptyPipe.prototype.transform = /** * @param {?} value * @param {?=} args * @return {?} */ function (value, args) { for (var bar in value) { if (value.hasOwnProperty(bar)) { return true; } } return false; }; IsEmptyPipe.decorators = [ { type: Pipe, args: [{ name: 'isEmpty' },] } ]; return IsEmptyPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var IndianCurrencyPipe = /** @class */ (function () { function IndianCurrencyPipe() { } /** * @param {?} rsStr * @param {?=} args * @return {?} */ IndianCurrencyPipe.prototype.transform = /** * @param {?} rsStr * @param {?=} args * @return {?} */ function (rsStr, args) { if (!isNaN(rsStr)) { /** @type {?} */ var currencySymbol = '₹'; //var output = Number(rsStr).toLocaleString('en-IN'); <-- This method is not working fine in all browsers! /** @type {?} */ var result = rsStr.toString().split('.'); /** @type {?} */ var lastThree = result[0].substring(result[0].length - 3); /** @type {?} */ var otherNumbers = result[0].substring(0, result[0].length - 3); if (otherNumbers != '') lastThree = ',' + lastThree; /** @type {?} */ var output = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; if (result.length > 1) { output += "." + result[1]; } return currencySymbol + output; } }; IndianCurrencyPipe.decorators = [ { type: Pipe, args: [{ name: 'indianCurrency' },] } ]; return IndianCurrencyPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NgxPipeModule = /** @class */ (function () { function NgxPipeModule() { } NgxPipeModule.decorators = [ { type: NgModule, args: [{ providers: [], exports: [LowerCasePipe, TitleCasePipe, UpperCasePipe, GenerateUrlPipe, TrimPipe, TimeagoPipe, SearchtextPipe, OrderByPipe, KeysPipe, IsEmptyPipe, IndianCurrencyPipe], declarations: [LowerCasePipe, TitleCasePipe, UpperCasePipe, GenerateUrlPipe, TrimPipe, TimeagoPipe, SearchtextPipe, OrderByPipe, KeysPipe, IsEmptyPipe, IndianCurrencyPipe] },] } ]; return NgxPipeModule; }()); export { CfUtilityComponent, CfUtilityModule, CfUtilityService, DeviceDetectorService, NgxPipeModule, PropagatorUtilService, ValidatorService, LowerCasePipe as ɵa, TitleCasePipe as ɵb, UpperCasePipe as ɵc, GenerateUrlPipe as ɵd, TrimPipe as ɵe, TimeagoPipe as ɵf, SearchtextPipe as ɵg, OrderByPipe as ɵh, KeysPipe as ɵi, IsEmptyPipe as ɵj, IndianCurrencyPipe as ɵk }; //# sourceMappingURL=cf-common-lib.js.map