Sha256: eb86642e5d643b0c13a9f04207b282dd21bb19b8790fe32e586b6c62461c9c5e
Contents?: true
Size: 512 Bytes
Versions: 13
Compression:
Stored size: 512 Bytes
Contents
let wordCount = (input: string) => input |> Js.String.toLowerCase |> Js.String.replaceByRe([%re "/[^'a-zA-Z0-9]+/g"], " ") |> Js.String.trim |> Js.String.splitByRe([%re "/'?\\s+'?/"]) |> Js.Array.reduce( (dict, word) => { let count = Js.Dict.get(dict, word); switch (count) { | Some(value) => Js.Dict.set(dict, word, value + 1) | None => Js.Dict.set(dict, word, 1) }; dict; }, Js.Dict.empty(), ) |> Js.Dict.entries;
Version data entries
13 entries across 13 versions & 1 rubygems