@jdeighan/coffee-utils 11.0.20 → 11.0.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jdeighan/coffee-utils",
3
3
  "type": "module",
4
- "version": "11.0.20",
4
+ "version": "11.0.21",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
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 ! lItems?
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 == null) {
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 != null) {
356
+ if (defined(convertFunc)) {
357
357
  lConverted = (function() {
358
358
  var i, len, results;
359
359
  results = [];