Skip to content

Commit

Permalink
fix: Node.js 10のサポート[リグレッション修正] (#91)
Browse files Browse the repository at this point in the history
* fix: Node.js 10のサポート

* refactor: remove unneeded spread
  • Loading branch information
azu committed May 11, 2021
1 parent 75418c8 commit 97e0fa1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12, 14]
node-version: [10, 12, 14]
steps:
- name: checkout
uses: actions/checkout@v2
Expand Down
11 changes: 7 additions & 4 deletions src/util/pair-checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
*/
import assert from "assert";
import { RuleHelper } from "textlint-rule-helper";
const flat = (array) => {
return [].concat.apply([], array);
};
export function checkPair(context, { left, right }) {
assert(left);
assert(right);
Expand Down Expand Up @@ -36,17 +39,17 @@ export function checkPair(context, { left, right }) {
return symbolLocations;
};
const foundMissingPairNodes = (currentStrInParagraph) => {
let matchParentheses = currentStrInParagraph
.map((node) => {
const matchParentheses = flat(
currentStrInParagraph.map((node) => {
let text = getSource(node);
const leftSymbolLocations = findAllSymbolLocations(left, text);
const rightSymbolLocations = left !== right ? findAllSymbolLocations(right, text) : [];
const allSymbolLocations = [...leftSymbolLocations, ...rightSymbolLocations].sort(
(a, b) => a.index - b.index
);
return allSymbolLocations.map((loc) => ({ ...loc, ...{ node } }));
return allSymbolLocations.map((loc) => ({ ...loc, node }));
})
.flat();
);
if (left === right) {
const isCompletedParentheses = matchParentheses.length % 2 == 0;
if (isCompletedParentheses) {
Expand Down

0 comments on commit 97e0fa1

Please sign in to comment.