1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- "use strict";
-
- function prepend(candidate) {
- if (typeof candidate === "string") {
- return "file://" + candidate;
- } else if (candidate && typeof candidate === "object" && Array.isArray(candidate.sources)) {
- return Object.assign({}, candidate, {
- sources: candidate.sources.map(prepend)
- });
- } else {
- throw new Error("expected string|object");
- }
- }
- exports.prepend = prepend;
- function remove(candidate) {
- if (typeof candidate === "string") {
- return candidate.replace(/^file:\/{2}/, "");
- } else if (candidate && typeof candidate === "object" && Array.isArray(candidate.sources)) {
- return Object.assign({}, candidate, {
- sources: candidate.sources.map(remove)
- });
- } else {
- throw new Error("expected string|object");
- }
- }
- exports.remove = remove;
|