Home Reference Source Test Repository
public class | source

PackageUtil

Provides several utility methods for working with package.json.

Static Method Summary

Static Public Methods
public static

Get essential info for the given package object.

public static

Attempts to load any associated package.json file from any NPM module detected in the first line of the error trace.

Static Public Methods

public static getPackageData(packageObj: NPMPackageObject): NPMPackageData source

Get essential info for the given package object.

Params:

NameTypeAttributeDescription
packageObj NPMPackageObject

A loaded package.json object.

Return:

NPMPackageData

public static getPackageDataFromError(errOrTrace: Array<string> | Error): NPMPackageData | undefined source

Attempts to load any associated package.json file from any NPM module detected in the first line of the error trace. The logger is queried with the error generating a filtered stack trace.

Params:

NameTypeAttributeDescription
errOrTrace Array<string> | Error

A stack trace as an array of strings or error with stack trace to examine.