@jdeighan/coffee-utils 14.0.17 → 14.0.19

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": "14.0.17",
4
+ "version": "14.0.19",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
@@ -49,13 +49,13 @@
49
49
  },
50
50
  "homepage": "https://github.com/johndeighan/coffee-utils#readme",
51
51
  "dependencies": {
52
- "@jdeighan/base-utils": "^4.0.11",
52
+ "@jdeighan/base-utils": "^4.0.12",
53
53
  "cross-env": "^7.0.3",
54
54
  "n-readlines": "^1.0.1",
55
55
  "readline-sync": "^1.4.10",
56
56
  "svelte": "^3.55.1"
57
57
  },
58
58
  "devDependencies": {
59
- "@jdeighan/unit-tester": "^3.0.29"
59
+ "@jdeighan/unit-tester": "^3.0.30"
60
60
  }
61
61
  }
package/src/block.coffee CHANGED
@@ -4,6 +4,7 @@ import fs from 'fs'
4
4
  import readline from 'readline'
5
5
 
6
6
  import {assert, croak} from '@jdeighan/base-utils/exceptions'
7
+ import {dbgEnter, dbgReturn, dbg} from '@jdeighan/base-utils/debug'
7
8
  import {
8
9
  undef, pass, defined, notdefined, rtrim, OL, isArrayOfStrings,
9
10
  isEmpty, isString, isArray, nonEmpty, toArray, toBlock,
@@ -25,12 +26,13 @@ export splitBlock = (block) =>
25
26
 
26
27
  export firstLine = (block) =>
27
28
 
29
+ dbgEnter 'firstLine', block
28
30
  assert isString(block), "not a string"
29
31
  pos = block.indexOf('\n')
30
- if (pos == -1)
31
- return block
32
- else
33
- return block.substring(0, pos)
32
+ if (pos >= 0)
33
+ block = block.substring(0, pos)
34
+ dbgReturn 'firstLine', block
35
+ return block
34
36
 
35
37
  # ---------------------------------------------------------------------------
36
38
 
package/src/block.js CHANGED
@@ -9,6 +9,12 @@ import {
9
9
  croak
10
10
  } from '@jdeighan/base-utils/exceptions';
11
11
 
12
+ import {
13
+ dbgEnter,
14
+ dbgReturn,
15
+ dbg
16
+ } from '@jdeighan/base-utils/debug';
17
+
12
18
  import {
13
19
  undef,
14
20
  pass,
@@ -40,13 +46,14 @@ export var splitBlock = (block) => {
40
46
  // ---------------------------------------------------------------------------
41
47
  export var firstLine = (block) => {
42
48
  var pos;
49
+ dbgEnter('firstLine', block);
43
50
  assert(isString(block), "not a string");
44
51
  pos = block.indexOf('\n');
45
- if (pos === -1) {
46
- return block;
47
- } else {
48
- return block.substring(0, pos);
52
+ if (pos >= 0) {
53
+ block = block.substring(0, pos);
49
54
  }
55
+ dbgReturn('firstLine', block);
56
+ return block;
50
57
  };
51
58
 
52
59
  // ---------------------------------------------------------------------------