diff --git a/docs/assets/search.js b/docs/assets/search.js index 9410d5a..df4af11 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = JSON.parse("{\"rows\":[{\"kind\":2,\"name\":\"index\",\"url\":\"modules/index.html\",\"classes\":\"\"},{\"kind\":128,\"name\":\"LineWrap\",\"url\":\"classes/index.LineWrap.html\",\"classes\":\"\",\"parent\":\"index\"},{\"kind\":1024,\"name\":\"OVERFLOW_VISIBLE\",\"url\":\"classes/index.LineWrap.html#OVERFLOW_VISIBLE\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"OVERFLOW_CLIP\",\"url\":\"classes/index.LineWrap.html#OVERFLOW_CLIP\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"OVERFLOW_ANYWHERE\",\"url\":\"classes/index.LineWrap.html#OVERFLOW_ANYWHERE\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"DEFAULT_OPTIONS\",\"url\":\"classes/index.LineWrap.html#DEFAULT_OPTIONS\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/index.LineWrap.html#constructor\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#graphemes\",\"url\":\"classes/index.LineWrap.html#_graphemes\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#rules\",\"url\":\"classes/index.LineWrap.html#_rules\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#opts\",\"url\":\"classes/index.LineWrap.html#_opts\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"classes/index.LineWrap.html#_opts.__type\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts\"},{\"kind\":1024,\"name\":\"ellipsis\",\"url\":\"classes/index.LineWrap.html#_opts.__type.ellipsis\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"example7\",\"url\":\"classes/index.LineWrap.html#_opts.__type.example7\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"firstCol\",\"url\":\"classes/index.LineWrap.html#_opts.__type.firstCol\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"hyphen\",\"url\":\"classes/index.LineWrap.html#_opts.__type.hyphen\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"indent\",\"url\":\"classes/index.LineWrap.html#_opts.__type.indent\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"indentChar\",\"url\":\"classes/index.LineWrap.html#_opts.__type.indentChar\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"indentEmpty\",\"url\":\"classes/index.LineWrap.html#_opts.__type.indentEmpty\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"indentFirst\",\"url\":\"classes/index.LineWrap.html#_opts.__type.indentFirst\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"isNewline\",\"url\":\"classes/index.LineWrap.html#_opts.__type.isNewline\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"locale\",\"url\":\"classes/index.LineWrap.html#_opts.__type.locale\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"newline\",\"url\":\"classes/index.LineWrap.html#_opts.__type.newline\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"newlineReplacement\",\"url\":\"classes/index.LineWrap.html#_opts.__type.newlineReplacement\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"overflow\",\"url\":\"classes/index.LineWrap.html#_opts.__type.overflow\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"verbose\",\"url\":\"classes/index.LineWrap.html#_opts.__type.verbose\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"width\",\"url\":\"classes/index.LineWrap.html#_opts.__type.width\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"escape\",\"url\":\"classes/index.LineWrap.html#_opts.__type.escape\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"#firstIndent\",\"url\":\"classes/index.LineWrap.html#_firstIndent\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#indent\",\"url\":\"classes/index.LineWrap.html#_indent\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#indentWidth\",\"url\":\"classes/index.LineWrap.html#_indentWidth\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#replacementWidth\",\"url\":\"classes/index.LineWrap.html#_replacementWidth\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#enderWidth\",\"url\":\"classes/index.LineWrap.html#_enderWidth\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#workingWidth\",\"url\":\"classes/index.LineWrap.html#_workingWidth\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":2048,\"name\":\"#graphemeCount\",\"url\":\"classes/index.LineWrap.html#_graphemeCount\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":2048,\"name\":\"#fragments\",\"url\":\"classes/index.LineWrap.html#_fragments\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":2048,\"name\":\"#chunks\",\"url\":\"classes/index.LineWrap.html#_chunks\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":2048,\"name\":\"lines\",\"url\":\"classes/index.LineWrap.html#lines\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":2048,\"name\":\"wrap\",\"url\":\"classes/index.LineWrap.html#wrap\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":4194304,\"name\":\"EscapeString\",\"url\":\"types/index.EscapeString.html\",\"classes\":\"\",\"parent\":\"index\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"types/index.EscapeString.html#__type\",\"classes\":\"\",\"parent\":\"index.EscapeString\"},{\"kind\":2,\"name\":\"spacebreaker\",\"url\":\"modules/spacebreaker.html\",\"classes\":\"\"},{\"kind\":128,\"name\":\"SpaceBreaker\",\"url\":\"classes/spacebreaker.SpaceBreaker.html\",\"classes\":\"\",\"parent\":\"spacebreaker\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/spacebreaker.SpaceBreaker.html#constructor\",\"classes\":\"\",\"parent\":\"spacebreaker.SpaceBreaker\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"comment\"],\"fieldVectors\":[[\"name/0\",[0,33.787]],[\"comment/0\",[]],[\"name/1\",[1,33.787]],[\"comment/1\",[]],[\"name/2\",[2,33.787]],[\"comment/2\",[]],[\"name/3\",[3,33.787]],[\"comment/3\",[]],[\"name/4\",[4,33.787]],[\"comment/4\",[]],[\"name/5\",[5,33.787]],[\"comment/5\",[]],[\"name/6\",[6,28.679]],[\"comment/6\",[]],[\"name/7\",[7,33.787]],[\"comment/7\",[]],[\"name/8\",[8,33.787]],[\"comment/8\",[]],[\"name/9\",[9,33.787]],[\"comment/9\",[]],[\"name/10\",[10,28.679]],[\"comment/10\",[]],[\"name/11\",[11,33.787]],[\"comment/11\",[]],[\"name/12\",[12,33.787]],[\"comment/12\",[]],[\"name/13\",[13,33.787]],[\"comment/13\",[]],[\"name/14\",[14,33.787]],[\"comment/14\",[]],[\"name/15\",[15,28.679]],[\"comment/15\",[]],[\"name/16\",[16,33.787]],[\"comment/16\",[]],[\"name/17\",[17,33.787]],[\"comment/17\",[]],[\"name/18\",[18,33.787]],[\"comment/18\",[]],[\"name/19\",[19,33.787]],[\"comment/19\",[]],[\"name/20\",[20,33.787]],[\"comment/20\",[]],[\"name/21\",[21,33.787]],[\"comment/21\",[]],[\"name/22\",[22,33.787]],[\"comment/22\",[]],[\"name/23\",[23,33.787]],[\"comment/23\",[]],[\"name/24\",[24,33.787]],[\"comment/24\",[]],[\"name/25\",[25,33.787]],[\"comment/25\",[]],[\"name/26\",[26,33.787]],[\"comment/26\",[]],[\"name/27\",[27,33.787]],[\"comment/27\",[]],[\"name/28\",[15,28.679]],[\"comment/28\",[]],[\"name/29\",[28,33.787]],[\"comment/29\",[]],[\"name/30\",[29,33.787]],[\"comment/30\",[]],[\"name/31\",[30,33.787]],[\"comment/31\",[]],[\"name/32\",[31,33.787]],[\"comment/32\",[]],[\"name/33\",[32,33.787]],[\"comment/33\",[]],[\"name/34\",[33,33.787]],[\"comment/34\",[]],[\"name/35\",[34,33.787]],[\"comment/35\",[]],[\"name/36\",[35,33.787]],[\"comment/36\",[]],[\"name/37\",[36,33.787]],[\"comment/37\",[]],[\"name/38\",[37,33.787]],[\"comment/38\",[]],[\"name/39\",[10,28.679]],[\"comment/39\",[]],[\"name/40\",[38,28.679]],[\"comment/40\",[]],[\"name/41\",[38,28.679]],[\"comment/41\",[]],[\"name/42\",[6,28.679]],[\"comment/42\",[]]],\"invertedIndex\":[[\"__type\",{\"_index\":10,\"name\":{\"10\":{},\"39\":{}},\"comment\":{}}],[\"chunks\",{\"_index\":34,\"name\":{\"35\":{}},\"comment\":{}}],[\"constructor\",{\"_index\":6,\"name\":{\"6\":{},\"42\":{}},\"comment\":{}}],[\"default_options\",{\"_index\":5,\"name\":{\"5\":{}},\"comment\":{}}],[\"ellipsis\",{\"_index\":11,\"name\":{\"11\":{}},\"comment\":{}}],[\"enderwidth\",{\"_index\":30,\"name\":{\"31\":{}},\"comment\":{}}],[\"escape\",{\"_index\":26,\"name\":{\"26\":{}},\"comment\":{}}],[\"escapestring\",{\"_index\":37,\"name\":{\"38\":{}},\"comment\":{}}],[\"example7\",{\"_index\":12,\"name\":{\"12\":{}},\"comment\":{}}],[\"firstcol\",{\"_index\":13,\"name\":{\"13\":{}},\"comment\":{}}],[\"firstindent\",{\"_index\":27,\"name\":{\"27\":{}},\"comment\":{}}],[\"fragments\",{\"_index\":33,\"name\":{\"34\":{}},\"comment\":{}}],[\"graphemecount\",{\"_index\":32,\"name\":{\"33\":{}},\"comment\":{}}],[\"graphemes\",{\"_index\":7,\"name\":{\"7\":{}},\"comment\":{}}],[\"hyphen\",{\"_index\":14,\"name\":{\"14\":{}},\"comment\":{}}],[\"indent\",{\"_index\":15,\"name\":{\"15\":{},\"28\":{}},\"comment\":{}}],[\"indentchar\",{\"_index\":16,\"name\":{\"16\":{}},\"comment\":{}}],[\"indentempty\",{\"_index\":17,\"name\":{\"17\":{}},\"comment\":{}}],[\"indentfirst\",{\"_index\":18,\"name\":{\"18\":{}},\"comment\":{}}],[\"indentwidth\",{\"_index\":28,\"name\":{\"29\":{}},\"comment\":{}}],[\"index\",{\"_index\":0,\"name\":{\"0\":{}},\"comment\":{}}],[\"isnewline\",{\"_index\":19,\"name\":{\"19\":{}},\"comment\":{}}],[\"lines\",{\"_index\":35,\"name\":{\"36\":{}},\"comment\":{}}],[\"linewrap\",{\"_index\":1,\"name\":{\"1\":{}},\"comment\":{}}],[\"locale\",{\"_index\":20,\"name\":{\"20\":{}},\"comment\":{}}],[\"newline\",{\"_index\":21,\"name\":{\"21\":{}},\"comment\":{}}],[\"newlinereplacement\",{\"_index\":22,\"name\":{\"22\":{}},\"comment\":{}}],[\"opts\",{\"_index\":9,\"name\":{\"9\":{}},\"comment\":{}}],[\"overflow\",{\"_index\":23,\"name\":{\"23\":{}},\"comment\":{}}],[\"overflow_anywhere\",{\"_index\":4,\"name\":{\"4\":{}},\"comment\":{}}],[\"overflow_clip\",{\"_index\":3,\"name\":{\"3\":{}},\"comment\":{}}],[\"overflow_visible\",{\"_index\":2,\"name\":{\"2\":{}},\"comment\":{}}],[\"replacementwidth\",{\"_index\":29,\"name\":{\"30\":{}},\"comment\":{}}],[\"rules\",{\"_index\":8,\"name\":{\"8\":{}},\"comment\":{}}],[\"spacebreaker\",{\"_index\":38,\"name\":{\"40\":{},\"41\":{}},\"comment\":{}}],[\"verbose\",{\"_index\":24,\"name\":{\"24\":{}},\"comment\":{}}],[\"width\",{\"_index\":25,\"name\":{\"25\":{}},\"comment\":{}}],[\"workingwidth\",{\"_index\":31,\"name\":{\"32\":{}},\"comment\":{}}],[\"wrap\",{\"_index\":36,\"name\":{\"37\":{}},\"comment\":{}}]],\"pipeline\":[]}}"); \ No newline at end of file +window.searchData = JSON.parse("{\"rows\":[{\"kind\":2,\"name\":\"index\",\"url\":\"modules/index.html\",\"classes\":\"\"},{\"kind\":128,\"name\":\"LineWrap\",\"url\":\"classes/index.LineWrap.html\",\"classes\":\"\",\"parent\":\"index\"},{\"kind\":1024,\"name\":\"OVERFLOW_VISIBLE\",\"url\":\"classes/index.LineWrap.html#OVERFLOW_VISIBLE\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"OVERFLOW_CLIP\",\"url\":\"classes/index.LineWrap.html#OVERFLOW_CLIP\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"OVERFLOW_ANYWHERE\",\"url\":\"classes/index.LineWrap.html#OVERFLOW_ANYWHERE\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"DEFAULT_OPTIONS\",\"url\":\"classes/index.LineWrap.html#DEFAULT_OPTIONS\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/index.LineWrap.html#constructor\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#stringWidth\",\"url\":\"classes/index.LineWrap.html#_stringWidth\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#rules\",\"url\":\"classes/index.LineWrap.html#_rules\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#opts\",\"url\":\"classes/index.LineWrap.html#_opts\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"classes/index.LineWrap.html#_opts.__type\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts\"},{\"kind\":1024,\"name\":\"ellipsis\",\"url\":\"classes/index.LineWrap.html#_opts.__type.ellipsis\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"example7\",\"url\":\"classes/index.LineWrap.html#_opts.__type.example7\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"firstCol\",\"url\":\"classes/index.LineWrap.html#_opts.__type.firstCol\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"hyphen\",\"url\":\"classes/index.LineWrap.html#_opts.__type.hyphen\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"indent\",\"url\":\"classes/index.LineWrap.html#_opts.__type.indent\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"indentChar\",\"url\":\"classes/index.LineWrap.html#_opts.__type.indentChar\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"indentEmpty\",\"url\":\"classes/index.LineWrap.html#_opts.__type.indentEmpty\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"indentFirst\",\"url\":\"classes/index.LineWrap.html#_opts.__type.indentFirst\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"isCJK\",\"url\":\"classes/index.LineWrap.html#_opts.__type.isCJK\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"isNewline\",\"url\":\"classes/index.LineWrap.html#_opts.__type.isNewline\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"locale\",\"url\":\"classes/index.LineWrap.html#_opts.__type.locale\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"newline\",\"url\":\"classes/index.LineWrap.html#_opts.__type.newline\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"newlineReplacement\",\"url\":\"classes/index.LineWrap.html#_opts.__type.newlineReplacement\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"overflow\",\"url\":\"classes/index.LineWrap.html#_opts.__type.overflow\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"verbose\",\"url\":\"classes/index.LineWrap.html#_opts.__type.verbose\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"width\",\"url\":\"classes/index.LineWrap.html#_opts.__type.width\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"escape\",\"url\":\"classes/index.LineWrap.html#_opts.__type.escape\",\"classes\":\"\",\"parent\":\"index.LineWrap.#opts.__type\"},{\"kind\":1024,\"name\":\"#firstIndent\",\"url\":\"classes/index.LineWrap.html#_firstIndent\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#indent\",\"url\":\"classes/index.LineWrap.html#_indent\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#indentWidth\",\"url\":\"classes/index.LineWrap.html#_indentWidth\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#replacementWidth\",\"url\":\"classes/index.LineWrap.html#_replacementWidth\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#enderWidth\",\"url\":\"classes/index.LineWrap.html#_enderWidth\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":1024,\"name\":\"#workingWidth\",\"url\":\"classes/index.LineWrap.html#_workingWidth\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":262144,\"name\":\"isCJK\",\"url\":\"classes/index.LineWrap.html#isCJK-1\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":262144,\"name\":\"locale\",\"url\":\"classes/index.LineWrap.html#locale-1\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":2048,\"name\":\"#fragments\",\"url\":\"classes/index.LineWrap.html#_fragments\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":2048,\"name\":\"#chunks\",\"url\":\"classes/index.LineWrap.html#_chunks\",\"classes\":\"tsd-is-private\",\"parent\":\"index.LineWrap\"},{\"kind\":2048,\"name\":\"lines\",\"url\":\"classes/index.LineWrap.html#lines\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":2048,\"name\":\"wrap\",\"url\":\"classes/index.LineWrap.html#wrap\",\"classes\":\"\",\"parent\":\"index.LineWrap\"},{\"kind\":4194304,\"name\":\"EscapeString\",\"url\":\"types/index.EscapeString.html\",\"classes\":\"\",\"parent\":\"index\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"types/index.EscapeString.html#__type\",\"classes\":\"\",\"parent\":\"index.EscapeString\"},{\"kind\":2,\"name\":\"spacebreaker\",\"url\":\"modules/spacebreaker.html\",\"classes\":\"\"},{\"kind\":128,\"name\":\"SpaceBreaker\",\"url\":\"classes/spacebreaker.SpaceBreaker.html\",\"classes\":\"\",\"parent\":\"spacebreaker\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/spacebreaker.SpaceBreaker.html#constructor\",\"classes\":\"\",\"parent\":\"spacebreaker.SpaceBreaker\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"comment\"],\"fieldVectors\":[[\"name/0\",[0,34.232]],[\"comment/0\",[]],[\"name/1\",[1,34.232]],[\"comment/1\",[]],[\"name/2\",[2,34.232]],[\"comment/2\",[]],[\"name/3\",[3,34.232]],[\"comment/3\",[]],[\"name/4\",[4,34.232]],[\"comment/4\",[]],[\"name/5\",[5,34.232]],[\"comment/5\",[]],[\"name/6\",[6,29.124]],[\"comment/6\",[]],[\"name/7\",[7,34.232]],[\"comment/7\",[]],[\"name/8\",[8,34.232]],[\"comment/8\",[]],[\"name/9\",[9,34.232]],[\"comment/9\",[]],[\"name/10\",[10,29.124]],[\"comment/10\",[]],[\"name/11\",[11,34.232]],[\"comment/11\",[]],[\"name/12\",[12,34.232]],[\"comment/12\",[]],[\"name/13\",[13,34.232]],[\"comment/13\",[]],[\"name/14\",[14,34.232]],[\"comment/14\",[]],[\"name/15\",[15,29.124]],[\"comment/15\",[]],[\"name/16\",[16,34.232]],[\"comment/16\",[]],[\"name/17\",[17,34.232]],[\"comment/17\",[]],[\"name/18\",[18,34.232]],[\"comment/18\",[]],[\"name/19\",[19,29.124]],[\"comment/19\",[]],[\"name/20\",[20,34.232]],[\"comment/20\",[]],[\"name/21\",[21,29.124]],[\"comment/21\",[]],[\"name/22\",[22,34.232]],[\"comment/22\",[]],[\"name/23\",[23,34.232]],[\"comment/23\",[]],[\"name/24\",[24,34.232]],[\"comment/24\",[]],[\"name/25\",[25,34.232]],[\"comment/25\",[]],[\"name/26\",[26,34.232]],[\"comment/26\",[]],[\"name/27\",[27,34.232]],[\"comment/27\",[]],[\"name/28\",[28,34.232]],[\"comment/28\",[]],[\"name/29\",[15,29.124]],[\"comment/29\",[]],[\"name/30\",[29,34.232]],[\"comment/30\",[]],[\"name/31\",[30,34.232]],[\"comment/31\",[]],[\"name/32\",[31,34.232]],[\"comment/32\",[]],[\"name/33\",[32,34.232]],[\"comment/33\",[]],[\"name/34\",[19,29.124]],[\"comment/34\",[]],[\"name/35\",[21,29.124]],[\"comment/35\",[]],[\"name/36\",[33,34.232]],[\"comment/36\",[]],[\"name/37\",[34,34.232]],[\"comment/37\",[]],[\"name/38\",[35,34.232]],[\"comment/38\",[]],[\"name/39\",[36,34.232]],[\"comment/39\",[]],[\"name/40\",[37,34.232]],[\"comment/40\",[]],[\"name/41\",[10,29.124]],[\"comment/41\",[]],[\"name/42\",[38,29.124]],[\"comment/42\",[]],[\"name/43\",[38,29.124]],[\"comment/43\",[]],[\"name/44\",[6,29.124]],[\"comment/44\",[]]],\"invertedIndex\":[[\"__type\",{\"_index\":10,\"name\":{\"10\":{},\"41\":{}},\"comment\":{}}],[\"chunks\",{\"_index\":34,\"name\":{\"37\":{}},\"comment\":{}}],[\"constructor\",{\"_index\":6,\"name\":{\"6\":{},\"44\":{}},\"comment\":{}}],[\"default_options\",{\"_index\":5,\"name\":{\"5\":{}},\"comment\":{}}],[\"ellipsis\",{\"_index\":11,\"name\":{\"11\":{}},\"comment\":{}}],[\"enderwidth\",{\"_index\":31,\"name\":{\"32\":{}},\"comment\":{}}],[\"escape\",{\"_index\":27,\"name\":{\"27\":{}},\"comment\":{}}],[\"escapestring\",{\"_index\":37,\"name\":{\"40\":{}},\"comment\":{}}],[\"example7\",{\"_index\":12,\"name\":{\"12\":{}},\"comment\":{}}],[\"firstcol\",{\"_index\":13,\"name\":{\"13\":{}},\"comment\":{}}],[\"firstindent\",{\"_index\":28,\"name\":{\"28\":{}},\"comment\":{}}],[\"fragments\",{\"_index\":33,\"name\":{\"36\":{}},\"comment\":{}}],[\"hyphen\",{\"_index\":14,\"name\":{\"14\":{}},\"comment\":{}}],[\"indent\",{\"_index\":15,\"name\":{\"15\":{},\"29\":{}},\"comment\":{}}],[\"indentchar\",{\"_index\":16,\"name\":{\"16\":{}},\"comment\":{}}],[\"indentempty\",{\"_index\":17,\"name\":{\"17\":{}},\"comment\":{}}],[\"indentfirst\",{\"_index\":18,\"name\":{\"18\":{}},\"comment\":{}}],[\"indentwidth\",{\"_index\":29,\"name\":{\"30\":{}},\"comment\":{}}],[\"index\",{\"_index\":0,\"name\":{\"0\":{}},\"comment\":{}}],[\"iscjk\",{\"_index\":19,\"name\":{\"19\":{},\"34\":{}},\"comment\":{}}],[\"isnewline\",{\"_index\":20,\"name\":{\"20\":{}},\"comment\":{}}],[\"lines\",{\"_index\":35,\"name\":{\"38\":{}},\"comment\":{}}],[\"linewrap\",{\"_index\":1,\"name\":{\"1\":{}},\"comment\":{}}],[\"locale\",{\"_index\":21,\"name\":{\"21\":{},\"35\":{}},\"comment\":{}}],[\"newline\",{\"_index\":22,\"name\":{\"22\":{}},\"comment\":{}}],[\"newlinereplacement\",{\"_index\":23,\"name\":{\"23\":{}},\"comment\":{}}],[\"opts\",{\"_index\":9,\"name\":{\"9\":{}},\"comment\":{}}],[\"overflow\",{\"_index\":24,\"name\":{\"24\":{}},\"comment\":{}}],[\"overflow_anywhere\",{\"_index\":4,\"name\":{\"4\":{}},\"comment\":{}}],[\"overflow_clip\",{\"_index\":3,\"name\":{\"3\":{}},\"comment\":{}}],[\"overflow_visible\",{\"_index\":2,\"name\":{\"2\":{}},\"comment\":{}}],[\"replacementwidth\",{\"_index\":30,\"name\":{\"31\":{}},\"comment\":{}}],[\"rules\",{\"_index\":8,\"name\":{\"8\":{}},\"comment\":{}}],[\"spacebreaker\",{\"_index\":38,\"name\":{\"42\":{},\"43\":{}},\"comment\":{}}],[\"stringwidth\",{\"_index\":7,\"name\":{\"7\":{}},\"comment\":{}}],[\"verbose\",{\"_index\":25,\"name\":{\"25\":{}},\"comment\":{}}],[\"width\",{\"_index\":26,\"name\":{\"26\":{}},\"comment\":{}}],[\"workingwidth\",{\"_index\":32,\"name\":{\"33\":{}},\"comment\":{}}],[\"wrap\",{\"_index\":36,\"name\":{\"39\":{}},\"comment\":{}}]],\"pipeline\":[]}}"); \ No newline at end of file diff --git a/docs/classes/index.LineWrap.html b/docs/classes/index.LineWrap.html index 6870d48..b5db9d4 100644 --- a/docs/classes/index.LineWrap.html +++ b/docs/classes/index.LineWrap.html @@ -21,7 +21,7 @@

Hierarchy

+
  • Defined in lib/index.js:24
  • @@ -39,19 +39,23 @@

    Properties

    OVERFLOW_VISIBLE #enderWidth #firstIndent -#graphemes #indent #indentWidth #opts #replacementWidth #rules +#stringWidth #workingWidth
    +

    Accessors

    +
    +

    Methods

    @@ -71,7 +75,7 @@
    Optional Returns LineWrap
    +
  • Defined in lib/index.js:157
  • Properties

    @@ -79,7 +83,7 @@
    +
  • Defined in lib/index.js:134
  • OVERFLOW_ANYWHERE: symbol = ...
    @@ -88,7 +92,7 @@
    +
  • Defined in lib/index.js:42
  • OVERFLOW_CLIP: symbol = ...
    @@ -97,7 +101,7 @@
    +
  • Defined in lib/index.js:36
  • OVERFLOW_VISIBLE: symbol = ...
    @@ -107,15 +111,15 @@
    +
  • Defined in lib/index.js:30
  • #enderWidth: number
    -

    Width of #opts.ellipsis or #opts.hyphen, in graphemes

    +

    Width of #opts.ellipsis or #opts.hyphen, in display cells

    +
  • Defined in lib/index.js:76
  • #firstIndent: number
    @@ -123,12 +127,7 @@
    -
    - -
    #graphemes: Segmenter
    +
  • Defined in lib/index.js:52
  • #indent: string
    @@ -136,18 +135,18 @@
    +
  • Defined in lib/index.js:58
  • #indentWidth: number
    -

    Length of indent in graphemes

    +

    Length of indent in display cells

    +
  • Defined in lib/index.js:64
  • -
    #opts: {
        ellipsis: string;
        escape: EscapeString;
        example7: boolean;
        firstCol: number;
        hyphen: string;
        indent: string | number;
        indentChar: string;
        indentEmpty: boolean;
        indentFirst: boolean;
        isNewline: RegExp;
        locale: string;
        newline: string;
        newlineReplacement: string;
        overflow: symbol;
        verbose: boolean;
        width: number;
    }
    +
    #opts: {
        ellipsis: string;
        escape: EscapeString;
        example7: boolean;
        firstCol: number;
        hyphen: string;
        indent: string | number;
        indentChar: string;
        indentEmpty: boolean;
        indentFirst: boolean;
        isCJK: boolean;
        isNewline: RegExp;
        locale: string;
        newline: string;
        newlineReplacement: string;
        overflow: symbol;
        verbose: boolean;
        width: number;
    }

    Type declaration

      @@ -175,7 +174,7 @@
      example7firstCol: number

      If indentFirst is false, how many columns was the first line already indented? If NaN, use the indent width, - in graphemes. If indentFirst is true, this is ignored.

      + in display cells. If indentFirst is true, this is ignored.

    • @@ -211,6 +210,11 @@
      indentFirst
  • +
    isCJK: boolean
    +

    If specified, override CJK detection by locale.

    +
    +
  • +
  • isNewline: RegExp

    Regular expression that finds newlines for replacement with newlineReplacement. Ensure you @@ -256,20 +260,25 @@

    width
  • +
  • Defined in lib/index.js:46
  • #replacementWidth: number
    -

    Width of #opts.newlineReplacement, in graphemes

    +

    Width of #opts.newlineReplacement, in display cells

    +
  • Defined in lib/index.js:70
  • #rules: SpaceBreaker
    +
  • Defined in lib/index.js:45
  • +
    + +
    #stringWidth: StringWidth
    #workingWidth: number
    @@ -277,7 +286,31 @@
    +
  • Defined in lib/index.js:82
  • +
    +

    Accessors

    +
    + +
      +
    • get isCJK(): boolean
    • +
    • +

      Did we determin that we are in a CJK context? Useful for testing.

      +
      +

      Returns boolean

      +
    +
    + +
      +
    • get locale(): string
    • +
    • +

      The calculated locale. Useful for testing.

      +
      +

      Returns string

      +

    Methods

    @@ -298,7 +331,7 @@
    text: Returns Generator<Break, void, unknown>
    +
  • Defined in lib/index.js:321
    • @@ -319,24 +352,7 @@
      first: Returns Generator<Break, void, unknown>
    -
    - -
      - -
    • -

      How many graphemes are in this string?

      -
      -
      -

      Parameters

      -
        -
      • -
        str: string
        -
      -

      Returns number

      -
    +
  • Defined in lib/index.js:245
    • @@ -357,7 +373,7 @@
      text: Returns Generator<string, void, undefined>
    +
  • Defined in lib/index.js:368
  • +
  • Defined in lib/index.js:435
  • +
  • Defined in lib/spacebreaker.js:143
  • Properties

    diff --git a/docs/index.html b/docs/index.html index c436e7d..4c8dab9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -15,6 +15,7 @@

    @cto.af/linewrap

    @cto.af/linewrap

    Wrap lines using Unicode UAX #14 line breaking rules.

    Installation

    npm install @cto.af/linewrap
     
    +

    CLI

    A command line interface is available: @cto.af/linewrap-cli

    API

    import {LineWrap} from '@cto.af/linewrap'
    const w = new LineWrap()
    w.wrap('Lorem ipsum dolor sit amet...') // A string, wrapped to your console length
    for (const line of w.lines('Lorem ipsum dolor sit amet...')) {
    // `line` does not have a newline at the end
    }

    Full API docs are available.

    @@ -145,6 +146,7 @@

    Installation +
  • CLI
  • API
    • diff --git a/docs/modules/index.html b/docs/modules/index.html index 202e7a3..f024a33 100644 --- a/docs/modules/index.html +++ b/docs/modules/index.html @@ -16,7 +16,7 @@
    • index

    Module index

  • +
  • Defined in lib/index.js:1
  • Index

    diff --git a/docs/modules/spacebreaker.html b/docs/modules/spacebreaker.html index 1451d2e..a13abfb 100644 --- a/docs/modules/spacebreaker.html +++ b/docs/modules/spacebreaker.html @@ -16,7 +16,7 @@
  • spacebreaker
  • Module spacebreaker

    +
  • Defined in lib/spacebreaker.js:1
  • Index

    diff --git a/lib/index.js b/lib/index.js index 1eadb6b..c5ca47a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,5 +1,6 @@ import {Break} from '@cto.af/linebreak' import {SpaceBreaker} from './spacebreaker.js' +import {StringWidth} from '@cto.af/string-width' const DEFAULT_LOCALE = new Intl.Segmenter().resolvedOptions().locale const DEFAULT_IS_NEWLINE = /[^\S\r\n\v\f\x85\u2028\u2029]*[\r\n\v\f\x85\u2028\u2029]+\s*/gu @@ -40,7 +41,7 @@ export class LineWrap { */ static OVERFLOW_ANYWHERE = Symbol('overflow-clip') - #graphemes + #stringWidth #rules #opts @@ -57,19 +58,19 @@ export class LineWrap { #indent /** - * Length of indent in graphemes + * Length of indent in display cells * @type {number} */ #indentWidth /** - * Width of #opts.newlineReplacement, in graphemes + * Width of #opts.newlineReplacement, in display cells * @type {number} */ #replacementWidth /** - * Width of #opts.ellipsis or #opts.hyphen, in graphemes + * Width of #opts.ellipsis or #opts.hyphen, in display cells * @type {number} */ #enderWidth @@ -88,7 +89,7 @@ export class LineWrap { * Example 7 of UAX #14. * @prop {number} [firstCol=NaN] If indentFirst is false, how many columns * was the first line already indented? If NaN, use the indent width, - * in graphemes. If indentFirst is true, this is ignored. + * in display cells. If indentFirst is true, this is ignored. * @prop {string} [hyphen='-'] String to use when long word is * split to next line with LineWrap.OVERFLOW_ANYWHERE. * @prop {number|string} [indent=''] If a string, indent every line with @@ -101,6 +102,7 @@ export class LineWrap { * @prop {boolean} [indentFirst=true] Indent the first line? If not, treat * the first line as if it was already indented, giving a short first * line. + * @prop {boolean} [isCJK] If specified, override CJK detection by locale. * @prop {RegExp} [isNewline=DEFAULT_IS_NEWLINE] Regular expression that * finds newlines for replacement with `newlineReplacement`. Ensure you * do not create a regular expression denial of service @@ -139,6 +141,7 @@ export class LineWrap { indentChar: ' ', indentEmpty: false, indentFirst: true, + isCJK: false, isNewline: DEFAULT_IS_NEWLINE, locale: DEFAULT_LOCALE, newline: '\n', @@ -163,9 +166,21 @@ export class LineWrap { example7: this.#opts.example7, verbose: this.#opts.verbose, }) - this.#graphemes = new Intl.Segmenter(this.#opts.locale, { - granularity: 'grapheme', - }) + + /** + * Don't use this.#opts because it's polluted by the default + * @type {{locale?: string, isCJK?: boolean}} + */ + const swOpts = {} + if (typeof opts.locale === 'string') { + swOpts.locale = opts.locale + } + if (typeof opts.isCJK === 'boolean') { + swOpts.isCJK = opts.isCJK + } + this.#stringWidth = new StringWidth(swOpts) + this.#opts.locale = this.#stringWidth.locale + this.#opts.isCJK = this.#stringWidth.isCJK if (typeof this.#opts.indent === 'number') { this.#indent = ''.padEnd( @@ -175,7 +190,7 @@ export class LineWrap { this.#indentWidth = this.#opts.indent } else { this.#indent = this.#opts.indent - this.#indentWidth = this.#graphemeCount(this.#indent) + this.#indentWidth = this.#stringWidth.width(this.#indent) } this.#firstIndent = (this.#opts.indentFirst || isNaN(this.#opts.firstCol)) ? this.#indentWidth : @@ -185,16 +200,18 @@ export class LineWrap { if (this.#workingWidth <= 0) { throw new Error(`No space to wrap, incompatible width and indent: ${this.#workingWidth}`) } - this.#replacementWidth = this.#graphemeCount(this.#opts.newlineReplacement) + this.#replacementWidth = this.#stringWidth.width( + this.#opts.newlineReplacement + ) switch (this.#opts.overflow) { case LineWrap.OVERFLOW_VISIBLE: this.#enderWidth = 0 break case LineWrap.OVERFLOW_CLIP: - this.#enderWidth = this.#graphemeCount(this.#opts.ellipsis) + this.#enderWidth = this.#stringWidth.width(this.#opts.ellipsis) break case LineWrap.OVERFLOW_ANYWHERE: - this.#enderWidth = this.#graphemeCount(this.#opts.hyphen) + this.#enderWidth = this.#stringWidth.width(this.#opts.hyphen) break default: throw new Error(`Invalid overflow style: "${String(this.#opts.overflow)}"`) @@ -205,18 +222,17 @@ export class LineWrap { } /** - * How many graphemes are in this string? - * - * @param {string} str - * @returns {number} + * Did we determin that we are in a CJK context? Useful for testing. */ - #graphemeCount(str) { - // TODO: count widths better, including ZW and ea=F - let ret = 0 - for (const _ of this.#graphemes.segment(str)) { - ret++ - } - return ret + get isCJK() { + return this.#opts.isCJK + } + + /** + * The calculated locale. Useful for testing. + */ + get locale() { + return this.#opts.locale } /** @@ -228,7 +244,7 @@ export class LineWrap { */ *#fragments(brk, first) { const seg = /** @type {string} */ (brk.string) - const graphemes = this.#graphemeCount(seg) + const graphemes = this.#stringWidth.width(seg) const width = (first && !this.#opts.indentFirst) ? this.#opts.width - this.#firstIndent : this.#workingWidth @@ -263,31 +279,34 @@ export class LineWrap { case LineWrap.OVERFLOW_CLIP: { // Clip it, and end with an ellipsis const b = new Break(-1, false) - b.string = [...this.#graphemes.segment(seg)] - .slice(0, width - this.#enderWidth) - .map(s => s.segment) - .join('') + - this.#opts.ellipsis - b.props = {...brk.props, graphemes: width} + const breaks = this.#stringWidth.break( + seg, + width - this.#enderWidth + ) + // Note that breaks[0].cells might be less than width - enderWidth + // assert(breaks.length > 0) + // assert(!breaks[0].last) + b.string = breaks[0].string + this.#opts.ellipsis + b.props = {...brk.props, graphemes: breaks[0].cells + this.#enderWidth} yield b break } case LineWrap.OVERFLOW_ANYWHERE: { - const g = [...this.#graphemes.segment(seg)] - const page = width - this.#enderWidth - // Might be more that one line long. - for (let offset = 0; offset < g.length; offset += page) { + const breaks = this.#stringWidth.break( + seg, + width - this.#enderWidth + ) + for (const {string, cells, last} of breaks) { const b = new Break(-1, false) - const pg = g.slice(offset, offset + page) - b.string = pg.map(s => s.segment).join('') - b.props = {...brk.props, graphemes: pg.length} - if (offset + page < g.length) { - b.string += this.#opts.hyphen - b.props.graphemes += this.#enderWidth + if (last) { + b.string = string + b.props = {...brk.props, graphemes: cells} + } else { + b.string = string + this.#opts.hyphen + b.props = {...brk.props, graphemes: cells + this.#enderWidth} } yield b } - break } } } diff --git a/package-lock.json b/package-lock.json index 28ffde6..e5b58c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,13 +9,14 @@ "version": "1.0.3", "license": "MIT", "dependencies": { - "@cto.af/linebreak": "1.1.0" + "@cto.af/linebreak": "1.1.1", + "@cto.af/string-width": "2.0.0" }, "devDependencies": { "@cto.af/eslint-config": "1.1.2", - "@types/node": "20.2.5", - "c8": "7.14.0", - "eslint": "8.42.0", + "@types/node": "20.3.1", + "c8": "8.0.0", + "eslint": "8.43.0", "mocha": "10.2.0", "rimraf": "5.0.1", "typedoc": "0.24.8", @@ -66,20 +67,32 @@ } }, "node_modules/@cto.af/linebreak": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@cto.af/linebreak/-/linebreak-1.1.0.tgz", - "integrity": "sha512-BH5BCdOW1WoDkb4mg4wWQcaF7V7C70kCGbOCJq/VqYcbFFiyapgXIpeCUCIJ5uYz+Y3j5G695nv70ffI80McFg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@cto.af/linebreak/-/linebreak-1.1.1.tgz", + "integrity": "sha512-U8VyZ3olaKgtoBQrYbRxSNYGytt8tt1TG32laOEZOrWtvRYOV05lE8uahHQiHu7PzQsNKwQAny0M3i0XmmJAxw==", "dependencies": { - "@cto.af/unicode-trie": "1.1.0" + "@cto.af/unicode-trie": "1.2.0" }, "engines": { "node": ">=16" } }, + "node_modules/@cto.af/string-width": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@cto.af/string-width/-/string-width-2.0.0.tgz", + "integrity": "sha512-CbxKyoDo0AiEK5Kx9usqCERMvSUtZihTpT0/eCb3Gi8xCKo8vyIhaL+KdC5fYOtsCzjeyw5mpvPK2JrGVyeykw==", + "dependencies": { + "@cto.af/unicode-trie": "1.2.0", + "emoji-regex": "10.2.1" + }, + "engines": { + "node": ">= 16" + } + }, "node_modules/@cto.af/unicode-trie": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@cto.af/unicode-trie/-/unicode-trie-1.1.0.tgz", - "integrity": "sha512-Ik3vhCWLIyhItlS3cn9WwL5ewCqeFOhrw5rOiRmJgWnl3l+bnzznRJlRrPuhLHDdUTzr8LKR3yban1iQ8kX+Aw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@cto.af/unicode-trie/-/unicode-trie-1.2.0.tgz", + "integrity": "sha512-iJIKJ8eTkiexKllSUBSIgaKvi+Q2JsvDkNpOOra9lSl0m/06X9x/mMLmZ0PfNYxWrbrpSxlkO2GxdOAfLl70sA==", "engines": { "node": ">=16" } @@ -132,9 +145,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.42.0.tgz", - "integrity": "sha512-6SWlXpWU5AvId8Ac7zjzmIOqMOba/JWY8XZ4A7q7Gn1Vlfg/SFFIlrtHXt9nPn4op9ZPAkl91Jao+QQv3r/ukw==", + "version": "8.43.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.43.0.tgz", + "integrity": "sha512-s2UHCoiXfxMvmfzqoN+vrQ84ahUSYde9qNO1MdxmoEhyHWsfmwOpFlwYV+ePJEVc7gFnATGUi376WowX1N7tFg==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -355,9 +368,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.2.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.5.tgz", - "integrity": "sha512-JJulVEQXmiY9Px5axXHeYGLSjhkZEnD+MDPDGbCbIAbMslkKwmygtZFy1X6s/075Yo94sf8GuSlFfPzysQrWZQ==", + "version": "20.3.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.1.tgz", + "integrity": "sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg==", "dev": true }, "node_modules/acorn": { @@ -499,9 +512,9 @@ "dev": true }, "node_modules/c8": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/c8/-/c8-7.14.0.tgz", - "integrity": "sha512-i04rtkkcNcCf7zsQcSv/T9EbUn4RXQ6mropeMcjFOsQXQ0iGLAr/xT6TImQg4+U9hmNpN9XdvPkjUL1IzbgxJw==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/c8/-/c8-8.0.0.tgz", + "integrity": "sha512-XHA5vSfCLglAc0Xt8eLBZMv19lgiBSjnb1FLAQgnwkuhJYEonpilhEB4Ea3jPAbm0FhD6VVJrc0z73jPe7JyGQ==", "dev": true, "dependencies": { "@bcoe/v8-coverage": "^0.2.3", @@ -521,7 +534,7 @@ "c8": "bin/c8.js" }, "engines": { - "node": ">=10.12.0" + "node": ">=12" } }, "node_modules/c8/node_modules/rimraf": { @@ -733,10 +746,9 @@ "dev": true }, "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.2.1.tgz", + "integrity": "sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA==" }, "node_modules/escalade": { "version": "3.1.1", @@ -760,15 +772,15 @@ } }, "node_modules/eslint": { - "version": "8.42.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.42.0.tgz", - "integrity": "sha512-ulg9Ms6E1WPf67PHaEY4/6E2tEn5/f7FXGzr3t9cBMugOmf1INYvuUwwh1aXQN4MfJ6a5K2iNwP3w4AColvI9A==", + "version": "8.43.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.43.0.tgz", + "integrity": "sha512-aaCpf2JqqKesMFGgmRPessmVKjcGXqdlAYLLC3THM8t5nBRZRQ+st5WM/hoJXkdioEXLLbXgclUpM0TXo5HX5Q==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.4.0", "@eslint/eslintrc": "^2.0.3", - "@eslint/js": "8.42.0", + "@eslint/js": "8.43.0", "@humanwhocodes/config-array": "^0.11.10", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -2190,6 +2202,18 @@ "node": ">=8" } }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/string-width/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", diff --git a/package.json b/package.json index dbd15d7..5e62dfd 100644 --- a/package.json +++ b/package.json @@ -28,16 +28,17 @@ "license": "MIT", "devDependencies": { "@cto.af/eslint-config": "1.1.2", - "@types/node": "20.2.5", - "c8": "7.14.0", - "eslint": "8.42.0", + "@types/node": "20.3.1", + "c8": "8.0.0", + "eslint": "8.43.0", "mocha": "10.2.0", "rimraf": "5.0.1", "typedoc": "0.24.8", "typescript": "5.1.3" }, "dependencies": { - "@cto.af/linebreak": "1.1.0" + "@cto.af/linebreak": "1.1.1", + "@cto.af/string-width": "2.0.0" }, "engines": { "node": ">= 16" diff --git a/test/index.test.js b/test/index.test.js index e033405..16e989d 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -117,4 +117,10 @@ describe('line wrapping', () => { console.log = old /* eslint-enable no-console */ }) + + it('handles locale options', () => { + const lw = new LineWrap({locale: 'ko', isCJK: false}) + assert.equal(lw.locale, 'ko') + assert.equal(lw.isCJK, false) + }) })