🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

babylon-module-definitons

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babylon-module-definitons

``` npm i babylon-module-definitons --save ```

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

babylonModuleDefinitions

npm i babylon-module-definitons --save

Why

Needed way of getting deps from a file with the babel syntax. Specifically because acorn does not support async / await.

Usage

Pass in code (sync):

let code = `
import * as one from 'one'
import "two"
import three from "three"
require('four')
let five = require('five')
`

let val = babylonModuleDefinitions({code})
assert.deepEqual(val, ['one', 'two', 'three', 'four', 'five'])

Pass in file (async - returns promise):

let file = './test/index.js'
babylonModuleDefinitions({file}).then(val => {
  assert.deepEqual(val, ['../src/index', 'assert'])
})

FAQs

Package last updated on 23 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts