@khanacademy/simple-markdown 0.8.2 → 0.8.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @khanacademy/simple-markdown
2
2
 
3
+ ## 0.8.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 98d283ff: Fix storybook
8
+
9
+ ## 0.8.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 3921a385: Error when rule returns incorrect `parse` result
14
+
3
15
  ## 0.8.2
4
16
 
5
17
  ### Patch Changes
package/dist/es/index.js CHANGED
@@ -174,8 +174,7 @@ var parserFor = function parserFor(rules, defaultState) {
174
174
  if (capture.index) {
175
175
  // If present and non-zero, i.e. a non-^ regexp result:
176
176
  throw new Error("`match` must return a capture starting at index 0 " + "(the current parse index). Did you forget a ^ at the " + "start of the RegExp?");
177
- } // $FlowFixMe
178
-
177
+ }
179
178
 
180
179
  var parsed = rule.parse(capture, nestedParse, state); // We maintain the same object here so that rules can
181
180
  // store references to the objects they return and
@@ -186,10 +185,14 @@ var parserFor = function parserFor(rules, defaultState) {
186
185
  // $FlowFixMe
187
186
  Array.prototype.push.apply(result, parsed);
188
187
  } else {
189
- // We also let rules override the default type of
188
+ if (parsed == null || typeof parsed !== "object") {
189
+ throw new Error("parse() function returned invalid parse result: '".concat(parsed, "'"));
190
+ } // We also let rules override the default type of
190
191
  // their parsed node if they would like to, so that
191
192
  // there can be a single output function for all links,
192
193
  // even if there are several rules to parse them.
194
+
195
+
193
196
  if (parsed.type == null) {
194
197
  // $FlowFixMe
195
198
  parsed.type = ruleType;