mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
11 lines
324 B
TypeScript
11 lines
324 B
TypeScript
import parent = require('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;
|
|
}
|