mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 08:17:05 +00:00
* Add types for parent-package-json * Update return type to false and restructure tests * Remove multiple calls of parent() in tests * Test optional properties
11 lines
323 B
TypeScript
11 lines
323 B
TypeScript
import * as parent from 'parent-package-json';
|
|
|
|
const hasParent = parent('/optional/path/', 1);
|
|
|
|
if (hasParent !== false) {
|
|
const pathToParent: string = hasParent.path;
|
|
const contentOfParent: string = hasParent.read();
|
|
const JSONOfParent = hasParent.parse();
|
|
const versionOfParent = JSONOfParent.version;
|
|
}
|