1 // Copyright 2014 Simon Lydell
2 // X11 (“MIT”) Licensed. (See LICENSE.)
4 void (function(root, factory) {
5 if (typeof define === "function" && define.amd) {
7 } else if (typeof exports === "object") {
8 module.exports = factory()
10 root.sourceMappingURL = factory()
14 var innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/
19 "(?:\\s*\r?\n(?://)?)?" +
20 "(?:" + innerRegex.source + ")" +
24 "//(?:" + innerRegex.source + ")" +
32 _innerRegex: innerRegex,
34 getFrom: function(code) {
35 var match = code.match(regex)
36 return (match ? match[1] || match[2] || "" : null)
39 existsIn: function(code) {
40 return regex.test(code)
43 removeFrom: function(code) {
44 return code.replace(regex, "")
47 insertBefore: function(code, string) {
48 var match = code.match(regex)
50 return code.slice(0, match.index) + string + code.slice(match.index)