# offset-sourcemap-lines

> offset each generated lines in SourceMap

Latest version **1.0.1** (published 2018-02-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install offset-sourcemap-lines
pnpm add offset-sourcemap-lines
yarn add offset-sourcemap-lines
bun add offset-sourcemap-lines
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-02-28 |
| First published | 2016-01-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Takuto Wada |
| Maintainers | twada |
| Keywords | offset, sourcemap, sourcemaps |

## Links

- npm: https://www.npmjs.com/package/offset-sourcemap-lines
- Repository: https://github.com/twada/offset-sourcemap-lines
- Issues: https://github.com/twada/offset-sourcemap-lines/issues
- npm.io page: https://npm.io/package/offset-sourcemap-lines

## Dependencies (1)

- [source-map](https://npm.io/package/source-map.md) ^0.5.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-02-28
- 1.0.0 — 2016-05-16
- 0.1.1 — 2016-05-12
- 0.1.0 — 2016-01-12

## README

offset-sourcemap-lines
================================

Offset each generated lines in SourceMap

[![Build Status][travis-image]][travis-url]
[![NPM version][npm-image]][npm-url]
[![Dependency Status][depstat-image]][depstat-url]
[![License][license-image]][license-url]


DESCRIPTION
---------------------------------------

`offset-sourcemap-lines` is a module to generate new [SourceMap](https://github.com/mozilla/source-map/) object from original SourceMap with specified offset for each generated lines applied.


API
---------------------------------------

### var offsettedMap = offsetLines(originalMap, offset)

```js
var offsetLines = require('offset-sourcemap-lines');
var conv = require('convert-source-map');
var fs = require('fs');

var codeWithSourceMapComment = fs.readFileSync('/path/to/code-with-sourcemap-comment.js', 'utf-8');
var originalMap = conv.fromSource(codeWithSourceMapComment).toObject();

var header = '/**\n * \n * YOUR\n * CODE\n * HEADER\n */\n';
var offset = header.match(/\n/g).length;

var offsettedMap = offsetLines(originalMap, offset);

var codeBody = conv.removeComments(codeWithSourceMapComment);
var newSourceMapComment = conv.fromObject(offsettedMap).toComment();
console.log(header + codeBody + '\n' + newSourceMapComment);
```


INSTALL
---------------------------------------

```
$ npm install offset-sourcemap-lines
```


AUTHOR
---------------------------------------
* [Takuto Wada](https://github.com/twada)


LICENSE
---------------------------------------
Licensed under the [MIT](https://twada.mit-license.org/) license.

[npm-url]: https://npmjs.org/package/offset-sourcemap-lines
[npm-image]: https://badge.fury.io/js/offset-sourcemap-lines.svg

[travis-url]: https://travis-ci.org/twada/offset-sourcemap-lines
[travis-image]: https://secure.travis-ci.org/twada/offset-sourcemap-lines.svg?branch=master

[depstat-url]: https://gemnasium.com/twada/offset-sourcemap-lines
[depstat-image]: https://gemnasium.com/twada/offset-sourcemap-lines.svg

[license-url]: https://twada.mit-license.org/2016-2018
[license-image]: https://img.shields.io/badge/license-MIT-brightgreen.svg

---
_Source: https://npm.io/package/offset-sourcemap-lines · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
