Socket
Socket
Sign inDemoInstall

source-map-url

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

source-map-url

Tools for working with sourceMappingURL comments.


Version published
Weekly downloads
11M
increased by2.89%
Maintainers
1
Weekly downloads
 
Created

What is source-map-url?

The source-map-url npm package is a utility for working with source map URLs. It allows you to extract, insert, or remove source map URLs within a file, typically JavaScript or CSS files. This can be useful for developers who need to manage source map links in their generated code.

What are source-map-url's main functionalities?

Extracting source map URL

This feature allows you to extract the source map URL from a string of code. The `getFrom` method returns the URL if it exists.

const sourceMapUrl = require('source-map-url');
const code = '/*# sourceMappingURL=/path/to/file.js.map */';
const extractedUrl = sourceMapUrl.getFrom(code);

Inserting source map URL

This feature enables you to insert a source map URL into a string of code. The `insertInto` method adds the specified URL at the end of the code.

const sourceMapUrl = require('source-map-url');
const code = 'function example() {}';
const newCode = sourceMapUrl.insertInto(code, '/path/to/file.js.map');

Removing source map URL

This feature is used to remove an existing source map URL from a string of code. The `removeFrom` method strips out the source map URL.

const sourceMapUrl = require('source-map-url');
const code = 'function example() {}\n/*# sourceMappingURL=/path/to/file.js.map */';
const newCode = sourceMapUrl.removeFrom(code);

Other packages similar to source-map-url

Keywords

FAQs

Package last updated on 12 Nov 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