Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

source-map-dummy

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

source-map-dummy

Creates “dummy” source maps.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Overview Build Status

Creates “dummy” source maps.

var createDummySourceMap = require("source-map-dummy")

createDummySourceMap(
  ["Hello", ",", " ", "World", "!"],
  {source: "path/to/helloWorld.txt"}
)
// {
//   file: "helloWorld.txt",
//   version: 3,
//   mappings: "...",
//   sources: ["path/to/helloWorld.txt"],
//   names: []
// }

createDummySourceMap(
  "var foo = bar;",
  {source: "path/to/foo.js", type: "js"}
)
// {
//   file: "foo.js",
//   version: 3,
//   mappings: "...",
//   sources: ["path/to/foo.js"],
//   names: []
// }

Installation

npm install source-map-dummy

var createDummySourceMap = require("source-map-dummy")

Usage

createDummySourceMap(tokens, options)

Creates a “dummy” source map for tokens, which is an array of strings. One mapping will be added per token, except blank ones. Each mapping maps back to itself.

First tokenize your source code into an array. Then pass that array to createDummySourceMap. This way it works with any type of source code.

In reality, source maps are only used for JavaScript and CSS. Therefore you may also pass a string of either JavaScript or CSS, that will be tokenized for you.

options:

  • source: Required. The path to the file containing code. All mappings will point to this source.
  • type: Required if tokens is a string. Set it to js if tokens is a string of JavaScript, and to css if it is CSS.

License

The X11 (“MIT”) License.

Keywords

FAQs

Package last updated on 26 Feb 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc