Sha256: 6c43561a7aa03bade1568615fb105b7ec60e811c1b5142f34996148e58dfcabd

Contents?: true

Size: 564 Bytes

Versions: 73

Compression:

Stored size: 564 Bytes

Contents

const hq = require("alias-hq");
const aliases = hq.get("webpack");

exports.cocoPath = function (aliasedPath, relative = false) {
  const pathParts = aliasedPath.split("/");
  const alias = pathParts.shift();
  const restPath = pathParts.join("/");

  if (aliases[alias]) {
    const rootPath = aliases[alias].replace(/\/$/, "");
    const path = restPath.length ? `${rootPath}/${restPath}` : rootPath;
    return relative ? path.replace(process.cwd(), "").replace(/^\//, "") : path;
  } else {
    throw new Error(`'${alias}' is not a valid path alias.`);
  }
};

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
coveragebook_components-0.19.10 config/utils.js
coveragebook_components-0.19.9 config/utils.js
coveragebook_components-0.19.8 config/utils.js
coveragebook_components-0.19.7 config/utils.js
coveragebook_components-0.19.6 config/utils.js
coveragebook_components-0.19.5 config/utils.js
coveragebook_components-0.19.4 config/utils.js
coveragebook_components-0.19.3 config/utils.js
coveragebook_components-0.19.2 config/utils.js
coveragebook_components-0.19.1 config/utils.js
coveragebook_components-0.19.0 config/utils.js
coveragebook_components-0.18.8 config/utils.js
coveragebook_components-0.18.7 config/utils.js
coveragebook_components-0.18.0 config/utils.js
coveragebook_components-0.17.7 config/utils.js
coveragebook_components-0.17.6 config/utils.js
coveragebook_components-0.17.5 config/utils.js
coveragebook_components-0.17.4 config/utils.js
coveragebook_components-0.17.3 config/utils.js
coveragebook_components-0.17.2 config/utils.js