@jdeighan/coffee-utils 10.0.9 → 10.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/block_utils.coffee +8 -6
- package/src/block_utils.js +11 -8
package/package.json
CHANGED
package/src/block_utils.coffee
CHANGED
@@ -10,6 +10,7 @@ import {
|
|
10
10
|
|
11
11
|
# ---------------------------------------------------------------------------
|
12
12
|
# blockToArray - split a block into lines
|
13
|
+
# DEPRECATED - use toArray()
|
13
14
|
|
14
15
|
export blockToArray = (block) ->
|
15
16
|
|
@@ -68,7 +69,8 @@ export toArray = (item, option=undef) ->
|
|
68
69
|
return lNewLines
|
69
70
|
|
70
71
|
# ---------------------------------------------------------------------------
|
71
|
-
# arrayToBlock - block will have no trailing whitespace
|
72
|
+
# arrayToBlock - block and lines in block will have no trailing whitespace
|
73
|
+
# DEPRECATED - use toBlock()
|
72
74
|
|
73
75
|
export arrayToBlock = (lLines) ->
|
74
76
|
|
@@ -90,11 +92,11 @@ export toBlock = (lLines) ->
|
|
90
92
|
if (lLines == undef)
|
91
93
|
return undef
|
92
94
|
assert isArray(lLines), "lLines is not an array"
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
95
|
+
lNewLines = []
|
96
|
+
for line in lLines
|
97
|
+
if defined(line)
|
98
|
+
lNewLines.push rtrim(line)
|
99
|
+
return lNewLines.join("\n")
|
98
100
|
|
99
101
|
# ---------------------------------------------------------------------------
|
100
102
|
|
package/src/block_utils.js
CHANGED
@@ -23,6 +23,7 @@ import {
|
|
23
23
|
|
24
24
|
// ---------------------------------------------------------------------------
|
25
25
|
// blockToArray - split a block into lines
|
26
|
+
// DEPRECATED - use toArray()
|
26
27
|
export var blockToArray = function(block) {
|
27
28
|
var lLines, len;
|
28
29
|
if (isEmpty(block)) {
|
@@ -89,7 +90,8 @@ export var toArray = function(item, option = undef) {
|
|
89
90
|
};
|
90
91
|
|
91
92
|
// ---------------------------------------------------------------------------
|
92
|
-
// arrayToBlock - block will have no trailing whitespace
|
93
|
+
// arrayToBlock - block and lines in block will have no trailing whitespace
|
94
|
+
// DEPRECATED - use toBlock()
|
93
95
|
export var arrayToBlock = function(lLines) {
|
94
96
|
if (lLines === undef) {
|
95
97
|
return undef;
|
@@ -109,18 +111,19 @@ export var arrayToBlock = function(lLines) {
|
|
109
111
|
// toBlock - block may have trailing whitespace
|
110
112
|
// but undef items are ignored
|
111
113
|
export var toBlock = function(lLines) {
|
114
|
+
var i, lNewLines, len1, line;
|
112
115
|
if (lLines === undef) {
|
113
116
|
return undef;
|
114
117
|
}
|
115
118
|
assert(isArray(lLines), "lLines is not an array");
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
return lLines.join('\n');
|
119
|
+
lNewLines = [];
|
120
|
+
for (i = 0, len1 = lLines.length; i < len1; i++) {
|
121
|
+
line = lLines[i];
|
122
|
+
if (defined(line)) {
|
123
|
+
lNewLines.push(rtrim(line));
|
124
|
+
}
|
123
125
|
}
|
126
|
+
return lNewLines.join("\n");
|
124
127
|
};
|
125
128
|
|
126
129
|
// ---------------------------------------------------------------------------
|