UNPKG

1.21 kBSource Map (JSON)View Raw
1{"version":3,"file":"wbr.js","sourceRoot":"","sources":["../../../../src/lib/output/helpers/wbr.ts"],"names":[],"mappings":";;AAQA,SAAgB,GAAG,CAAC,OAAY;IAC5B,IAAI,GAAG,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAEnE,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC;IAClG,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC;IAElG,OAAO,GAAG,CAAC;AACf,CAAC;AAPD,kBAOC","sourcesContent":["/**\n * Insert word break tags ``<wbr>`` into the given string.\n *\n * Breaks the given string at ``_``, ``-`` and captial letters.\n *\n * @param str The string that should be split.\n * @return The original string containing ``<wbr>`` tags where possible.\n */\nexport function wbr(options: any): string {\n let str = typeof options === 'string' ? options : options.fn(this);\n\n str = str.replace(/([^_\\-][_\\-])([^_\\-])/g, (m: string, a: string, b: string) => a + '<wbr>' + b);\n str = str.replace(/([^A-Z])([A-Z][^A-Z])/g, (m: string, a: string, b: string) => a + '<wbr>' + b);\n\n return str;\n}\n"]}
\No newline at end of file