wallet-core/node_modules/webpack/lib/util/identifier.js

17 lines
450 B
JavaScript
Raw Normal View History

2017-05-03 15:35:00 +02:00
"use strict";
const path = require("path");
const looksLikeAbsolutePath = (maybeAbsolutePath) => {
return /^(?:[a-z]:\\|\/)/i.test(maybeAbsolutePath);
};
const normalizePathSeparator = (p) => p.replace(/\\/g, "/");
exports.makePathsRelative = (context, identifier) => {
return identifier
.split(/([|! ])/)
.map(str => looksLikeAbsolutePath(str) ?
normalizePathSeparator(path.relative(context, str)) : str)
.join("");
};