1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
// JavaScript
"use strict";
const helpers = require("resource://grammalecte/helpers.js");
var text = {
getParagraph: function* (sText) {
// generator: returns paragraphs of text
let iStart = 0;
let iEnd = 0;
sText = sText.replace("\r", "");
while ((iEnd = sText.indexOf("\n", iStart)) !== -1) {
yield sText.slice(iStart, iEnd);
|
>
>
|
|
>
>
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// JavaScript
"use strict";
if (typeof(exports) !== 'undefined') {
var helpers = require("resource://grammalecte/helpers.js");
}
const text = {
getParagraph: function* (sText) {
// generator: returns paragraphs of text
let iStart = 0;
let iEnd = 0;
sText = sText.replace("\r", "");
while ((iEnd = sText.indexOf("\n", iStart)) !== -1) {
yield sText.slice(iStart, iEnd);
|