Next Phenomenal Microbrewery
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

atom-selected-requires

1.1.2 • Public • Published

atom-selected-requires

Retrieve the paths of any require statements in the current selection. Originally extracted from atom-node-resolver, and syntax-aware, just like browserify.

Usage

NPM

paths = selectedRequires([editor])

Given an editor, check all of the current selections and return an array of require paths. If no editor is supplied, the currently active editor will be used.

For example, given a file like so:

const a = require('atom-selected-requires')
const b = require('@scoped/package')
const c = require('./local-file')

You could run the following:

const selectedRequires = require('atom-selected-requires')
const editor = atom.workspace.getActiveEditor()
 
console.log(selectedRequires(editor))

And receive an array like so in return:

[
  'atom-selected-requires',
  '@scoped/package',
  './local-file'
]

See Also

License

MIT. See LICENSE.md for details.

install

npm i atom-selected-requires

Downloadsweekly downloads

96

version

1.1.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability