Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inDemoInstall

source-map-url

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Issues
File Explorer

Advanced tools

source-map-url

Tools for working with sourceMappingURL comments.

    0.4.1latest
    Github

Version published
Maintainers
1
Weekly downloads
13,554,550
decreased by-17.92%

Weekly downloads

Changelog

Source

Version 0.4.1 (2021-02-01) ###

  • Improved: The package is now about 50% smaller, by excluding unnecessary files. Thanks to Piotr Kuczynski (@pkuczynski)!

Readme

Source

Overview Build Status

browser support

Tools for working with sourceMappingURL comments.

var sourceMappingURL = require("source-map-url") var code = [ "!function(){...}();", "/*# sourceMappingURL=foo.js.map */" ].join("\n") sourceMappingURL.existsIn(code) // true sourceMappingURL.getFrom(code) // foo.js.map code = sourceMappingURL.insertBefore(code, "// License: MIT\n") // !function(){...}(); // // License: MIT // /*# sourceMappingURL=foo.js.map */ code = sourceMappingURL.removeFrom(code) // !function(){...}(); // // License: MIT sourceMappingURL.existsIn(code) // false sourceMappingURL.getFrom(code) // null code += "//# sourceMappingURL=/other/file.js.map" // !function(){...}(); // // License: MIT // //# sourceMappingURL=/other/file.js.map

Installation

  • npm install source-map-url
  • bower install source-map-url
  • component install lydell/source-map-url

Works with CommonJS, AMD and browser globals, through UMD.

Usage

sourceMappingURL.getFrom(code)

Returns the url of the sourceMappingURL comment in code. Returns null if there is no such comment.

sourceMappingURL.existsIn(code)

Returns true if there is a sourceMappingURL comment in code, or false otherwise.

sourceMappingURL.removeFrom(code)

Removes the sourceMappingURL comment in code. Does nothing if there is no such comment. Returns the updated code.

sourceMappingURL.insertBefore(code, string)

Inserts string before the sourceMappingURL comment in code. Appends string to code if there is no such comment.

Lets you append something to a file without worrying about burying the sourceMappingURL comment (by keeping it at the end of the file).

sourceMappingURL.regex

The regex that is used to match sourceMappingURL comments. It matches both // and /**/ comments, thus supporting both JavaScript and CSS.

Tests

Start by running npm test, which lints the code and runs the test suite in Node.js.

To run the tests in a browser, run testling (npm install -g testling) or testling -u.

License

The X11 (“MIT”) License.

Keywords

FAQs

What is source-map-url?

Tools for working with sourceMappingURL comments.

Is source-map-url popular?

The npm package source-map-url receives a total of 10,804,224 weekly downloads. As such, source-map-url popularity was classified as popular.

Is source-map-url well maintained?

We found that source-map-url demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 01 Feb 2021

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket[email protected]

Product

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc