UNPKG

react-youtube-playlist

Version:

A react component for displaying the contents of a user's YouTube playlist.

17 lines (13 loc) 450 B
"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(""); };