UNPKG

@obliczeniowo/elementary

Version:
117 lines (109 loc) 4.23 kB
import * as i0 from '@angular/core'; import { Pipe } from '@angular/core'; function keys(object) { return Object.keys(object); } function assign(target, source) { Object.assign(target, source); } function keysValues(object) { return Object.entries(object); } function values(object) { return Object.values(object); } function path(path, object) { const items = path.split('.'); let value; items.forEach((item) => { value = value ? value[item] : object[item]; }); return value; } function toMap(object) { const valuesAndKeys = keysValues(object); const map = new Map(); valuesAndKeys.forEach(([key, value]) => { map.set(key, value); }); return map; } function fromMap(map) { const data = {}; map.forEach((value, key) => { data[key] = value; }); return data; } class MapPipe { transform(value, map) { return value.map(map); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: MapPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.4", ngImport: i0, type: MapPipe, isStandalone: true, name: "oblMap" }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: MapPipe, decorators: [{ type: Pipe, args: [{ name: 'oblMap', standalone: true }] }] }); class IsObjectPipe { transform(value) { if (typeof value === 'string') { try { value = JSON.parse(value); } catch (e) { return false; } } return !(typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean'); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: IsObjectPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.4", ngImport: i0, type: IsObjectPipe, isStandalone: true, name: "oblIsObject" }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: IsObjectPipe, decorators: [{ type: Pipe, args: [{ name: 'oblIsObject', standalone: true, }] }] }); class ExcludePipe { transform(object, fields) { object = { ...object }; // eslint-disable-next-line @typescript-eslint/no-dynamic-delete fields.forEach(field => delete object[field]); return object; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ExcludePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.4", ngImport: i0, type: ExcludePipe, isStandalone: true, name: "oblExclude" }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ExcludePipe, decorators: [{ type: Pipe, args: [{ name: 'oblExclude' }] }] }); class ConcatPipe { transform(objects) { return objects.reduce((p, c) => (p = { ...p, ...c }, p), {}); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ConcatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.0.4", ngImport: i0, type: ConcatPipe, isStandalone: true, name: "oblConcat" }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ConcatPipe, decorators: [{ type: Pipe, args: [{ name: 'oblConcat' }] }] }); /** * Generated bundle index. Do not edit. */ export { ConcatPipe, ExcludePipe, IsObjectPipe, MapPipe, assign, fromMap, keys, keysValues, path, toMap, values }; //# sourceMappingURL=obliczeniowo-elementary-objects.mjs.map