How to use acorn-globals - 3 common examples

To help you get started, we’ve selected a few acorn-globals examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LavaMoat / lavamoat-browserify / src / generateConfig.js View on Github external
function inspectModule (moduleData) {
    const packageName = moduleData.package
    moduleIdToPackageName[moduleData.id] = packageName
    // initialize mapping from package to module
    const packageModules = packageToModules[packageName] = packageToModules[packageName] || {}
    packageModules[moduleData.id] = moduleData
    // skip for project files (files not from deps)
    const isDependency = packageName === rootSlug
    if (isDependency) return
    // get eval environment
    const ast = acornGlobals.parse(moduleData.source)
    inspectForEnvironment(ast, packageName)
    // get global usage
    inspectForGlobals(moduleData, packageName)
  }
github LavaMoat / lavamoat-browserify / test / inspectEnvironment.js View on Github external
function inspectEnvironmentTest (code) {
  return inspectEnvironment(acornGlobals.parse(code))
}
github LavaMoat / lavamoat-browserify / test / inspectGlobals.js View on Github external
function inspectGlobalsTest (code) {
  return inspectGlobals(acornGlobals.parse(code))
}

acorn-globals

Detect global variables in JavaScript using acorn

MIT
Latest version published 2 years ago

Package Health Score

68 / 100
Full package analysis

Popular acorn-globals functions