Socket
Book a DemoInstallSign in
Socket

atom-selected-requires

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atom-selected-requires

Retrieve the paths of any require statements in the current selection.

latest
Source
npmnpm
Version
1.1.2
Version published
Maintainers
1
Created
Source

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

  • detective

License

MIT. See LICENSE.md for details.

Keywords

atom

FAQs

Package last updated on 28 Aug 2015

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