@jdeighan/coffee-utils 11.0.19 → 11.0.21
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +3 -3
- package/src/indent.coffee +1 -0
- package/src/indent.js +1 -0
- package/src/utils.coffee +2 -2
- package/src/utils.js +2 -2
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@jdeighan/coffee-utils",
|
3
3
|
"type": "module",
|
4
|
-
"version": "11.0.
|
4
|
+
"version": "11.0.21",
|
5
5
|
"description": "A set of utility functions for CoffeeScript",
|
6
6
|
"main": "coffee_utils.js",
|
7
7
|
"exports": {
|
@@ -50,7 +50,7 @@
|
|
50
50
|
},
|
51
51
|
"homepage": "https://github.com/johndeighan/coffee-utils#readme",
|
52
52
|
"dependencies": {
|
53
|
-
"@jdeighan/exceptions": "^1.0.
|
53
|
+
"@jdeighan/exceptions": "^1.0.18",
|
54
54
|
"cross-env": "^7.0.3",
|
55
55
|
"js-yaml": "^4.1.0",
|
56
56
|
"n-readlines": "^1.0.1",
|
@@ -58,6 +58,6 @@
|
|
58
58
|
"svelte": "^3.52.0"
|
59
59
|
},
|
60
60
|
"devDependencies": {
|
61
|
-
"@jdeighan/unit-tester": "^2.0.
|
61
|
+
"@jdeighan/unit-tester": "^2.0.42"
|
62
62
|
}
|
63
63
|
}
|
package/src/indent.coffee
CHANGED
@@ -14,6 +14,7 @@ export splitPrefix = (line) ->
|
|
14
14
|
assert isString(line), "non-string #{OL(line)}"
|
15
15
|
line = rtrim(line)
|
16
16
|
lMatches = line.match(/^(\s*)(.*)$/)
|
17
|
+
assert defined(lMatches), "Failed to match: #{OL(line)}"
|
17
18
|
return [lMatches[1], lMatches[2]]
|
18
19
|
|
19
20
|
# ---------------------------------------------------------------------------
|
package/src/indent.js
CHANGED
@@ -28,6 +28,7 @@ export var splitPrefix = function(line) {
|
|
28
28
|
assert(isString(line), `non-string ${OL(line)}`);
|
29
29
|
line = rtrim(line);
|
30
30
|
lMatches = line.match(/^(\s*)(.*)$/);
|
31
|
+
assert(defined(lMatches), `Failed to match: ${OL(line)}`);
|
31
32
|
return [lMatches[1], lMatches[2]];
|
32
33
|
};
|
33
34
|
|
package/src/utils.coffee
CHANGED
@@ -160,7 +160,7 @@ export isArrayOfStrings = (lItems) ->
|
|
160
160
|
|
161
161
|
export isUniqueList = (lItems, func=undef) ->
|
162
162
|
|
163
|
-
if
|
163
|
+
if notdefined(lItems)
|
164
164
|
return true # empty list is unique
|
165
165
|
if defined(func)
|
166
166
|
assert isFunction(func), "Not a function: #{OL(func)}"
|
@@ -275,7 +275,7 @@ export extractMatches = (line, regexp, convertFunc=undef) ->
|
|
275
275
|
lStrings = [...line.matchAll(regexp)]
|
276
276
|
lStrings = for str in lStrings
|
277
277
|
str[0]
|
278
|
-
if convertFunc
|
278
|
+
if defined(convertFunc)
|
279
279
|
lConverted = for str in lStrings
|
280
280
|
convertFunc(str)
|
281
281
|
return lConverted
|
package/src/utils.js
CHANGED
@@ -226,7 +226,7 @@ export var isArrayOfStrings = function(lItems) {
|
|
226
226
|
// ---------------------------------------------------------------------------
|
227
227
|
export var isUniqueList = function(lItems, func = undef) {
|
228
228
|
var h, i, item, len;
|
229
|
-
if (lItems
|
229
|
+
if (notdefined(lItems)) {
|
230
230
|
return true; // empty list is unique
|
231
231
|
}
|
232
232
|
if (defined(func)) {
|
@@ -353,7 +353,7 @@ export var extractMatches = function(line, regexp, convertFunc = undef) {
|
|
353
353
|
}
|
354
354
|
return results;
|
355
355
|
})();
|
356
|
-
if (convertFunc
|
356
|
+
if (defined(convertFunc)) {
|
357
357
|
lConverted = (function() {
|
358
358
|
var i, len, results;
|
359
359
|
results = [];
|