@terminus/ngx-tools
Version:
[![CircleCI][circle-badge]][circle-link] [![codecov][codecov-badge]][codecov-project] [![semantic-release][semantic-release-badge]][semantic-release] [![MIT License][license-image]][license-url] <br> [![NPM version][npm-version-image]][npm-url] [![Github
39 lines (38 loc) • 1.36 kB
TypeScript
import { SimpleChanges } from '@angular/core';
/**
* Utility class to assist with pulling specific values from a `SimpleChanges` object.
*/
export declare class NgChangeObjectValueParser {
/**
* Function to parse previousValue from triggered by changes on ngOnChange
*
* @param changes - SimpleChanges
* @param path - string
* @returns lowest layer value or changes object itself when path cannot be parsed
*
* @example
* valueParser.getOldValue(myChanges, 'my.path')
*/
static getOldValue(changes: SimpleChanges, path: string): any;
/**
* Function to parse currentValue from triggered by changes on ngOnChange
*
* @param changes - SimpleChanges
* @param path - string
* @returns lowest layer value or changes object itself when path cannot be parsed
*
* @example
* valueParser.getNewValue(myChanges, 'my.path')
*/
static getNewValue(changes: SimpleChanges, path: string): any;
/**
* Function to parse path to get keys for each layer
*
* @param path - string
* @returns an array of two elements, one being an array of all the keys except first one, one being the first key
*
* @example
* valueParser.parsePath('my.path') // Returns: [['my'], 'path']
*/
static parsePath(path: string): [string[], string];
}