Expose isPreviousLineEmpty to plugins (#4747). (#4748)

This commit is contained in:
Warren Seine authored and Suchipi committed 2018-06-25 23:20:00 -06:00
1 parent 7a3ac3a693
commit 6c482e2e6c
3 files changed
+7

No files matched your search

+1
View File
@@ -218,6 +218,7 @@ makeString(rawContent: string, enclosingQuote: string, unescapeUnnecessarEscapes
getNextNonSpaceNonCommentCharacterIndex(text: string, node: object, options: object): number;
isNextLineEmptyAfterIndex(text: string, index: number): boolean;
isNextLineEmpty(text: string, node: object, options: object): boolean;
isPreviousLineEmpty(text: string, node: object, options: object): boolean;
mapDoc(doc: object, callback: function): void;
```
+5
View File
@@ -7,6 +7,10 @@ function isNextLineEmpty(text, node, options) {
return util.isNextLineEmpty(text, node, options.locEnd);
}
function isPreviousLineEmpty(text, node, options) {
return util.isPreviousLineEmpty(text, node, options.locStart);
}
function getNextNonSpaceNonCommentCharacterIndex(text, node, options) {
return util.getNextNonSpaceNonCommentCharacterIndex(
text,
@@ -18,6 +22,7 @@ function getNextNonSpaceNonCommentCharacterIndex(text, node, options) {
module.exports = {
isNextLineEmpty,
isNextLineEmptyAfterIndex: util.isNextLineEmptyAfterIndex,
isPreviousLineEmpty,
getNextNonSpaceNonCommentCharacterIndex,
mapDoc, // TODO: remove in 2.0, we already exposed it in docUtils
makeString: util.makeString,
@@ -5,6 +5,7 @@ const sharedUtil = require("../../src/common/util-shared");
test("shared util has correct structure", () => {
expect(typeof sharedUtil.isNextLineEmpty).toEqual("function");
expect(typeof sharedUtil.isNextLineEmptyAfterIndex).toEqual("function");
expect(typeof sharedUtil.isPreviousLineEmpty).toEqual("function");
expect(typeof sharedUtil.getNextNonSpaceNonCommentCharacterIndex).toEqual(
"function"
);