UNPKG

ember-auto-import

Version:
36 lines (35 loc) 922 B
"use strict"; /* Adapted from https://github.com/lydell/source-map-url Which carries the licensing: Copyright 2014 Simon Lydell X11 (“MIT”) Licensed. Forked here because that one doesn't anchor to the end of the file, and that's pretty important for us. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.insertBefore = insertBefore; const innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/; const regex = RegExp('(?:' + '/\\*' + '(?:\\s*\r?\n(?://)?)?' + '(?:' + innerRegex.source + ')' + '\\s*' + '\\*/' + '|' + '//(?:' + innerRegex.source + ')' + ')' + '\\s*$'); function insertBefore(code, string) { let match = code.match(regex); if (match) { return code.slice(0, match.index) + string + code.slice(match.index); } else { return code + string; } } //# sourceMappingURL=source-map-url.js.map