@jdeighan/coffee-utils 7.0.72 → 7.0.75

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jdeighan/coffee-utils",
3
3
  "type": "module",
4
- "version": "7.0.72",
4
+ "version": "7.0.75",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
@@ -4,7 +4,7 @@ import fs from 'fs'
4
4
  import readline from 'readline'
5
5
 
6
6
  import {
7
- assert, 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,10 @@ 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"
35
+ lLines = lLines.filter((line) => defined(line));
32
36
  if lLines.length == 0
33
37
  return ''
34
38
  else
@@ -5,9 +5,12 @@ import fs from 'fs';
5
5
  import readline from 'readline';
6
6
 
7
7
  import {
8
+ undef,
8
9
  assert,
10
+ defined,
9
11
  isEmpty,
10
12
  isString,
13
+ isArray,
11
14
  nonEmpty,
12
15
  error,
13
16
  rtrim
@@ -34,6 +37,13 @@ export var blockToArray = function(block) {
34
37
  // ---------------------------------------------------------------------------
35
38
  // arrayToBlock - block will have no trailing whitespace
36
39
  export var arrayToBlock = function(lLines) {
40
+ if (lLines === undef) {
41
+ return '';
42
+ }
43
+ assert(isArray(lLines), "lLines is not an array");
44
+ lLines = lLines.filter((line) => {
45
+ return defined(line);
46
+ });
37
47
  if (lLines.length === 0) {
38
48
  return '';
39
49
  } else {