@ekz/option 1.2.4 → 1.2.5

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.
Files changed (3) hide show
  1. package/README.md +70 -57
  2. package/index.d.ts +1 -1
  3. package/package.json +7 -7
package/README.md CHANGED
@@ -51,33 +51,44 @@ Some('bar').forEach(x => {
51
51
 
52
52
  ### Table of Contents
53
53
 
54
- - [Option](#option)
55
- - [get](#get)
56
- - [isEmpty](#isempty)
57
- - [isDefined](#isdefined)
58
- - [map](#map)
59
- - [mapNullable](#mapnullable)
60
- - [flatMap](#flatmap)
61
- - [forEach](#foreach)
62
- - [filter](#filter)
63
- - [getOrElse](#getorelse)
64
- - [getOrReturn](#getorreturn)
65
- - [getOrUndefined](#getorundefined)
66
- - [equals](#equals)
67
- - [toJSON](#tojson)
68
- - [of](#of)
69
- - [None](#none)
70
- - [Some](#some)
71
- - [None](#none-1)
72
- - [Some](#some-1)
54
+ * [Option](#option)
55
+ * [Parameters](#parameters)
56
+ * [get](#get)
57
+ * [isEmpty](#isempty)
58
+ * [isDefined](#isdefined)
59
+ * [map](#map)
60
+ * [Parameters](#parameters-1)
61
+ * [mapNullable](#mapnullable)
62
+ * [Parameters](#parameters-2)
63
+ * [flatMap](#flatmap)
64
+ * [Parameters](#parameters-3)
65
+ * [forEach](#foreach)
66
+ * [Parameters](#parameters-4)
67
+ * [filter](#filter)
68
+ * [Parameters](#parameters-5)
69
+ * [getOrElse](#getorelse)
70
+ * [Parameters](#parameters-6)
71
+ * [getOrReturn](#getorreturn)
72
+ * [Parameters](#parameters-7)
73
+ * [getOrUndefined](#getorundefined)
74
+ * [equals](#equals)
75
+ * [Parameters](#parameters-8)
76
+ * [toJSON](#tojson)
77
+ * [of](#of)
78
+ * [Parameters](#parameters-9)
79
+ * [None](#none)
80
+ * [Some](#some)
81
+ * [None](#none-1)
82
+ * [Some](#some-1)
83
+ * [Parameters](#parameters-10)
73
84
 
74
85
  ## Option
75
86
 
76
87
  Represents optional values. Instances of Option are either an instance of Some or the object None.
77
88
 
78
- **Parameters**
89
+ ### Parameters
79
90
 
80
- - `$privateToken` **any**
91
+ * `$privateToken` **any** 
81
92
 
82
93
  ### get
83
94
 
@@ -95,135 +106,137 @@ Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Glob
95
106
 
96
107
  Returns true if the option is an instance of Some, false otherwise.
97
108
 
98
- Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
109
+ Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)
110
+
111
+ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 
99
112
 
100
113
  ### map
101
114
 
102
115
  Returns a Some containing the result of applying f to this Option's value if this Option is nonempty.
103
116
 
104
- **Parameters**
117
+ #### Parameters
105
118
 
106
- - `f` **function (A): B**
119
+ * `f` **function (A): B** 
107
120
 
108
- Returns **[Option](#option)<B>**
121
+ Returns **[Option](#option)\<B>**&#x20;
109
122
 
110
123
  ### mapNullable
111
124
 
112
125
  Like map, but if resulting value is null, then returns None.
113
126
 
114
- **Parameters**
127
+ #### Parameters
115
128
 
116
- - `f` **function (A): B?**
129
+ * `f` **function (A): B?**&#x20;
117
130
 
118
- Returns **[Option](#option)&lt;B>**
131
+ Returns **[Option](#option)\<B>**&#x20;
119
132
 
120
133
  ### flatMap
121
134
 
122
135
  Returns the result of applying f to this Option's value if this Option is nonempty. Returns None if this Option is empty. Slightly different from map in that f is expected to return an Option (which could be None).
123
136
 
124
- **Parameters**
137
+ #### Parameters
125
138
 
126
- - `f` **function (A): [Option](#option)&lt;B>**
139
+ * `f` **function (A): [Option](#option)\<B>**&#x20;
127
140
 
128
- Returns **[Option](#option)&lt;B>**
141
+ Returns **[Option](#option)\<B>**&#x20;
129
142
 
130
143
  ### forEach
131
144
 
132
145
  Apply the given procedure f to the option's value, if it is nonempty.
133
146
 
134
- **Parameters**
147
+ #### Parameters
135
148
 
136
- - `f` **function (A): any**
149
+ * `f` **function (A): any**&#x20;
137
150
 
138
- Returns **void**
151
+ Returns **void**&#x20;
139
152
 
140
153
  ### filter
141
154
 
142
155
  Returns this Option if it is nonempty and applying the predicate to this Option's value returns true.
143
156
 
144
- **Parameters**
157
+ #### Parameters
145
158
 
146
- - `predicate` **function (A): [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
159
+ * `predicate` **function (A): [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
147
160
 
148
- Returns **[Option](#option)&lt;A>**
161
+ Returns **[Option](#option)\<A>**&#x20;
149
162
 
150
163
  ### getOrElse
151
164
 
152
165
  Returns the option's value if the option is nonempty, otherwise return the result of evaluating other.
153
166
 
154
- **Parameters**
167
+ #### Parameters
155
168
 
156
- - `other` **function (): B**
169
+ * `other` **function (): B**&#x20;
157
170
 
158
- Returns **(A | B)**
171
+ Returns **(A | B)**&#x20;
159
172
 
160
173
  ### getOrReturn
161
174
 
162
175
  Returns the option's value if the option is nonempty, otherwise return other.
163
176
 
164
- **Parameters**
177
+ #### Parameters
165
178
 
166
- - `other` **B**
179
+ * `other` **B**&#x20;
167
180
 
168
- Returns **(A | B)**
181
+ Returns **(A | B)**&#x20;
169
182
 
170
183
  ### getOrUndefined
171
184
 
172
185
  Returns the option's value if the option is nonempty, otherwise returns undefined.
173
186
 
174
- Returns **(A | void)**
187
+ Returns **(A | void)**&#x20;
175
188
 
176
189
  ### equals
177
190
 
178
191
  Compares the option's value with other option's value and returns true when they match. None always matches other None.
179
192
 
180
- **Parameters**
193
+ #### Parameters
181
194
 
182
- - `other` **[Option](#option)&lt;B>**
195
+ * `other` **[Option](#option)\<B>**&#x20;
183
196
 
184
- Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
197
+ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**&#x20;
185
198
 
186
199
  ### toJSON
187
200
 
188
201
  Returns value if present, null otherwise. If value contains a method `toJSON`,
189
202
  returns the result of method call.
190
203
 
191
- Returns **any**
204
+ Returns **any**&#x20;
192
205
 
193
206
  ### of
194
207
 
195
208
  An Option factory which creates Some(x) if the argument is not null, and None if it is null.
196
209
 
197
- **Parameters**
210
+ #### Parameters
198
211
 
199
- - `value` **V?**
212
+ * `value` **V??**&#x20;
200
213
 
201
- Returns **[Option](#option)&lt;V>**
214
+ Returns **[Option](#option)\<V>**&#x20;
202
215
 
203
216
  ### None
204
217
 
205
218
  The empty None object
206
219
 
207
- Type: [Option](#option)&lt;any>
220
+ Type: [Option](#option)\<any>
208
221
 
209
222
  ### Some
210
223
 
211
224
  Creates Some(x). Note that Some(null) is valid.
212
225
 
213
- Type: function (value: A): [Option](#option)&lt;A>
226
+ Type: function (value: A): [Option](#option)\<A>
214
227
 
215
228
  ## None
216
229
 
217
230
  The empty None object.
218
231
 
219
- Type: [Option](#option)&lt;any>
232
+ Type: [Option](#option)\<any>
220
233
 
221
234
  ## Some
222
235
 
223
236
  Creates Some(x). Note that Some(null) is valid.
224
237
 
225
- **Parameters**
238
+ ### Parameters
226
239
 
227
- - `value` **A**
240
+ * `value` **A**&#x20;
228
241
 
229
- Returns **[Option](#option)&lt;A>**
242
+ Returns **[Option](#option)\<A>**&#x20;
package/index.d.ts CHANGED
@@ -12,7 +12,7 @@ declare module '@ekz/option' {
12
12
  filter(predicate: (value: A) => boolean): Option<A>;
13
13
  getOrElse<B>(other: () => B): A | B;
14
14
  getOrReturn<B>(other: B): A | B;
15
- getOrUndefined(): A | void;
15
+ getOrUndefined(): A | undefined;
16
16
  equals<B>(other: Option<B>): boolean;
17
17
  toJSON(): unknown;
18
18
 
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@ekz/option",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
+ "packageManager": "yarn@4.3.1",
4
5
  "description": "Option/Maybe type to be used with flow.js",
5
6
  "types": "index.d.ts",
6
7
  "keywords": [
@@ -24,7 +25,6 @@
24
25
  "homepage": "https://github.com/erkez/flow-option#readme",
25
26
  "main": "lib/index.js",
26
27
  "license": "MIT",
27
- "private": false,
28
28
  "files": [
29
29
  "index.d.ts",
30
30
  "lib",
@@ -33,15 +33,15 @@
33
33
  ],
34
34
  "devDependencies": {
35
35
  "babel-cli": "^6.26.0",
36
- "babel-preset-env": "^1.6.1",
36
+ "babel-preset-env": "^1.7.0",
37
37
  "babel-preset-flow": "^6.23.0",
38
- "documentation": "^5.4.0",
39
- "flow-bin": "^0.95.1",
40
- "flow-copy-source": "^1.3.0"
38
+ "documentation": "^14.0.3",
39
+ "flow-bin": "^0.241.0",
40
+ "flow-copy-source": "^2.0.9"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "babel src/ -d lib/ && flow-copy-source -v src lib",
44
44
  "docs": "documentation readme src/index.js --section=API",
45
45
  "prepublish": "yarn run docs && yarn run build"
46
46
  }
47
- }
47
+ }