Skip to content

Commit

Permalink
add name() method for getting the provider npm name (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
huan committed Apr 1, 2020
1 parent 37256dc commit 8e21911
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/puppet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export abstract class Puppet extends EventEmitter {
/**
* childPkg stores the `package.json` that the NPM module who extends the `Puppet`
*/
private readonly childPkg: undefined | normalize.Package
private readonly childPkg: normalize.Package

/**
* Throttle Reset Events
Expand Down Expand Up @@ -455,14 +455,18 @@ export abstract class Puppet extends EventEmitter {
*/
public abstract ding (data?: string) : void

/**
* Get the NPM name of the Puppet
*/
public name () {
return this.childPkg.name
}

/**
* Get version from the Puppet Implementation
*/
public version (): string {
if (this.childPkg) {
return this.childPkg.version
}
return '0.0.0'
return this.childPkg.version
}

/**
Expand Down

0 comments on commit 8e21911

Please sign in to comment.