import { DepType , HasDependencySpecs } from "./types" ; function depTypes ( depName , pkg ) { let type = null ; let from = 'unknown' ; if ( pkg . devDependencies && pkg . devDependencies [ depName ] ) { type = depTypes . DEV ; from = pkg . devDependencies [ depName ] ; } if ( pkg . optionalDependencies && pkg . optionalDependencies [ depName ] ) { type = depTypes . OPTIONAL ; from = pkg . optionalDependencies [ depName ] ; } if ( pkg . dependencies && pkg . dependencies [ depName ] ) { type = depTypes . PROD ; from = pkg . dependencies [ depName ] ; } let bundled = ! ! ( pkg . bundleDependencies && pkg . bundleDependencies [ depName ] ) ; return { type : type as string , from : from , bundled : bundled , } ; } depTypes . EXTRANEOUS = 'extraneous' as DepType ; depTypes . OPTIONAL = 'optional' as DepType ; depTypes . PROD = 'prod' as DepType ; depTypes . DEV = 'dev' as DepType ; export = depTypes ;