Skip to content

Commit

Permalink
Flow: Fix flow errors on flow 0.94.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ariabuckles committed Mar 13, 2019
1 parent 877bd4b commit e63fe52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-markdown",
"version": "0.4.2",
"version": "0.4.3",
"description": "Javascript markdown parsing, made simple",
"main": "simple-markdown.js",
"scripts": {
Expand Down
13 changes: 6 additions & 7 deletions simple-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* the wonderful [marked.js](https://github.com/chjj/marked)
*
* LICENSE (MIT):
* New code copyright (c) 2014 Khan Academy.
* New code copyright (c) 2014-2019 Khan Academy & Aria Buckles.
*
* Portions adapted from marked.js copyright (c) 2011-2014
* Christopher Jeffrey (https://github.com/chjj/).
Expand All @@ -47,11 +47,9 @@
/*::
// Flow Type Definitions:
type Capture = {
'0': string,
index?: number,
[number]: string,
};
type Capture =
Array<string> & {index: number} |
Array<string> & {index?: number};
type Attr = string | number | boolean;
Expand Down Expand Up @@ -1023,7 +1021,8 @@ var defaultRules /* : DefaultRules */ = {
var lastItemWasAParagraph = false;
var itemContent = items.map(function(item, i) {
// We need to see how far indented this item is:
var space = LIST_ITEM_PREFIX_R.exec(item)[0].length;
var prefixCapture = LIST_ITEM_PREFIX_R.exec(item);
var space = prefixCapture ? prefixCapture[0].length : 0;
// And then we construct a regex to "unindent" the subsequent
// lines of the items by that amount:
var spaceRegex = new RegExp("^ {1," + space + "}", "gm");
Expand Down

0 comments on commit e63fe52

Please sign in to comment.