🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

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.

0.4.1
latest
Source
npm
Version published
Weekly downloads
12M
9.86%
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

source map

FAQs

Package last updated on 01 Feb 2021

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