line-column-path
Parse and stringify file paths with line and column like `unicorn.js:8:14`
Last updated a year ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install line-column-path 
SYNC missed versions from official npm registry.

line-column-path

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

Install

npm install line-column-path

Usage

import {parseLineColumnPath, stringifyLineColumnPath} from 'line-column-path';

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

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

API

parseLineColumnPath(path)

path

Type: string | URL | object

The file path to parse.

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

stringifyLineColumnPath(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.

Current Tags

  • 4.0.0                                ...           latest (a year ago)

4 Versions

  • 4.0.0                                ...           a year ago
  • 3.0.0                                ...           5 years ago
  • 2.0.0                                ...           8 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Total 7
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 4
Last Month 0
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE