diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/data/text.lux | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux index e9fa52957..8502d1d76 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -71,7 +71,7 @@ output (is (Maybe Nat) {.#None})]) (let [output' ("lux text index" offset part text)] - (case output' + (when output' {.#None} output @@ -80,7 +80,7 @@ (def .public (starts_with? prefix x) (-> Text Text Bit) - (case (index prefix x) + (when (index prefix x) {.#Some 0} true @@ -89,7 +89,7 @@ (def .public (ends_with? postfix x) (-> Text Text Bit) - (case (last_index postfix x) + (when (last_index postfix x) {.#Some n} (n.= (size x) (n.+ (size postfix) n)) @@ -104,7 +104,7 @@ (def .public (contains? sub text) (-> Text Text Bit) - (case ("lux text index" 0 sub text) + (when ("lux text index" 0 sub text) {.#Some _} true @@ -146,7 +146,7 @@ (def .public (split_at at x) (-> Nat Text (Maybe [Text Text])) - (case [(..clip 0 at x) (..clip_since at x)] + (when [(..clip 0 at x) (..clip_since at x)] [{.#Some pre} {.#Some post}] {.#Some [pre post]} @@ -165,7 +165,7 @@ (-> Text Text (List Text)) (loop (again [input sample output (is (List Text) (list))]) - (case (..split_by token input) + (when (..split_by token input) {.#Some [pre post]} (|> output {.#Item pre} @@ -185,9 +185,9 @@ (for @.js (these (def defined? (macro (_ tokens lux) - (case tokens + (when tokens (list it) - {.#Right [lux (list (` (.case ("js type-of" ("js constant" (, it))) + {.#Right [lux (list (` (.when ("js type-of" ("js constant" (, it))) "undefined" .false @@ -198,7 +198,7 @@ {.#Left ""}))) (def if_nashorn (macro (_ tokens lux) - (case tokens + (when tokens (list then else) {.#Right [lux (list (if (and (..defined? "java") (..defined? "java.lang") @@ -215,7 +215,7 @@ (with_expansions [... Inefficient default <default> (loop (again [left "" right template]) - (case (..split_by pattern right) + (when (..split_by pattern right) {.#Some [pre post]} (again (all "lux text concat" left pre replacement) post) @@ -320,13 +320,13 @@ (def .public (interposed separator texts) (-> Text (List Text) Text) - (case separator + (when separator "" (..together texts) _ (|> texts (list.interposed separator) ..together))) (def .public (empty? text) (-> Text Bit) - (case text + (when text "" true _ false)) @@ -347,7 +347,7 @@ [..carriage_return] [..form_feed] )] - (`` (case char + (`` (when char <options> _ |