@jdeighan/coffee-utils 7.0.74 → 7.0.75
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/block_utils.coffee +4 -1
- package/src/block_utils.js +6 -0
package/package.json
CHANGED
package/src/block_utils.coffee
CHANGED
@@ -4,7 +4,7 @@ import fs from 'fs'
|
|
4
4
|
import readline from 'readline'
|
5
5
|
|
6
6
|
import {
|
7
|
-
assert, defined, isEmpty, isString, nonEmpty, error, rtrim,
|
7
|
+
undef, assert, defined, isEmpty, isString, isArray, nonEmpty, error, rtrim,
|
8
8
|
} from '@jdeighan/coffee-utils'
|
9
9
|
|
10
10
|
# ---------------------------------------------------------------------------
|
@@ -29,6 +29,9 @@ export blockToArray = (block) ->
|
|
29
29
|
|
30
30
|
export arrayToBlock = (lLines) ->
|
31
31
|
|
32
|
+
if (lLines == undef)
|
33
|
+
return ''
|
34
|
+
assert isArray(lLines), "lLines is not an array"
|
32
35
|
lLines = lLines.filter((line) => defined(line));
|
33
36
|
if lLines.length == 0
|
34
37
|
return ''
|
package/src/block_utils.js
CHANGED
@@ -5,10 +5,12 @@ import fs from 'fs';
|
|
5
5
|
import readline from 'readline';
|
6
6
|
|
7
7
|
import {
|
8
|
+
undef,
|
8
9
|
assert,
|
9
10
|
defined,
|
10
11
|
isEmpty,
|
11
12
|
isString,
|
13
|
+
isArray,
|
12
14
|
nonEmpty,
|
13
15
|
error,
|
14
16
|
rtrim
|
@@ -35,6 +37,10 @@ export var blockToArray = function(block) {
|
|
35
37
|
// ---------------------------------------------------------------------------
|
36
38
|
// arrayToBlock - block will have no trailing whitespace
|
37
39
|
export var arrayToBlock = function(lLines) {
|
40
|
+
if (lLines === undef) {
|
41
|
+
return '';
|
42
|
+
}
|
43
|
+
assert(isArray(lLines), "lLines is not an array");
|
38
44
|
lLines = lLines.filter((line) => {
|
39
45
|
return defined(line);
|
40
46
|
});
|