JSPM

get-source-code-location

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q25889F
  • License MIT

get a portion of source code by supplying star and end

Package Exports

  • get-source-code-location

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (get-source-code-location) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

get-source-code-location

Made specifically for working with babylon SourceLocation objects to extract pieces of code from a source file.

Usage

const getSourceCodeLocation = require('get-source-code-location')

getSourceCode(source, {
 start: { line: 8, column: 2 },
 end: { line: 8, column: 12 }
})
// returns a string on 8th line between collumns 2 and 12
// if the file is shorter than 8 lines, it will throw an error