source: trip-planner-front/node_modules/source-map-url/readme.md@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.3 KB
Line 
1Overview [![Build Status](https://travis-ci.org/lydell/source-map-url.png?branch=master)](https://travis-ci.org/lydell/source-map-url)
2========
3
4[![browser support](https://ci.testling.com/lydell/source-map-url.png)](https://ci.testling.com/lydell/source-map-url)
5
6Tools for working with sourceMappingURL comments.
7
8```js
9var sourceMappingURL = require("source-map-url")
10
11var code = [
12 "!function(){...}();",
13 "/*# sourceMappingURL=foo.js.map */"
14].join("\n")
15
16sourceMappingURL.existsIn(code)
17// true
18
19sourceMappingURL.getFrom(code)
20// foo.js.map
21
22code = sourceMappingURL.insertBefore(code, "// License: MIT\n")
23// !function(){...}();
24// // License: MIT
25// /*# sourceMappingURL=foo.js.map */
26
27code = sourceMappingURL.removeFrom(code)
28// !function(){...}();
29// // License: MIT
30
31sourceMappingURL.existsIn(code)
32// false
33
34sourceMappingURL.getFrom(code)
35// null
36
37code += "//# sourceMappingURL=/other/file.js.map"
38// !function(){...}();
39// // License: MIT
40// //# sourceMappingURL=/other/file.js.map
41```
42
43
44Installation
45============
46
47- `npm install source-map-url`
48- `bower install source-map-url`
49- `component install lydell/source-map-url`
50
51Works with CommonJS, AMD and browser globals, through UMD.
52
53
54Usage
55=====
56
57### `sourceMappingURL.getFrom(code)` ###
58
59Returns the url of the sourceMappingURL comment in `code`. Returns `null` if
60there is no such comment.
61
62### `sourceMappingURL.existsIn(code)` ###
63
64Returns `true` if there is a sourceMappingURL comment in `code`, or `false`
65otherwise.
66
67### `sourceMappingURL.removeFrom(code)` ###
68
69Removes the sourceMappingURL comment in `code`. Does nothing if there is no
70such comment. Returns the updated `code`.
71
72### `sourceMappingURL.insertBefore(code, string)` ###
73
74Inserts `string` before the sourceMappingURL comment in `code`. Appends
75`string` to `code` if there is no such comment.
76
77Lets you append something to a file without worrying about burying the
78sourceMappingURL comment (by keeping it at the end of the file).
79
80### `sourceMappingURL.regex` ###
81
82The regex that is used to match sourceMappingURL comments. It matches both `//`
83and `/**/` comments, thus supporting both JavaScript and CSS.
84
85
86Tests
87=====
88
89Start by running `npm test`, which lints the code and runs the test suite in Node.js.
90
91To run the tests in a browser, run `testling` (`npm install -g testling`) or `testling -u`.
92
93
94License
95=======
96
97[The X11 (“MIT”) License](LICENSE).
Note: See TracBrowser for help on using the repository browser.