mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* [pathval] Add types for pathval * Clean up redundant interfaces, use UMD mod. syntax Changes requested by @sandersn - Don't override lint rules in tslint.json - Use modern UMD module syntax - Removed redundant namespaces
19 lines
500 B
TypeScript
19 lines
500 B
TypeScript
import * as pathval from 'pathval';
|
|
|
|
const obj = { prop: 'a value' };
|
|
pathval.hasProperty(obj, 'prop'); // true
|
|
|
|
const earth = { earth: { country: 'Brazil' } };
|
|
pathval.getPathInfo(earth, 'earth.country');
|
|
const info: pathval.PathInfo = {
|
|
parent: { country: 'Brazil' },
|
|
name: 'country',
|
|
value: 'Brazil',
|
|
exists: true,
|
|
};
|
|
|
|
pathval.getPathValue(earth, 'earth.country'); // 'Brazil'
|
|
|
|
pathval.setPathValue(earth, 'earth.country', 'USA');
|
|
const usa: string = earth.earth.country; // 'USA'
|