@liascript/editor 1.1.6--0.15.12 → 1.1.7--0.15.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/.elm/0.19.1/packages/BrianHicks/elm-string-graphemes/1.0.4/LICENSE +0 -11
- package/.elm/0.19.1/packages/BrianHicks/elm-string-graphemes/1.0.4/README.md +0 -172
- package/.elm/0.19.1/packages/BrianHicks/elm-string-graphemes/1.0.4/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/BrianHicks/elm-string-graphemes/1.0.4/docs.json +0 -1
- package/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.1/LICENSE +0 -27
- package/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.1/README.md +0 -107
- package/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.1/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/NoRedInk/elm-json-decode-pipeline/1.0.1/docs.json +0 -1
- package/.elm/0.19.1/packages/andre-dietrich/elm-conditional/1.0.0/LICENSE +0 -29
- package/.elm/0.19.1/packages/andre-dietrich/elm-conditional/1.0.0/README.md +0 -51
- package/.elm/0.19.1/packages/andre-dietrich/elm-conditional/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/andre-dietrich/elm-conditional/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/andre-dietrich/elm-random-regex/1.0.9/LICENSE +0 -21
- package/.elm/0.19.1/packages/andre-dietrich/elm-random-regex/1.0.9/README.md +0 -313
- package/.elm/0.19.1/packages/andre-dietrich/elm-random-regex/1.0.9/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/andre-dietrich/elm-random-regex/1.0.9/docs.json +0 -1
- package/.elm/0.19.1/packages/andre-dietrich/elm-svgbob/5.0.2/LICENSE +0 -202
- package/.elm/0.19.1/packages/andre-dietrich/elm-svgbob/5.0.2/README.md +0 -820
- package/.elm/0.19.1/packages/andre-dietrich/elm-svgbob/5.0.2/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/andre-dietrich/elm-svgbob/5.0.2/docs.json +0 -1
- package/.elm/0.19.1/packages/andre-dietrich/parser-combinators/4.1.0/LICENSE +0 -24
- package/.elm/0.19.1/packages/andre-dietrich/parser-combinators/4.1.0/README.md +0 -7
- package/.elm/0.19.1/packages/andre-dietrich/parser-combinators/4.1.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/andre-dietrich/parser-combinators/4.1.0/docs.json +0 -1
- package/.elm/0.19.1/packages/avh4/elm-color/1.0.0/LICENSE +0 -11
- package/.elm/0.19.1/packages/avh4/elm-color/1.0.0/README.md +0 -57
- package/.elm/0.19.1/packages/avh4/elm-color/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/avh4/elm-color/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/danfishgold/base64-bytes/1.1.0/LICENSE +0 -11
- package/.elm/0.19.1/packages/danfishgold/base64-bytes/1.1.0/README.md +0 -58
- package/.elm/0.19.1/packages/danfishgold/base64-bytes/1.1.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/danfishgold/base64-bytes/1.1.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/browser/1.0.2/LICENSE +0 -11
- package/.elm/0.19.1/packages/elm/browser/1.0.2/README.md +0 -21
- package/.elm/0.19.1/packages/elm/browser/1.0.2/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/browser/1.0.2/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/bytes/1.0.8/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/bytes/1.0.8/README.md +0 -56
- package/.elm/0.19.1/packages/elm/bytes/1.0.8/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/bytes/1.0.8/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/core/1.0.5/LICENSE +0 -11
- package/.elm/0.19.1/packages/elm/core/1.0.5/README.md +0 -30
- package/.elm/0.19.1/packages/elm/core/1.0.5/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/core/1.0.5/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/file/1.0.5/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/file/1.0.5/README.md +0 -127
- package/.elm/0.19.1/packages/elm/file/1.0.5/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/file/1.0.5/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/html/1.0.0/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/html/1.0.0/README.md +0 -50
- package/.elm/0.19.1/packages/elm/html/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/html/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/http/2.0.0/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/http/2.0.0/README.md +0 -36
- package/.elm/0.19.1/packages/elm/http/2.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/http/2.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/json/1.1.3/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/json/1.1.3/README.md +0 -63
- package/.elm/0.19.1/packages/elm/json/1.1.3/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/json/1.1.3/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/random/1.0.0/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/random/1.0.0/README.md +0 -46
- package/.elm/0.19.1/packages/elm/random/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/random/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/regex/1.0.0/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/regex/1.0.0/README.md +0 -59
- package/.elm/0.19.1/packages/elm/regex/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/regex/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/svg/1.0.1/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/svg/1.0.1/README.md +0 -62
- package/.elm/0.19.1/packages/elm/svg/1.0.1/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/svg/1.0.1/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/time/1.0.0/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/time/1.0.0/README.md +0 -94
- package/.elm/0.19.1/packages/elm/time/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/time/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/url/1.0.0/LICENSE +0 -27
- package/.elm/0.19.1/packages/elm/url/1.0.0/README.md +0 -32
- package/.elm/0.19.1/packages/elm/url/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/url/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm/virtual-dom/1.0.3/LICENSE +0 -30
- package/.elm/0.19.1/packages/elm/virtual-dom/1.0.3/README.md +0 -5
- package/.elm/0.19.1/packages/elm/virtual-dom/1.0.3/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm/virtual-dom/1.0.3/docs.json +0 -1
- package/.elm/0.19.1/packages/elm-community/list-extra/8.7.0/LICENSE +0 -21
- package/.elm/0.19.1/packages/elm-community/list-extra/8.7.0/README.md +0 -19
- package/.elm/0.19.1/packages/elm-community/list-extra/8.7.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm-community/list-extra/8.7.0/docs.json +0 -1
- package/.elm/0.19.1/packages/elm-community/random-extra/3.2.0/LICENSE +0 -29
- package/.elm/0.19.1/packages/elm-community/random-extra/3.2.0/README.md +0 -31
- package/.elm/0.19.1/packages/elm-community/random-extra/3.2.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/elm-community/random-extra/3.2.0/docs.json +0 -1
- package/.elm/0.19.1/packages/f0i/statistics/2.0.0/LICENSE +0 -11
- package/.elm/0.19.1/packages/f0i/statistics/2.0.0/README.md +0 -73
- package/.elm/0.19.1/packages/f0i/statistics/2.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/f0i/statistics/2.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/folkertdev/elm-flate/2.0.5/LICENSE +0 -373
- package/.elm/0.19.1/packages/folkertdev/elm-flate/2.0.5/README.md +0 -77
- package/.elm/0.19.1/packages/folkertdev/elm-flate/2.0.5/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/folkertdev/elm-flate/2.0.5/docs.json +0 -1
- package/.elm/0.19.1/packages/justgook/elm-image/5.0.0/LICENSE +0 -9
- package/.elm/0.19.1/packages/justgook/elm-image/5.0.0/README.md +0 -112
- package/.elm/0.19.1/packages/justgook/elm-image/5.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/justgook/elm-image/5.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/jxxcarlson/elm-pseudorandom/1.0.3/LICENSE +0 -11
- package/.elm/0.19.1/packages/jxxcarlson/elm-pseudorandom/1.0.3/README.md +0 -67
- package/.elm/0.19.1/packages/jxxcarlson/elm-pseudorandom/1.0.3/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/jxxcarlson/elm-pseudorandom/1.0.3/docs.json +0 -1
- package/.elm/0.19.1/packages/lock +0 -0
- package/.elm/0.19.1/packages/pablohirafuji/elm-qrcode/4.0.2/LICENSE +0 -27
- package/.elm/0.19.1/packages/pablohirafuji/elm-qrcode/4.0.2/README.md +0 -32
- package/.elm/0.19.1/packages/pablohirafuji/elm-qrcode/4.0.2/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/pablohirafuji/elm-qrcode/4.0.2/docs.json +0 -1
- package/.elm/0.19.1/packages/pilatch/flip/1.0.0/LICENSE +0 -25
- package/.elm/0.19.1/packages/pilatch/flip/1.0.0/README.md +0 -14
- package/.elm/0.19.1/packages/pilatch/flip/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/pilatch/flip/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/registry.dat +0 -0
- package/.elm/0.19.1/packages/rtfeldman/elm-hex/1.0.0/LICENSE +0 -29
- package/.elm/0.19.1/packages/rtfeldman/elm-hex/1.0.0/README.md +0 -13
- package/.elm/0.19.1/packages/rtfeldman/elm-hex/1.0.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/rtfeldman/elm-hex/1.0.0/docs.json +0 -1
- package/.elm/0.19.1/packages/tesk9/accessible-html/4.1.1/LICENSE +0 -27
- package/.elm/0.19.1/packages/tesk9/accessible-html/4.1.1/README.md +0 -72
- package/.elm/0.19.1/packages/tesk9/accessible-html/4.1.1/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/tesk9/accessible-html/4.1.1/docs.json +0 -1
- package/.elm/0.19.1/packages/truqu/elm-base64/2.0.4/LICENSE +0 -22
- package/.elm/0.19.1/packages/truqu/elm-base64/2.0.4/README.md +0 -27
- package/.elm/0.19.1/packages/truqu/elm-base64/2.0.4/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/truqu/elm-base64/2.0.4/docs.json +0 -1
- package/.elm/0.19.1/packages/truqu/elm-md5/1.1.0/LICENSE +0 -27
- package/.elm/0.19.1/packages/truqu/elm-md5/1.1.0/README.md +0 -34
- package/.elm/0.19.1/packages/truqu/elm-md5/1.1.0/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/truqu/elm-md5/1.1.0/docs.json +0 -1
- package/.elm/0.19.1/packages/zwilias/elm-utf-tools/2.0.1/LICENSE +0 -29
- package/.elm/0.19.1/packages/zwilias/elm-utf-tools/2.0.1/README.md +0 -8
- package/.elm/0.19.1/packages/zwilias/elm-utf-tools/2.0.1/artifacts.dat +0 -0
- package/.elm/0.19.1/packages/zwilias/elm-utf-tools/2.0.1/docs.json +0 -1
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2019, Brian Hicks All rights reserved.
|
|
2
|
-
|
|
3
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
-
|
|
5
|
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
-
|
|
7
|
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
-
|
|
9
|
-
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
-
|
|
11
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
# Graphemes
|
|
2
|
-
|
|
3
|
-
Do string operations based on graphemes instead of codepoints or bytes.
|
|
4
|
-
Compare:
|
|
5
|
-
|
|
6
|
-
```elm
|
|
7
|
-
import String.Graphemes
|
|
8
|
-
|
|
9
|
-
String.toList "🦸🏽♂️" --> [ '🦸', '🏽', '\u{200D}', '♂', '\u{FE0F}' ]
|
|
10
|
-
|
|
11
|
-
String.Graphemes.toList "🦸🏽♂️" --> [ "🦸🏽♂️" ]
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
This package currently supports **Unicode 15**.
|
|
15
|
-
|
|
16
|
-
## What's going on here? Graphemes? What are those?
|
|
17
|
-
|
|
18
|
-
Unicode defines a system for encoding characters as numbers.
|
|
19
|
-
These numbers are called codepoints!
|
|
20
|
-
For example, `a` is codepoint 97, usually written in hex like `0x0061`.
|
|
21
|
-
There is a huge range of possible codepoints (from `0x0000` to `0x10FFFF`), although not all of these match a symbol.
|
|
22
|
-
|
|
23
|
-
Codepoints are more complex than numbers, though: for a variety of reasons, a codepoint is encoded using 7 bits instead of 8.
|
|
24
|
-
That means that we can't use regular 32-bit integers to represent them!
|
|
25
|
-
|
|
26
|
-
We do this partially for historical compatibility with ASCII, and partially to save space.
|
|
27
|
-
For example, you can encode `a` (`0x0061`) in 1 byte, but 🦸 (`0x1F9B8`) takes four.
|
|
28
|
-
If they didn't vary in length, you would have to pad out `a` with 3 bytes worth of zeros just to support both in the same string!
|
|
29
|
-
|
|
30
|
-
There's another layer of optimization, though!
|
|
31
|
-
Imagine if you had to store a separate character for each accent mark like a, à, ā, ä, and á.
|
|
32
|
-
You'd have a lot of characters on your hands, even before considering capital and lowercase letters!
|
|
33
|
-
Plus, some languages use multiple accents for some characters!
|
|
34
|
-
The combinations get ridiculous really fast, but we only have 1,114,111 (`0x10FFFF`) possible codepoints!
|
|
35
|
-
So what we do is hardcode some combinations (like ä) for efficiency, but make separate codepoints for accents and let the software figure out how to combine them.
|
|
36
|
-
These are called diacritic marks.
|
|
37
|
-
So in addition to the hardcoded ä, you can put `a` and `¨` together to get the same thing.
|
|
38
|
-
You can do this with more-or-less whatever characters and marks you want.
|
|
39
|
-
|
|
40
|
-
If you get really wild, you end up with z̴̙͒ả̴̫̼̫̀̅ĺ̴̔̿͜g̷̨͇͉̊͐̚o̶̳̣̯͌̓ text!
|
|
41
|
-
|
|
42
|
-
This raises another problem, though… if I have ä, I think of that as a single character, not two.
|
|
43
|
-
But if I've encoded it as two codepoints and ask for the string length, it may tell me I have two characters!
|
|
44
|
-
We deal with that using our final level: the grapheme.
|
|
45
|
-
|
|
46
|
-
A grapheme is what you'd intuitively think of as "a character" in a writing system.
|
|
47
|
-
Whenever you combining codepoints you're working with graphemes.
|
|
48
|
-
This applies to diacritic marks, as we've already explained, and tons of writing systems use graphemes: Hangul, Devanagari, Thai, and Tamil among others!
|
|
49
|
-
But it also applies to emoji!
|
|
50
|
-
For example: 🦸🏽♂️ is composed of 🦸 + 🏽 + zero-width joiner (200D) + ♂ + variation selector 16 (FE0F).
|
|
51
|
-
You tend to think of 🦸🏽♂️ as a single character—a very definite expression which can't really be broken up into constituent parts.
|
|
52
|
-
That means it's a grapheme!
|
|
53
|
-
|
|
54
|
-
But, final subtlety: if you used 🦸 by itself it's a grapheme too.
|
|
55
|
-
The point is not "what codepoints are there?", it's "what is the smallest useful unit when expressing meaning?"
|
|
56
|
-
|
|
57
|
-
### So what?
|
|
58
|
-
|
|
59
|
-
The above means that when we ask questions like "how long is this string?" or "what is the first character here?" we sometimes mix three levels:
|
|
60
|
-
|
|
61
|
-
1. **the byte level.**
|
|
62
|
-
Operations like `String.length` and `String.left` operate here (or, more specifically, they operate at the UTF-16 level, which assumes that codepoints are two bytes wide.)
|
|
63
|
-
You should probably never operate here when working with `String` in Elm.
|
|
64
|
-
It will result in subtle bugs and corrupt data!
|
|
65
|
-
If you know you're working at the byte level, use [`elm/bytes`](https://package.elm-lang.org/packages/elm/bytes/latest/) instead.
|
|
66
|
-
|
|
67
|
-
2. **the codepoint level.**
|
|
68
|
-
Here, our base superhero emoji is only one character, but our skin tone and gender (🦸🏽♂️) take more, as discussed.
|
|
69
|
-
This particular combination happens to be 17 *bytes* but only 5 *codepoints*.
|
|
70
|
-
Operations like `String.foldl` operate here (so you can safely measure codepoint length with operations like `String.foldl (\_ len -> len + 1) 0 "whatever string"`.)
|
|
71
|
-
You should operate here if you're implementing higher-level operations on the codepoints, like grapheme segmentation (hi!) or normalization.
|
|
72
|
-
|
|
73
|
-
3. **the grapheme level.**
|
|
74
|
-
Despite being 5 codepoints, 🦸🏽♂ is only one grapheme️.
|
|
75
|
-
Operations like `String.Graphemes.toList` operate here.
|
|
76
|
-
You should operate here if you're working with unicode text in ways meaningful to a user.
|
|
77
|
-
|
|
78
|
-
To underscore, if you're modifying text that the user has entered, work at the grapheme level.
|
|
79
|
-
This reduces the possibility of errors and increases the possibility that your program will "do the right thing."
|
|
80
|
-
|
|
81
|
-
Still not convinced?
|
|
82
|
-
Here are some practical reasons you should work at the grapheme level in the browser:
|
|
83
|
-
|
|
84
|
-
- If you operate at the *byte* level, you will split multi-byte characters into invalid unicode sequences.
|
|
85
|
-
If you do the wrong thing with these sequences, you'll crash your user's browser.
|
|
86
|
-
In fact, that's what started me writing this library!
|
|
87
|
-
Everyone does it occasionally, but there are better ways.
|
|
88
|
-
|
|
89
|
-
- If you operate at the *character* level, you will split skin tones and genders off of people emoji, split flags into country codes, and move diacritic marks around.
|
|
90
|
-
Your user entered this text precisely in these cases, don't lose their meaning!
|
|
91
|
-
|
|
92
|
-
- Think your app doesn't need those pesky diacritic marks?
|
|
93
|
-
Think again!
|
|
94
|
-
They're crucial to understanding in a lot of languages!
|
|
95
|
-
For example, in Spanish, papa (potato) is different than papá (father.)
|
|
96
|
-
Don't make your users call their dad a potato!
|
|
97
|
-
|
|
98
|
-
## Frequently Asked Questions
|
|
99
|
-
|
|
100
|
-
### What spec does this package implement?
|
|
101
|
-
|
|
102
|
-
The [Grapheme Cluster Boundaries](https://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries) section of [UAX #29](https://unicode.org/reports/tr29/).
|
|
103
|
-
|
|
104
|
-
### Does this package correctly reverse strings with diacritics?
|
|
105
|
-
|
|
106
|
-
Yes!
|
|
107
|
-
It reverses the order of the graphemes, not the codepoints.
|
|
108
|
-
This means that it does not move diacritics around and emoji are perfectly safe.
|
|
109
|
-
|
|
110
|
-
```elm
|
|
111
|
-
import String.Graphemes
|
|
112
|
-
|
|
113
|
-
-- äo without normalization
|
|
114
|
-
String.Graphemes.reverse "a\u{0308}o" --> "oa\u{0308}"
|
|
115
|
-
|
|
116
|
-
-- compare with String
|
|
117
|
-
String.reverse "a\u{0308}o" --> "o\u{0308}a"
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Does this package do normalization?
|
|
121
|
-
|
|
122
|
-
No, and it probably never will.
|
|
123
|
-
It's a [whole 'nother spec](https://unicode.org/reports/tr15/#Norm_Forms) in the Unicode standard which doesn't really fit in this package.
|
|
124
|
-
|
|
125
|
-
That said, it *looks* like you could implement it in a similar way as the internal `String.Graphemes.Parser`, so give it a go in a new package of your own!
|
|
126
|
-
|
|
127
|
-
(n.b. normalization in this case means turning `"a\u{0308}"` into `"ä"`, usually for the purposes of improving equality checks.)
|
|
128
|
-
|
|
129
|
-
### Does this package segment words or sentences?
|
|
130
|
-
|
|
131
|
-
No, and it probably never will.
|
|
132
|
-
Segmenting words and sentences is locale- and implementation-dependent, so it's really hard to address them in a general way.
|
|
133
|
-
Rather than introducing confusion ("it *should* segment here… why doesn't it?") we only segment graphemes.
|
|
134
|
-
|
|
135
|
-
That said, word and sentence segmentation rely on grapheme segmentation, so you're on the right track by asking this!
|
|
136
|
-
[UAX #29](https://unicode.org/reports/tr29/) has guidance here.
|
|
137
|
-
|
|
138
|
-
### Why not "fix" `elm/core`'s `String` instead of writing a new package?
|
|
139
|
-
|
|
140
|
-
The `String` module solves a different—but overlapping—set of problems.
|
|
141
|
-
For example, you do not always want to work with graphemes: sometimes you need to be able to decompose into codepoints or operate at the byte level.
|
|
142
|
-
As usual, it's all tradeoffs.
|
|
143
|
-
|
|
144
|
-
That said, if it eventually becomes obvious that merging into core would be a good thing we may do that.
|
|
145
|
-
In that case, we would probably just keep equivalents of `String.Graphemes.uncons` and `String.Graphemes.foldl`.
|
|
146
|
-
Everything else is implemented in terms of those two operations.
|
|
147
|
-
|
|
148
|
-
### Why a drop-in replacement? / Why does the code refer to `String` functions so much?
|
|
149
|
-
|
|
150
|
-
Unless you've worked with unicode strings a lot, it can be tricky to know which level (bytes, codepoints, or graphemes) you're operating at with any given time.
|
|
151
|
-
So instead of giving you the functions you *might* need, and leaving you to implement the rest on your own, we provide all of them and only change the ones where you'd run into trouble.
|
|
152
|
-
|
|
153
|
-
But not *all* of the functions in `String` need to be modified.
|
|
154
|
-
In those cases, we just pass through to the `String` functions!
|
|
155
|
-
|
|
156
|
-
This way, you don't have to worry about it.
|
|
157
|
-
You could potentially do `import String.Graphemes as String` in a module, fix the type errors, and all of a sudden all your string operations work with graphemes.
|
|
158
|
-
|
|
159
|
-
## Climate Action
|
|
160
|
-
|
|
161
|
-
I want my open-source activities to support projects addressing the climate crisis (for example, projects in clean energy, public transit, reforestation, or sustainable agriculture.)
|
|
162
|
-
If you are working on such a project, and find a bug or missing feature in any of my libraries, **please let me know and I will treat your issue as high priority.**
|
|
163
|
-
I'd also be happy to support such projects in other ways.
|
|
164
|
-
In particular, I've worked with Elm for a long time and would be happy to advise on your implementation.
|
|
165
|
-
|
|
166
|
-
## License
|
|
167
|
-
|
|
168
|
-
This code in this project is licensed under the BSD 3-Clause license, located at LICENSE in the source.
|
|
169
|
-
|
|
170
|
-
The documentation strings in `String.Graphemes` are derived from those in `elm/core`'s `String`, © 2019 Evan Czaplicki, and licensed under the BSD 3-Clause license.
|
|
171
|
-
|
|
172
|
-
The grapheme break property data used here are © 2019 Unicode®, Inc., and licensed under their [terms of use](http://www.unicode.org/terms_of_use.html).
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"name":"String.Graphemes","comment":" A built-in representation for efficient string manipulation. String literals\nare enclosed in `\"double quotes\"`. Strings are _not_ lists of characters.\n\n\n# Strings\n\n@docs isEmpty, length, reverse, repeat, replace\n\n\n# Building and Splitting\n\n@docs append, concat, split, join, words, lines\n\n\n# Get Substrings\n\n@docs slice, left, right, dropLeft, dropRight\n\n\n# Check for Substrings\n\n@docs contains, startsWith, endsWith, indexes, indices\n\n\n# Int Conversions\n\n@docs toInt, fromInt\n\n\n# Float Conversions\n\n@docs toFloat, fromFloat\n\n\n# Char Conversions\n\n@docs fromChar, cons, uncons\n\n\n# List Conversions\n\n@docs toList, fromList\n\n\n# Formatting\n\nCosmetic operations such as padding with extra characters or trimming whitespace.\n\n@docs toUpper, toLower, pad, padLeft, padRight, trim, trimLeft, trimRight\n\n\n# Higher-Order Functions\n\n@docs map, filter, foldl, foldr, any, all\n\n","unions":[],"aliases":[],"values":[{"name":"all","comment":" Determine whether _all_ graphemes pass the test.\n\n all (String.all Char.isDigit) \"90210\" --> True\n\n all (String.all Char.isDigit) \"R2-D2\" --> False\n\n all (String.all Char.isDigit) \"heart\" --> False\n\n","type":"(String.String -> Basics.Bool) -> String.String -> Basics.Bool"},{"name":"any","comment":" Determine whether _any_ graphemes pass the test.\n\n any (String.all Char.isDigit) \"90210\" --> True\n\n any (String.all Char.isDigit) \"R2-D2\" --> True\n\n any (String.all Char.isDigit) \"heart\" --> False\n\n","type":"(String.String -> Basics.Bool) -> String.String -> Basics.Bool"},{"name":"append","comment":" Append two strings. You can also use [the `(++)` operator](Basics#++)\nto do this.\n\n append \"butter\" \"fly\" --> \"butterfly\"\n\n","type":"String.String -> String.String -> String.String"},{"name":"concat","comment":" Concatenate many strings into one.\n\n concat [ \"never\", \"the\", \"less\" ] --> \"nevertheless\"\n\n","type":"List.List String.String -> String.String"},{"name":"cons","comment":" Add a character to the beginning of a string.\n\n cons 'T' \"he truth is out there\" --> \"The truth is out there\"\n\n","type":"Char.Char -> String.String -> String.String"},{"name":"contains","comment":" See if the second string contains the first one.\n\n contains \"the\" \"theory\" --> True\n\n contains \"hat\" \"theory\" --> False\n\n contains \"THE\" \"theory\" --> False\n\n","type":"String.String -> String.String -> Basics.Bool"},{"name":"dropLeft","comment":" Drop _n_ characters from the left side of a string.\n\n dropLeft 2 \"The Lone Gunmen\" --> \"e Lone Gunmen\"\n\n","type":"Basics.Int -> String.String -> String.String"},{"name":"dropRight","comment":" Drop _n_ characters from the right side of a string.\n\n dropRight 2 \"Cigarette Smoking Man\" --> \"Cigarette Smoking M\"\n\n","type":"Basics.Int -> String.String -> String.String"},{"name":"endsWith","comment":" See if the second string ends with the first one.\n\n endsWith \"the\" \"theory\" --> False\n\n endsWith \"ory\" \"theory\" --> True\n\n","type":"String.String -> String.String -> Basics.Bool"},{"name":"filter","comment":" Keep only the graphemes that pass the test.\n\n filter (String.all Char.isDigit) \"R2-D2\" --> \"22\"\n\n","type":"(String.String -> Basics.Bool) -> String.String -> String.String"},{"name":"foldl","comment":" Reduce a string from the left.\n\n foldl (++) \"\" \"time\" --> \"emit\"\n\n","type":"(String.String -> b -> b) -> b -> String.String -> b"},{"name":"foldr","comment":" Reduce a string from the right.\n\n foldr (++) \"\" \"time\" --> \"time\"\n\n","type":"(String.String -> b -> b) -> b -> String.String -> b"},{"name":"fromChar","comment":" Create a string from a given character.\n\n fromChar 'a' --> \"a\"\n\n","type":"Char.Char -> String.String"},{"name":"fromFloat","comment":" Convert a `Float` to a `String`.\n\n String.fromFloat 123 --> \"123\"\n\n String.fromFloat -42 --> \"-42\"\n\n String.fromFloat 3.9 --> \"3.9\"\n\nCheck out [`Debug.toString`](Debug#toString) to convert _any_ value to a string\nfor debugging purposes.\n\n","type":"Basics.Float -> String.String"},{"name":"fromInt","comment":" Convert an `Int` to a `String`.\n\n String.fromInt 123 --> \"123\"\n\n String.fromInt -42 --> \"-42\"\n\nCheck out [`Debug.toString`](Debug#toString) to convert _any_ value to a string\nfor debugging purposes.\n\n","type":"Basics.Int -> String.String"},{"name":"fromList","comment":" Convert a list of graphemes into a String. Can be useful if you\nwant to create a string primarily by consing, perhaps for decoding\nsomething.\n\n fromList [ \"a\", \"b\", \"c\" ] --> \"abc\"\n\n fromList [ \"🙈\", \"🙉\", \"🙊\" ] --> \"🙈🙉🙊\"\n\n","type":"List.List String.String -> String.String"},{"name":"indexes","comment":" Get all of the indexes for a substring in another string.\n\n indexes \"i\" \"Mississippi\" --> [ 1, 4, 7, 10 ]\n\n indexes \"ss\" \"Mississippi\" --> [ 2, 5 ]\n\n indexes \"needle\" \"haystack\" --> []\n\n","type":"String.String -> String.String -> List.List Basics.Int"},{"name":"indices","comment":" Alias for `indexes`.\n","type":"String.String -> String.String -> List.List Basics.Int"},{"name":"isEmpty","comment":" Determine if a string is empty.\n\n isEmpty \"\" --> True\n\n isEmpty \"the world\" --> False\n\n","type":"String.String -> Basics.Bool"},{"name":"join","comment":" Put many strings together with a given separator.\n\n join \"a\" [ \"H\", \"w\", \"ii\", \"n\" ] --> \"Hawaiian\"\n\n join \" \" [ \"cat\", \"dog\", \"cow\" ] --> \"cat dog cow\"\n\n join \"/\" [ \"home\", \"evan\", \"Desktop\" ] --> \"home/evan/Desktop\"\n\n","type":"String.String -> List.List String.String -> String.String"},{"name":"left","comment":" Take _n_ characters from the left side of a string.\n\n left 2 \"Mulder\" --> \"Mu\"\n\n","type":"Basics.Int -> String.String -> String.String"},{"name":"length","comment":" Get the length of a string.\n\n length \"innumerable\" --> 11\n\n length \"\" --> 0\n\n length \"🇨🇦\" --> 1\n\n","type":"String.String -> Basics.Int"},{"name":"lines","comment":" Break a string into lines, splitting on newlines.\n\n lines \"How are you?\\nGood?\" --> [ \"How are you?\", \"Good?\" ]\n\n","type":"String.String -> List.List String.String"},{"name":"map","comment":" Transform every grapheme in a string\n","type":"(String.String -> String.String) -> String.String -> String.String"},{"name":"pad","comment":" Pad a string on both sides until it has a given length.\n\n pad 5 ' ' \"1\" --> \" 1 \"\n\n pad 5 ' ' \"11\" --> \" 11 \"\n\n pad 5 ' ' \"121\" --> \" 121 \"\n\n","type":"Basics.Int -> Char.Char -> String.String -> String.String"},{"name":"padLeft","comment":" Pad a string on the left until it has a given length.\n\n padLeft 5 '.' \"1\" --> \"....1\"\n\n padLeft 5 '.' \"11\" --> \"...11\"\n\n padLeft 5 '.' \"121\" --> \"..121\"\n\n","type":"Basics.Int -> Char.Char -> String.String -> String.String"},{"name":"padRight","comment":" Pad a string on the right until it has a given length.\n\n padRight 5 '.' \"1\" --> \"1....\"\n\n padRight 5 '.' \"11\" --> \"11...\"\n\n padRight 5 '.' \"121\" --> \"121..\"\n\n","type":"Basics.Int -> Char.Char -> String.String -> String.String"},{"name":"repeat","comment":" Repeat a string _n_ times.\n\n repeat 3 \"ha\" --> \"hahaha\"\n\n","type":"Basics.Int -> String.String -> String.String"},{"name":"replace","comment":" Replace all occurrences of some substring.\n\n replace \".\" \"-\" \"Json.Decode.succeed\" --> \"Json-Decode-succeed\"\n\n replace \",\" \"/\" \"a,b,c,d,e\" --> \"a/b/c/d/e\"\n\n**Note:** If you need more advanced replacements, check out the\n[`elm/parser`][parser] or [`elm/regex`][regex] package.\n\n[parser]: /packages/elm/parser/latest\n[regex]: /packages/elm/regex/latest\n\n","type":"String.String -> String.String -> String.String -> String.String"},{"name":"reverse","comment":" Reverse a string.\n\n reverse \"stressed\" --> \"desserts\"\n\n reverse \"🇨🇦🇲🇽\" --> \"🇲🇽🇨🇦\"\n\n","type":"String.String -> String.String"},{"name":"right","comment":" Take _n_ characters from the right side of a string.\n\n right 2 \"Scully\" --> \"ly\"\n\n","type":"Basics.Int -> String.String -> String.String"},{"name":"slice","comment":" Take a substring given a start and end index. Negative indexes\nare taken starting from the _end_ of the list.\n\n slice 7 9 \"snakes on a plane!\" --> \"on\"\n\n slice 0 6 \"snakes on a plane!\" --> \"snakes\"\n\n slice 0 -7 \"snakes on a plane!\" --> \"snakes on a\"\n\n slice -6 -1 \"snakes on a plane!\" --> \"plane\"\n\n","type":"Basics.Int -> Basics.Int -> String.String -> String.String"},{"name":"split","comment":" Split a string using a given separator.\n\n split \",\" \"cat,dog,cow\" --> [ \"cat\", \"dog\", \"cow\" ]\n\n split \"/\" \"home/evan/Desktop/\" --> [ \"home\", \"evan\", \"Desktop\", \"\" ]\n\n**Note:** this will split a string very literally—including breaking grapheme\nboundaries. If this causes problems for you, please open an issue.\n\n","type":"String.String -> String.String -> List.List String.String"},{"name":"startsWith","comment":" See if the second string starts with the first one.\n\n startsWith \"the\" \"theory\" --> True\n\n startsWith \"ory\" \"theory\" --> False\n\n","type":"String.String -> String.String -> Basics.Bool"},{"name":"toFloat","comment":" Try to convert a string into a float, failing on improperly formatted strings.\n","type":"String.String -> Maybe.Maybe Basics.Float"},{"name":"toInt","comment":" Try to convert a string into an int, failing on improperly formatted strings.\n\n String.toInt \"123\" --> Just 123\n\n String.toInt \"-42\" --> Just -42\n\n String.toInt \"3.1\" --> Nothing\n\n String.toInt \"31a\" --> Nothing\n\nIf you are extracting a number from some raw user input, you will typically\nwant to use [`Maybe.withDefault`](Maybe#withDefault) to handle bad data:\n\n Maybe.withDefault 0 (String.toInt \"42\") --> 42\n\n Maybe.withDefault 0 (String.toInt \"ab\") --> 0\n\n","type":"String.String -> Maybe.Maybe Basics.Int"},{"name":"toList","comment":" Convert a string to a list of characters.\n\n toList \"abc\" --> [ \"a\", \"b\", \"c\" ]\n\n toList \"🙈🙉🙊\" --> [ \"🙈\", \"🙉\", \"🙊\" ]\n\n","type":"String.String -> List.List String.String"},{"name":"toLower","comment":" Convert a string to all lower case. Useful for case-insensitive comparisons.\n\n toLower \"X-FILES\" --> \"x-files\"\n\n","type":"String.String -> String.String"},{"name":"toUpper","comment":" Convert a string to all upper case. Useful for case-insensitive comparisons\nand VIRTUAL YELLING.\n\n toUpper \"skinner\" --> \"SKINNER\"\n\n","type":"String.String -> String.String"},{"name":"trim","comment":" Get rid of whitespace on both sides of a string.\n\n trim \" hats \\n\" --> \"hats\"\n\n","type":"String.String -> String.String"},{"name":"trimLeft","comment":" Get rid of whitespace on the left of a string.\n\n trimLeft \" hats \\n\" --> \"hats \\n\"\n\n","type":"String.String -> String.String"},{"name":"trimRight","comment":" Get rid of whitespace on the right of a string.\n\n trimRight \" hats \\n\" --> \" hats\"\n\n","type":"String.String -> String.String"},{"name":"uncons","comment":" Split a non-empty string into its head and tail. This lets you\npattern match on strings exactly as you would with lists.\n\n uncons \"abc\" --> Just ( \"a\", \"bc\" )\n\n uncons \"\" --> Nothing\n\n","type":"String.String -> Maybe.Maybe ( String.String, String.String )"},{"name":"words","comment":" Break a string into words, splitting on chunks of whitespace.\n\n words \"How are \\t you? \\n Good?\" --> [ \"How\", \"are\", \"you?\", \"Good?\" ]\n\n","type":"String.String -> List.List String.String"}],"binops":[]}]
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2016, NoRedInk
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
Redistribution and use in source and binary forms, with or without
|
|
5
|
-
modification, are permitted provided that the following conditions are met:
|
|
6
|
-
|
|
7
|
-
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
-
list of conditions and the following disclaimer.
|
|
9
|
-
|
|
10
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
-
this list of conditions and the following disclaimer in the documentation
|
|
12
|
-
and/or other materials provided with the distribution.
|
|
13
|
-
|
|
14
|
-
* Neither the name of elm-decode-pipeline nor the names of its
|
|
15
|
-
contributors may be used to endorse or promote products derived from
|
|
16
|
-
this software without specific prior written permission.
|
|
17
|
-
|
|
18
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
22
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
23
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
24
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
25
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
26
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
# json-decode-pipeline
|
|
2
|
-
|
|
3
|
-
Build JSON decoders using the pipeline [`(|>)`](http://package.elm-lang.org/packages/elm-lang/core/3.0.0/Basics#|>)
|
|
4
|
-
operator.
|
|
5
|
-
|
|
6
|
-
## Motivation
|
|
7
|
-
|
|
8
|
-
It's common to decode into a record that has a `type alias`. Here's an example
|
|
9
|
-
of this from the [`map3`](http://package.elm-lang.org/packages/elm-lang/core/5.0.0/Json-Decode#map3)
|
|
10
|
-
docs:
|
|
11
|
-
|
|
12
|
-
```elm
|
|
13
|
-
type alias Job = { name : String, id : Int, completed : Bool }
|
|
14
|
-
|
|
15
|
-
point : Decoder Job
|
|
16
|
-
point =
|
|
17
|
-
map3 Job
|
|
18
|
-
(field "name" string)
|
|
19
|
-
(field "id" int)
|
|
20
|
-
(field "completed" bool)
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
This works because a record type alias can be called as a normal function. In
|
|
24
|
-
that case it accepts one argument for each field (in whatever order the fields
|
|
25
|
-
are declared in the type alias) and then returns an appropriate record built
|
|
26
|
-
with those arguments.
|
|
27
|
-
|
|
28
|
-
The `mapN` decoders are straightforward, but require manually changing N
|
|
29
|
-
whenever the field count changes. This library provides functions designed to
|
|
30
|
-
be used with the `|>` operator, with the goal of having decoders that are both
|
|
31
|
-
easy to read and easy to modify.
|
|
32
|
-
|
|
33
|
-
## Examples
|
|
34
|
-
|
|
35
|
-
Here is a decoder built with this library.
|
|
36
|
-
|
|
37
|
-
```elm
|
|
38
|
-
import Json.Decode as Decode exposing (Decoder, decodeString, float, int, nullable, string)
|
|
39
|
-
import Json.Decode.Pipeline exposing (required, optional, hardcoded)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
type alias User =
|
|
43
|
-
{ id : Int
|
|
44
|
-
, email : Maybe String
|
|
45
|
-
, name : String
|
|
46
|
-
, percentExcited : Float
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
userDecoder : Decoder User
|
|
51
|
-
userDecoder =
|
|
52
|
-
Decode.succeed User
|
|
53
|
-
|> required "id" int
|
|
54
|
-
|> required "email" (nullable string) -- `null` decodes to `Nothing`
|
|
55
|
-
|> optional "name" string "(fallback if name is `null` or not present)"
|
|
56
|
-
|> hardcoded 1.0
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
In this example:
|
|
60
|
-
|
|
61
|
-
* `required "id" int` is similar to `(field "id" int)`
|
|
62
|
-
* `optional` is like `required`, but if the field is either `null` or not present, decoding does not fail; instead it succeeds with the provided fallback value.
|
|
63
|
-
* `hardcoded` does not look at the provided JSON, and instead always decodes to the same value.
|
|
64
|
-
|
|
65
|
-
You could use this decoder as follows:
|
|
66
|
-
|
|
67
|
-
```elm
|
|
68
|
-
decodeString
|
|
69
|
-
userDecoder
|
|
70
|
-
"""
|
|
71
|
-
{"id": 123, "email": "sam@example.com", "name": "Sam Sample"}
|
|
72
|
-
"""
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
The result would be:
|
|
76
|
-
|
|
77
|
-
```elm
|
|
78
|
-
{ id = 123
|
|
79
|
-
, email = Just "sam@example.com"
|
|
80
|
-
, name = "Sam Sample"
|
|
81
|
-
, percentExcited = 1.0
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Alternatively, you could use it like so:
|
|
86
|
-
|
|
87
|
-
```elm
|
|
88
|
-
decodeString
|
|
89
|
-
userDecoder
|
|
90
|
-
"""
|
|
91
|
-
{"id": 123, "email": null, "percentExcited": "(hardcoded)"}
|
|
92
|
-
"""
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
In this case, the result would be:
|
|
96
|
-
|
|
97
|
-
```elm
|
|
98
|
-
{ id = 123
|
|
99
|
-
, email = Nothing
|
|
100
|
-
, name = "(fallback if name is `null` or not present)"
|
|
101
|
-
, percentExcited = 1.0
|
|
102
|
-
}
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
[](http://noredink.com/about/team)
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"name":"Json.Decode.Pipeline","comment":"\n\n\n# Json.Decode.Pipeline\n\nUse the `(|>)` operator to build JSON decoders.\n\n\n## Decoding fields\n\n@docs required, requiredAt, optional, optionalAt, hardcoded, custom\n\n\n## Ending pipelines\n\n@docs resolve\n\n","unions":[],"aliases":[],"values":[{"name":"custom","comment":" Run the given decoder and feed its result into the pipeline at this point.\n\nConsider this example.\n\n import Json.Decode as Decode exposing (Decoder, at, int, string)\n import Json.Decode.Pipeline exposing (custom, required)\n\n type alias User =\n { id : Int\n , name : String\n , email : String\n }\n\n userDecoder : Decoder User\n userDecoder =\n Decode.succeed User\n |> required \"id\" int\n |> custom (at [ \"profile\", \"name\" ] string)\n |> required \"email\" string\n\n result : Result String User\n result =\n Decode.decodeString\n userDecoder\n \"\"\"\n {\n \"id\": 123,\n \"email\": \"sam@example.com\",\n \"profile\": {\"name\": \"Sam\"}\n }\n \"\"\"\n\n -- Ok { id = 123, name = \"Sam\", email = \"sam@example.com\" }\n\n","type":"Json.Decode.Decoder a -> Json.Decode.Decoder (a -> b) -> Json.Decode.Decoder b"},{"name":"hardcoded","comment":" Rather than decoding anything, use a fixed value for the next step in the\npipeline. `harcoded` does not look at the JSON at all.\n\n import Json.Decode as Decode exposing (Decoder, int, string)\n import Json.Decode.Pipeline exposing (required)\n\n type alias User =\n { id : Int\n , email : String\n , followers : Int\n }\n\n userDecoder : Decoder User\n userDecoder =\n Decode.succeed User\n |> required \"id\" int\n |> required \"email\" string\n |> hardcoded 0\n\n result : Result String User\n result =\n Decode.decodeString\n userDecoder\n \"\"\"\n {\"id\": 123, \"email\": \"sam@example.com\"}\n \"\"\"\n\n -- Ok { id = 123, email = \"sam@example.com\", followers = 0 }\n\n","type":"a -> Json.Decode.Decoder (a -> b) -> Json.Decode.Decoder b"},{"name":"optional","comment":" Decode a field that may be missing or have a null value. If the field is\nmissing, then it decodes as the `fallback` value. If the field is present,\nthen `valDecoder` is used to decode its value. If `valDecoder` fails on a\n`null` value, then the `fallback` is used as if the field were missing\nentirely.\n\n import Json.Decode as Decode exposing (Decoder, int, null, oneOf, string)\n import Json.Decode.Pipeline exposing (optional, required)\n\n type alias User =\n { id : Int\n , name : String\n , email : String\n }\n\n userDecoder : Decoder User\n userDecoder =\n Decode.succeed User\n |> required \"id\" int\n |> optional \"name\" string \"blah\"\n |> required \"email\" string\n\n result : Result String User\n result =\n Decode.decodeString\n userDecoder\n \"\"\"\n {\"id\": 123, \"email\": \"sam@example.com\" }\n \"\"\"\n\n -- Ok { id = 123, name = \"blah\", email = \"sam@example.com\" }\n\nBecause `valDecoder` is given an opportunity to decode `null` values before\nresorting to the `fallback`, you can distinguish between missing and `null`\nvalues if you need to:\n\n userDecoder2 =\n Decode.succeed User\n |> required \"id\" int\n |> optional \"name\" (oneOf [ string, null \"NULL\" ]) \"MISSING\"\n |> required \"email\" string\n\n","type":"String.String -> Json.Decode.Decoder a -> a -> Json.Decode.Decoder (a -> b) -> Json.Decode.Decoder b"},{"name":"optionalAt","comment":" Decode an optional nested field.\n","type":"List.List String.String -> Json.Decode.Decoder a -> a -> Json.Decode.Decoder (a -> b) -> Json.Decode.Decoder b"},{"name":"required","comment":" Decode a required field.\n\n import Json.Decode as Decode exposing (Decoder, int, string)\n import Json.Decode.Pipeline exposing (required)\n\n type alias User =\n { id : Int\n , name : String\n , email : String\n }\n\n userDecoder : Decoder User\n userDecoder =\n Decode.succeed User\n |> required \"id\" int\n |> required \"name\" string\n |> required \"email\" string\n\n result : Result String User\n result =\n Decode.decodeString\n userDecoder\n \"\"\"\n {\"id\": 123, \"email\": \"sam@example.com\", \"name\": \"Sam\"}\n \"\"\"\n\n -- Ok { id = 123, name = \"Sam\", email = \"sam@example.com\" }\n\n","type":"String.String -> Json.Decode.Decoder a -> Json.Decode.Decoder (a -> b) -> Json.Decode.Decoder b"},{"name":"requiredAt","comment":" Decode a required nested field.\n","type":"List.List String.String -> Json.Decode.Decoder a -> Json.Decode.Decoder (a -> b) -> Json.Decode.Decoder b"},{"name":"resolve","comment":" Convert a `Decoder (Result x a)` into a `Decoder a`. Useful when you want\nto perform some custom processing just before completing the decoding operation.\n\n import Json.Decode as Decode exposing (Decoder, float, int, string)\n import Json.Decode.Pipeline exposing (required, resolve)\n\n type alias User =\n { id : Int\n , email : String\n }\n\n userDecoder : Decoder User\n userDecoder =\n let\n -- toDecoder gets run *after* all the\n -- (|> required ...) steps are done.\n toDecoder : Int -> String -> Int -> Decoder User\n toDecoder id email version =\n if version > 2 then\n Decode.succeed (User id email)\n\n else\n fail \"This JSON is from a deprecated source. Please upgrade!\"\n in\n Decode.succeed toDecoder\n |> required \"id\" int\n |> required \"email\" string\n |> required \"version\" int\n -- version is part of toDecoder,\n |> resolve\n\n -- but it is not a part of User\n result : Result String User\n result =\n Decode.decodeString\n userDecoder\n \"\"\"\n {\"id\": 123, \"email\": \"sam@example.com\", \"version\": 1}\n \"\"\"\n\n -- Err \"This JSON is from a deprecated source. Please upgrade!\"\n\n","type":"Json.Decode.Decoder (Json.Decode.Decoder a) -> Json.Decode.Decoder a"}],"binops":[]}]
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
BSD 3-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020, andre-dietrich
|
|
4
|
-
All rights reserved.
|
|
5
|
-
|
|
6
|
-
Redistribution and use in source and binary forms, with or without
|
|
7
|
-
modification, are permitted provided that the following conditions are met:
|
|
8
|
-
|
|
9
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
-
list of conditions and the following disclaimer.
|
|
11
|
-
|
|
12
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
-
this list of conditions and the following disclaimer in the documentation
|
|
14
|
-
and/or other materials provided with the distribution.
|
|
15
|
-
|
|
16
|
-
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
-
contributors may be used to endorse or promote products derived from
|
|
18
|
-
this software without specific prior written permission.
|
|
19
|
-
|
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# elm-conditional
|
|
2
|
-
|
|
3
|
-
This Library contains a set of functions that are intended to simplify the
|
|
4
|
-
application of pipes when conditions are required. Instead of using multiple
|
|
5
|
-
if-else-statements, it is possible to pass the condition as the first parameter,
|
|
6
|
-
which defines if a functions gets executed or not.
|
|
7
|
-
|
|
8
|
-
Functions that have an `If` attached to their name, allow to define conditions
|
|
9
|
-
for their applications. If the function-name ends with a `When`, then the
|
|
10
|
-
application of the passed function is based on a Maybe type and only gets
|
|
11
|
-
executed, if this parameter is not equal to Nothing.
|
|
12
|
-
|
|
13
|
-
``` elm
|
|
14
|
-
import Conditional as C
|
|
15
|
-
|
|
16
|
-
...
|
|
17
|
-
let
|
|
18
|
-
list = [1,2,3,4,5,6,7,8,9]
|
|
19
|
-
in
|
|
20
|
-
-- apply a function only if the first condition is met
|
|
21
|
-
list
|
|
22
|
-
|> C.apply2If (++) (List.length list > 5) 5
|
|
23
|
-
|> (==) [5,1,2,3,4,5,6,7,8,9]
|
|
24
|
-
|
|
25
|
-
-- apply a function only if the first parameter is not Nothing
|
|
26
|
-
list
|
|
27
|
-
|> C.apply2When (++) (Just 1000)
|
|
28
|
-
|> (==) [1000,1,2,3,4,5,6,7,8,9]
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
The sub-modules contain a couple of functions that already abstract List or
|
|
33
|
-
String manipulation. So that you can also apply these functions directly without
|
|
34
|
-
any further if-else-statements.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
``` elm
|
|
38
|
-
import Conditional.List as CList
|
|
39
|
-
|
|
40
|
-
...
|
|
41
|
-
let
|
|
42
|
-
list = [1,2,3,4,5,6,7,8,9]
|
|
43
|
-
in
|
|
44
|
-
list
|
|
45
|
-
|> CList.mapIf (List.length list > 5) (\v -> v * v)
|
|
46
|
-
|> CList.addIf (List.member 6 list) -99
|
|
47
|
-
|> CList.attachIf (List.member 7 list) 99
|
|
48
|
-
|> (==) [-99, 1, 4, 9, 16, 25, 36, 49, 62, 91, 99]
|
|
49
|
-
|
|
50
|
-
...
|
|
51
|
-
```
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"name":"Conditional","comment":" Base collection for executing functions conditionally or for dealing with\nMaybe - Types.\n\n\n# Conditional application\n\n@docs applyIf, apply2If, apply3If\n\n\n# Maybe application\n\n@docs apply2When, apply3When\n\n","unions":[],"aliases":[],"values":[{"name":"apply2If","comment":" ","type":"(a -> b -> b) -> Basics.Bool -> a -> b -> b"},{"name":"apply2When","comment":" Apply the passed function only onto a value not equal to Nothing.\n","type":"(a -> b -> b) -> Maybe.Maybe a -> b -> b"},{"name":"apply3If","comment":" ","type":"(a -> b -> c -> c) -> Basics.Bool -> a -> b -> c -> c"},{"name":"apply3When","comment":" ","type":"(a -> b -> c -> c) -> Maybe.Maybe a -> b -> c -> c"},{"name":"applyIf","comment":" Apply the passed function only if the second parameter evalutes to True.\n","type":"(a -> a) -> Basics.Bool -> a -> a"}],"binops":[]},{"name":"Conditional.Array","comment":" Conditional functions for array manipulation.\n\n\n# Manipulate\n\n@docs setIf, setWhen, pushIf, pushWhen, appendIf, appendWhen\n\n\n# Transform\n\n@docs mapIf, filterIf, sliceIf\n\n","unions":[],"aliases":[],"values":[{"name":"appendIf","comment":" Append the first array only if the first parameter evalutes to True.\n\n appendIf False (Array.repeat 2 42) (Array.repeat 3 81) == Array.fromList [ 81, 81, 81 ]\n\n","type":"Basics.Bool -> Array.Array a -> Array.Array a -> Array.Array a"},{"name":"appendWhen","comment":" Append two arrays to a new one, if the first one is not of type Nothing.\n\n append Nothing (repeat 3 81) == fromList [ 81, 81, 81 ]\n\n","type":"Maybe.Maybe (Array.Array a) -> Array.Array a -> Array.Array a"},{"name":"filterIf","comment":" Conditional filtering that is only performed, if the first parameter evalutes\nto True.\n","type":"Basics.Bool -> (a -> Basics.Bool) -> Array.Array a -> Array.Array a"},{"name":"mapIf","comment":" Conditional mapping that is only performed, if the first parameter evalutes\nto True. The resulting array has to be of the same type as the input array.\n","type":"Basics.Bool -> (a -> a) -> Array.Array a -> Array.Array a"},{"name":"pushIf","comment":" Push an element onto the end of an array if the first value evalutes to True.\n\n pushIf False 3 (Array.fromList [ 1, 2 ]) == Array.fromList [ 1, 2 ]\n\n","type":"Basics.Bool -> a -> Array.Array a -> Array.Array a"},{"name":"pushWhen","comment":" Push an element onto the end of an array, if it is not of type Nothing.\n\n pushWhen (Just 3) (Array.fromList [ 1, 2 ]) == Array.fromList [ 1, 2, 3 ]\n\n","type":"Maybe.Maybe a -> Array.Array a -> Array.Array a"},{"name":"setIf","comment":" Set the element at a particular index if the condition is met. Returns an\nupdated array. If the index is out of range, the array is unaltered.\n\n Array.fromList [ 1, 2, 3 ]\n |> setIf False 1 7\n |> (==) Array.fromList [ 1, 2, 3 ]\n\n","type":"Basics.Bool -> Basics.Int -> a -> Array.Array a -> Array.Array a"},{"name":"setWhen","comment":" Set the element at a particular index, if it is not of type Nothing.\nIf the index is out of range, the array is unaltered.\n\n setWhen 1 (Just 7) (Array.fromList [ 1, 2, 3 ]) == Array.fromList [ 1, 7, 3 ]\n\n","type":"Basics.Int -> Maybe.Maybe a -> Array.Array a -> Array.Array a"},{"name":"sliceIf","comment":" Conditional slice that is only performed, if the first parameter evalutes\nto True.\n","type":"Basics.Bool -> Basics.Int -> Basics.Int -> Array.Array a -> Array.Array a"}],"binops":[]},{"name":"Conditional.Bitwise","comment":" Library for Conditional [bitwise operations](https://en.wikipedia.org/wiki/Bitwise_operation).\n\n\n# Basic Operations\n\n@docs andIf, orIf, xorIf, complementIf\n\n\n# Bit Shifts\n\n@docs shiftLeftByIf, shiftRightByIf, shiftRightZfByIf\n\n","unions":[],"aliases":[],"values":[{"name":"andIf","comment":" Conditional bitwise AND\n","type":"Basics.Bool -> Basics.Int -> Basics.Int -> Basics.Int"},{"name":"complementIf","comment":" Conditional bitwise complement\n","type":"Basics.Bool -> Basics.Int -> Basics.Int"},{"name":"orIf","comment":" Conditional bitwise OR\n","type":"Basics.Bool -> Basics.Int -> Basics.Int -> Basics.Int"},{"name":"shiftLeftByIf","comment":" Conditional bitwise shiftLeftBy\n","type":"Basics.Bool -> Basics.Int -> Basics.Int -> Basics.Int"},{"name":"shiftRightByIf","comment":" Conditional bitwise shiftRightBy\n","type":"Basics.Bool -> Basics.Int -> Basics.Int -> Basics.Int"},{"name":"shiftRightZfByIf","comment":" Conditional bitwise shiftRightZfBy\n","type":"Basics.Bool -> Basics.Int -> Basics.Int -> Basics.Int"},{"name":"xorIf","comment":" Conditional bitwise XOR\n","type":"Basics.Bool -> Basics.Int -> Basics.Int -> Basics.Int"}],"binops":[]},{"name":"Conditional.Char","comment":" A set of conditional functions for maipulating Chars\n\n\n# Conversion\n\n@docs toUpperIf, toLowerIf, toLocaleUpperIf, toLocaleLowerIf\n\n","unions":[],"aliases":[],"values":[{"name":"toLocaleLowerIf","comment":" Convert to locale lower case if the first condition is met\n","type":"Basics.Bool -> Char.Char -> Char.Char"},{"name":"toLocaleUpperIf","comment":" Convert to locale upper case if the first condition is met\n","type":"Basics.Bool -> Char.Char -> Char.Char"},{"name":"toLowerIf","comment":" Convert to lower case if the first condition is met\n","type":"Basics.Bool -> Char.Char -> Char.Char"},{"name":"toUpperIf","comment":" Convert to upper case if the first condition is met\n","type":"Basics.Bool -> Char.Char -> Char.Char"}],"binops":[]},{"name":"Conditional.Dict","comment":" A collection of conditional functions for maipulating dictionaries\n\n\n# Build\n\n@docs insertIf, insertWhen, insertWhenValue, updateIf, updateWhen, updateWhenValue, removeIf, removeWhen\n\n\n# Transform\n\n@docs mapIf, filterIf\n\n\n# Combine\n\n@docs unionIf, intersectIf\n\n","unions":[],"aliases":[],"values":[{"name":"filterIf","comment":" Conditional filtering.\n","type":"Basics.Bool -> (comparable -> v -> Basics.Bool) -> Dict.Dict comparable v -> Dict.Dict comparable v"},{"name":"insertIf","comment":" Conditional dict insertion\n","type":"Basics.Bool -> comparable -> v -> Dict.Dict comparable v -> Dict.Dict comparable v"},{"name":"insertWhen","comment":" Insert into dict, if the key is not Nothing\n","type":"Maybe.Maybe comparable -> v -> Dict.Dict comparable v -> Dict.Dict comparable v"},{"name":"insertWhenValue","comment":" Insert into dict, if the value is not Nothing\n","type":"comparable -> Maybe.Maybe v -> Dict.Dict comparable v -> Dict.Dict comparable v"},{"name":"intersectIf","comment":" Conditional intersection.\n","type":"Basics.Bool -> Dict.Dict comparable v -> Dict.Dict comparable v -> Dict.Dict comparable v"},{"name":"mapIf","comment":" Apply the mapping function only if the first parameter evalutes to True.\n","type":"Basics.Bool -> (k -> a -> a) -> Dict.Dict k a -> Dict.Dict k a"},{"name":"removeIf","comment":" Conditional dict removal\n","type":"Basics.Bool -> comparable -> Dict.Dict comparable v -> Dict.Dict comparable v"},{"name":"removeWhen","comment":" Remove an entry from a dict, if the key is not Nothing\n","type":"Maybe.Maybe comparable -> Dict.Dict comparable v -> Dict.Dict comparable v"},{"name":"unionIf","comment":" If the first parameter evalutes to True, then both Dicts are unified,\notherwise the second Dict defines the result\n","type":"Basics.Bool -> Dict.Dict comparable v -> Dict.Dict comparable v -> Dict.Dict comparable v"},{"name":"updateIf","comment":" Conditional dict update\n","type":"Basics.Bool -> comparable -> (Maybe.Maybe v -> Maybe.Maybe v) -> Dict.Dict comparable v -> Dict.Dict comparable v"},{"name":"updateWhen","comment":" Update dict, if the key is not Nothing\n","type":"Maybe.Maybe comparable -> (Maybe.Maybe v -> Maybe.Maybe v) -> Dict.Dict comparable v -> Dict.Dict comparable v"},{"name":"updateWhenValue","comment":" Update dict, if the value is not Nothing\n","type":"comparable -> Maybe.Maybe (Maybe.Maybe v -> Maybe.Maybe v) -> Dict.Dict comparable v -> Dict.Dict comparable v"}],"binops":[]},{"name":"Conditional.List","comment":" A set of conditional functions for maipulating Lists.\n\n\n# Create\n\n@docs addIf, addWhen, attachIf, attachWhen\n\n\n# Transform\n\n@docs mapIf, filterIf, filterMapIf\n\n\n# Utilities\n\n@docs reverseIf\n\n\n# Combine\n\n@docs appendIf, appendWhen, concatMapIf, intersperseIf\n\n\n# Sort\n\n@docs sortIf, sortByIf\n\n\n# Deconstruct\n\n@docs takeIf, dropIf\n\n","unions":[],"aliases":[],"values":[{"name":"addIf","comment":" Add an element to the front of a List only if the first condition is\nparameter evaluates to True.\n","type":"Basics.Bool -> a -> List.List a -> List.List a"},{"name":"addWhen","comment":" Add an element to the front of a List only if the value is not Nothing\n","type":"Maybe.Maybe a -> List.List a -> List.List a"},{"name":"appendIf","comment":" Perform a List.append only if the first condition is met, otherwise the\nsecond List defines the result.\n","type":"Basics.Bool -> List.List a -> List.List a -> List.List a"},{"name":"appendWhen","comment":" Perform a List.append only if the first parameter is not Nothing.\n","type":"Maybe.Maybe (List.List a) -> List.List a -> List.List a"},{"name":"attachIf","comment":" Add an element to the end of a List, if the first parameter evalutes to True.\n","type":"Basics.Bool -> a -> List.List a -> List.List a"},{"name":"attachWhen","comment":" Add an element to the end of a List, if the element is not Nothing.\n","type":"Maybe.Maybe a -> List.List a -> List.List a"},{"name":"concatMapIf","comment":" Conditional concatMap.\n","type":"Basics.Bool -> (a -> List.List a) -> List.List a -> List.List a"},{"name":"dropIf","comment":" Conditional application of List.drop.\n","type":"Basics.Bool -> Basics.Int -> List.List a -> List.List a"},{"name":"filterIf","comment":" Conditional application of a filtering.\n","type":"Basics.Bool -> (a -> Basics.Bool) -> List.List a -> List.List a"},{"name":"filterMapIf","comment":" Conditional application of a filterMap function.\n","type":"Basics.Bool -> (a -> Maybe.Maybe a) -> List.List a -> List.List a"},{"name":"intersperseIf","comment":" Conditional application of intersperse.\n","type":"Basics.Bool -> a -> List.List a -> List.List a"},{"name":"mapIf","comment":" Conditional application of a mapping function.\n","type":"Basics.Bool -> (a -> a) -> List.List a -> List.List a"},{"name":"reverseIf","comment":" Conditional list reverse.\n","type":"Basics.Bool -> List.List a -> List.List a"},{"name":"sortByIf","comment":" Conditional sortBy.\n","type":"Basics.Bool -> (a -> comparable) -> List.List a -> List.List a"},{"name":"sortIf","comment":" Conditional sort.\n","type":"Basics.Bool -> List.List comparable -> List.List comparable"},{"name":"takeIf","comment":" Conditional application of List.take.\n","type":"Basics.Bool -> Basics.Int -> List.List a -> List.List a"}],"binops":[]},{"name":"Conditional.Maybe","comment":" A collection of conditional functions that can be applied to Maybe types.\n\n\n# Common Helpers\n\n@docs mapIf\n\n\n# Chaining Maybes\n\n@docs andThenIf\n\n","unions":[],"aliases":[],"values":[{"name":"andThenIf","comment":" Apply a \"Then\" - chaining function only if the first condition is met.\n","type":"Basics.Bool -> (a -> Maybe.Maybe a) -> Maybe.Maybe a -> Maybe.Maybe a"},{"name":"mapIf","comment":" Apply the mapping function only if the first condition is met.\n","type":"Basics.Bool -> (a -> a) -> Maybe.Maybe a -> Maybe.Maybe a"}],"binops":[]},{"name":"Conditional.Result","comment":" A collection of conditional function that can be applied to Result types.\n\n\n# Common Helpers\n\n@docs mapIf\n\n\n# Chaining Results\n\n@docs andThenIf\n\n","unions":[],"aliases":[],"values":[{"name":"andThenIf","comment":" Apply a \"Then\" - chaining function only if the first condition is met.\n","type":"Basics.Bool -> (a -> Result.Result x a) -> Result.Result x a -> Result.Result x a"},{"name":"mapIf","comment":" Apply the mapping function only if the first condition is met.\n","type":"Basics.Bool -> (a -> a) -> Result.Result x a -> Result.Result x a"}],"binops":[]},{"name":"Conditional.Set","comment":" A collection of conditional functions for working with sets.\n\n\n# Build\n\n@docs insertIf, insertWhen, removeIf, removeWhen\n\n\n# Combine\n\n@docs unionIf, intersectIf, diffIf\n\n\n# Transform\n\n@docs mapIf, filterIf\n\n","unions":[],"aliases":[],"values":[{"name":"diffIf","comment":" Conditional diff\n","type":"Basics.Bool -> Set.Set comparable -> Set.Set comparable -> Set.Set comparable"},{"name":"filterIf","comment":" Conditional filter\n","type":"Basics.Bool -> (comparable -> Basics.Bool) -> Set.Set comparable -> Set.Set comparable"},{"name":"insertIf","comment":" Conditional insert\n","type":"Basics.Bool -> comparable -> Set.Set comparable -> Set.Set comparable"},{"name":"insertWhen","comment":" Insert an element to a Set if it is not Nothing.\n","type":"Maybe.Maybe comparable -> Set.Set comparable -> Set.Set comparable"},{"name":"intersectIf","comment":" Conditional intersection\n","type":"Basics.Bool -> Set.Set comparable -> Set.Set comparable -> Set.Set comparable"},{"name":"mapIf","comment":" Conditional map\n","type":"Basics.Bool -> (comparable -> comparable) -> Set.Set comparable -> Set.Set comparable"},{"name":"removeIf","comment":" Conditional remove\n","type":"Basics.Bool -> comparable -> Set.Set comparable -> Set.Set comparable"},{"name":"removeWhen","comment":" Remove an element to a Set if it is not Nothing.\n","type":"Maybe.Maybe comparable -> Set.Set comparable -> Set.Set comparable"},{"name":"unionIf","comment":" Conditional union\n","type":"Basics.Bool -> Set.Set comparable -> Set.Set comparable -> Set.Set comparable"}],"binops":[]},{"name":"Conditional.String","comment":" A collection of conditional functions to work with Strings.\n\n\n# Strings\n\n@docs reverseIf, repeatIf, replaceIf\n\n\n# Building and Splitting\n\n@docs addIf, addWhen, attachIf, attachWhen\n\n\n# Get Substrings\n\n@docs sliceIf, leftIf, rightIf, dropLeftIf, dropRightIf\n\n\n# Char Conversions\n\n@docs consIf\n\n\n# Formatting\n\nCosmetic operations such as padding with extra characters or trimming whitespace.\n\n@docs toUpperIf, toLowerIf, padIf, padLeftIf, padRightIf, trimIf, trimLeftIf, trimRightIf\n\n\n# Higher-Order Functions\n\n@docs mapIf, filterIf\n\n","unions":[],"aliases":[],"values":[{"name":"addIf","comment":" Add two Strings if the first parameter evalutes to True, otherwise the\nsecond defines the result\n","type":"Basics.Bool -> String.String -> String.String -> String.String"},{"name":"addWhen","comment":" Add two Strings if the first one is not of type Nothing\n","type":"Maybe.Maybe String.String -> String.String -> String.String"},{"name":"attachIf","comment":" Add the first String to the end of the second one, if the first parameter\nevalutes to True.\n","type":"Basics.Bool -> String.String -> String.String -> String.String"},{"name":"attachWhen","comment":" Add the first String to the end of the second one, if it is not of\ntype Nothing.\n","type":"Maybe.Maybe String.String -> String.String -> String.String"},{"name":"consIf","comment":" Apply String.cons if the first condition is met.\n","type":"Basics.Bool -> Char.Char -> String.String -> String.String"},{"name":"dropLeftIf","comment":" Apply String.dropLeft if the first condition is met.\n","type":"Basics.Bool -> Basics.Int -> String.String -> String.String"},{"name":"dropRightIf","comment":" Apply String.dropRight if the first condition is met.\n","type":"Basics.Bool -> Basics.Int -> String.String -> String.String"},{"name":"filterIf","comment":" Apply String.filter if the first condition is met.\n","type":"Basics.Bool -> (Char.Char -> Basics.Bool) -> String.String -> String.String"},{"name":"leftIf","comment":" Apply String.left if the first condition is met.\n","type":"Basics.Bool -> Basics.Int -> String.String -> String.String"},{"name":"mapIf","comment":" Apply String.map if the first condition is met.\n","type":"Basics.Bool -> (Char.Char -> Char.Char) -> String.String -> String.String"},{"name":"padIf","comment":" Apply String.pad if the first condition is met.\n","type":"Basics.Bool -> Basics.Int -> Char.Char -> String.String -> String.String"},{"name":"padLeftIf","comment":" Apply String.padLeft if the first condition is met.\n","type":"Basics.Bool -> Basics.Int -> Char.Char -> String.String -> String.String"},{"name":"padRightIf","comment":" Apply String.padRight if the first condition is met.\n","type":"Basics.Bool -> Basics.Int -> Char.Char -> String.String -> String.String"},{"name":"repeatIf","comment":" Apply String.repeat if the first condition is met.\n","type":"Basics.Bool -> Basics.Int -> String.String -> String.String"},{"name":"replaceIf","comment":" Apply String.replace if the first condition is met.\n","type":"Basics.Bool -> String.String -> String.String -> String.String -> String.String"},{"name":"reverseIf","comment":" Apply String.reverse if the first condition is met.\n","type":"Basics.Bool -> String.String -> String.String"},{"name":"rightIf","comment":" Apply String.right if the first condition is met.\n","type":"Basics.Bool -> Basics.Int -> String.String -> String.String"},{"name":"sliceIf","comment":" Apply String.slice if the first condition is met.\n","type":"Basics.Bool -> Basics.Int -> Basics.Int -> String.String -> String.String"},{"name":"toLowerIf","comment":" Apply String.toLower if the first condition is met.\n","type":"Basics.Bool -> String.String -> String.String"},{"name":"toUpperIf","comment":" Apply String.toUpper if the first condition is met.\n","type":"Basics.Bool -> String.String -> String.String"},{"name":"trimIf","comment":" Apply String.trim if the first condition is met.\n","type":"Basics.Bool -> String.String -> String.String"},{"name":"trimLeftIf","comment":" Apply String.trimLeft if the first condition is met.\n","type":"Basics.Bool -> String.String -> String.String"},{"name":"trimRightIf","comment":" Apply String.trimRight if the first condition is met.\n","type":"Basics.Bool -> String.String -> String.String"}],"binops":[]}]
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|