UNPKG

1.04 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../src/utils/prepare-regex.js"],"names":["_","require","module","exports","str","exploded","split","regex","RegExp","slice","join","replace","last"],"mappings":";;AAAA,MAAMA,CAAC,GAAGC,OAAO,CAAE,QAAF,CAAjB;;AAEAC,MAAM,CAACC,OAAP,GAAiBC,GAAG,IAAI;AACtB,QAAMC,QAAQ,GAAGD,GAAG,CAACE,KAAJ,CAAW,GAAX,CAAjB;AACA,QAAMC,KAAK,GAAG,IAAIC,MAAJ,CACZH,QAAQ,CACLI,KADH,CACS,CADT,EACY,CAAC,CADb,EAEGC,IAFH,CAES,GAFT,EAGE;AACA;AACA;AALF,GAMGC,OANH,CAMW,MANX,EAMoB,IANpB,CADY,EAQZX,CAAC,CAACY,IAAF,CAAOP,QAAP,CARY,CAAd;AAUA,SAAOE,KAAP;AACD,CAbD","sourcesContent":["const _ = require(`lodash`)\n\nmodule.exports = str => {\n const exploded = str.split(`/`)\n const regex = new RegExp(\n exploded\n .slice(1, -1)\n .join(`/`)\n // Double escaping is needed to get past the GraphQL parser,\n // but single escaping is needed for the RegExp constructor,\n // i.e. `\"\\\\\\\\w+\"` for `/\\w+/`.\n .replace(/\\\\\\\\/, `\\\\`),\n _.last(exploded)\n )\n return regex\n}\n"],"file":"prepare-regex.js"}
\No newline at end of file