CoolFace
Apppublic

admin08077/Githubgemini

sourceHugging Faceotherupdated 10mo agoView on Hugging Face
0likes
unist-util-stringify-position-Ch_qCilz.js.map1 linesDownload Raw Back to assets
1{"version":3,"file":"unist-util-stringify-position-Ch_qCilz.js","sources":["../../node_modules/unist-util-stringify-position/lib/index.js"],"sourcesContent":["/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n * @typedef {import('unist').Position} Position\n */\n\n/**\n * @typedef NodeLike\n * @property {string} type\n * @property {PositionLike | null | undefined} [position]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n *\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n */\n\n/**\n * Serialize the positional info of a point, position (start and end points),\n * or node.\n *\n * @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value]\n *   Node, position, or point.\n * @returns {string}\n *   Pretty printed positional info of a node (`string`).\n *\n *   In the format of a range `ls:cs-le:ce` (when given `node` or `position`)\n *   or a point `l:c` (when given `point`), where `l` stands for line, `c` for\n *   column, `s` for `start`, and `e` for end.\n *   An empty string (`''`) is returned if the given value is neither `node`,\n *   `position`, nor `point`.\n */\nexport function stringifyPosition(value) {\n  // Nothing.\n  if (!value || typeof value !== 'object') {\n    return ''\n  }\n\n  // Node.\n  if ('position' in value || 'type' in value) {\n    return position(value.position)\n  }\n\n  // Position.\n  if ('start' in value || 'end' in value) {\n    return position(value)\n  }\n\n  // Point.\n  if ('line' in value || 'column' in value) {\n    return point(value)\n  }\n\n  // ?\n  return ''\n}\n\n/**\n * @param {Point | PointLike | null | undefined} point\n * @returns {string}\n */\nfunction point(point) {\n  return index(point && point.line) + ':' + index(point && point.column)\n}\n\n/**\n * @param {Position | PositionLike | null | undefined} pos\n * @returns {string}\n */\nfunction position(pos) {\n  return point(pos && pos.start) + '-' + point(pos && pos.end)\n}\n\n/**\n * @param {number | null | undefined} value\n * @returns {number}\n */\nfunction index(value) {\n  return value && typeof value === 'number' ? value : 1\n}\n"],"names":["stringifyPosition","value","position","point","index","pos"],"mappings":"AAoCO,SAASA,EAAkBC,EAAO,CAEvC,MAAI,CAACA,GAAS,OAAOA,GAAU,SACtB,GAIL,aAAcA,GAAS,SAAUA,EAC5BC,EAASD,EAAM,QAAQ,EAI5B,UAAWA,GAAS,QAASA,EACxBC,EAASD,CAAK,EAInB,SAAUA,GAAS,WAAYA,EAC1BE,EAAMF,CAAK,EAIb,EACT,CAMA,SAASE,EAAMA,EAAO,CACpB,OAAOC,EAAMD,GAASA,EAAM,IAAI,EAAI,IAAMC,EAAMD,GAASA,EAAM,MAAM,CACvE,CAMA,SAASD,EAASG,EAAK,CACrB,OAAOF,EAAME,GAAOA,EAAI,KAAK,EAAI,IAAMF,EAAME,GAAOA,EAAI,GAAG,CAC7D,CAMA,SAASD,EAAMH,EAAO,CACpB,OAAOA,GAAS,OAAOA,GAAU,SAAWA,EAAQ,CACtD","x_google_ignoreList":[0]}