JSPM

line-column-path

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 288696
  • Score
    100M100P100Q180653F
  • License MIT

Parse and stringify file paths with line and column like `unicorn.js:8:14`

Package Exports

  • line-column-path

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 (line-column-path) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

line-column-path Build Status

Parse and stringify file paths with line and column like unicorn.js:8:14

Install

$ npm install line-column-path

Usage

const lineColumnPath = require('line-column-path');

const parsed = lineColumnPath.parse('unicorn.js:8:14');
//=> {file: 'unicorn.js', line: 8, column: 14}

lineColumnPath.stringify(parsed);
//=> 'unicorn.js:8:14'

API

.parse(input)

input

Type: string | object

File path to parse.

Can also be an object that you want to validate and normalize.

.stringify(path, [options])

path

Type: object

Object with a .file property and optionally a .line and .column property.

options

Type: object

file

Type: boolean
Default: true

Output the file path.

Setting this to false will result in 8:18 instead of unicorn.js:8:14.

column

Type: boolean
Default: true

Output the column.

Setting this to false will result in unicorn.js:8 instead of unicorn.js:8:14.

License

MIT © Sindre Sorhus