@jdeighan/coffee-utils 13.0.15 → 14.0.0

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,11 +1,11 @@
1
1
  {
2
2
  "name": "@jdeighan/coffee-utils",
3
3
  "type": "module",
4
- "version": "13.0.15",
4
+ "version": "14.0.0",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
8
- ".": "./src/utils.js",
8
+ ".": "./src/coffee-utils.js",
9
9
  "./server": "./src/server.js",
10
10
  "./browser": "./src/browser.js",
11
11
  "./fs": "./src/fs.js",
@@ -50,13 +50,13 @@
50
50
  },
51
51
  "homepage": "https://github.com/johndeighan/coffee-utils#readme",
52
52
  "dependencies": {
53
- "@jdeighan/base-utils": "^2.0.10",
53
+ "@jdeighan/base-utils": "^3.0.2",
54
54
  "cross-env": "^7.0.3",
55
55
  "n-readlines": "^1.0.1",
56
56
  "readline-sync": "^1.4.10",
57
57
  "svelte": "^3.55.0"
58
58
  },
59
59
  "devDependencies": {
60
- "@jdeighan/unit-tester": "^3.0.10"
60
+ "@jdeighan/unit-tester": "^3.0.15"
61
61
  }
62
62
  }
@@ -3,9 +3,9 @@
3
3
  import pathlib from 'path'
4
4
  import {writable, readable, get} from 'svelte/store'
5
5
 
6
- import {assert, croak} from '@jdeighan/base-utils'
6
+ import {undef, pass, range} from '@jdeighan/base-utils'
7
+ import {assert, croak} from '@jdeighan/base-utils/exceptions'
7
8
  import {fromTAML} from '@jdeighan/base-utils/taml'
8
- import {undef, pass, range} from '@jdeighan/coffee-utils'
9
9
  import {localStore} from '@jdeighan/coffee-utils/browser'
10
10
  import {
11
11
  withExt, slurp, barf, newerDestFileExists,
package/src/DataStores.js CHANGED
@@ -8,21 +8,21 @@ import {
8
8
  get
9
9
  } from 'svelte/store';
10
10
 
11
+ import {
12
+ undef,
13
+ pass,
14
+ range
15
+ } from '@jdeighan/base-utils';
16
+
11
17
  import {
12
18
  assert,
13
19
  croak
14
- } from '@jdeighan/base-utils';
20
+ } from '@jdeighan/base-utils/exceptions';
15
21
 
16
22
  import {
17
23
  fromTAML
18
24
  } from '@jdeighan/base-utils/taml';
19
25
 
20
- import {
21
- undef,
22
- pass,
23
- range
24
- } from '@jdeighan/coffee-utils';
25
-
26
26
  import {
27
27
  localStore
28
28
  } from '@jdeighan/coffee-utils/browser';
@@ -1,14 +1,16 @@
1
1
  # KeyedSet.coffee
2
2
 
3
- import {assert, croak, LOG, LOGVALUE} from '@jdeighan/base-utils'
4
- import {
5
- dbgEnter, dbgReturn, dbg,
6
- } from '@jdeighan/base-utils/debug'
7
3
  import {
8
4
  undef, defined, notdefined, OL, deepCopy,
9
- isString, isNonEmptyString, isArray, isHash, isArrayOfStrings,
5
+ isString, isNonEmptyString, isArray, isHash,
10
6
  isEmpty, nonEmpty,
11
- } from '@jdeighan/coffee-utils'
7
+ } from '@jdeighan/base-utils'
8
+ import {assert, croak} from '@jdeighan/base-utils/exceptions'
9
+ import {LOG, LOGVALUE} from '@jdeighan/base-utils/log'
10
+ import {
11
+ dbgEnter, dbgReturn, dbg,
12
+ } from '@jdeighan/base-utils/debug'
13
+ import {isArrayOfStrings} from '@jdeighan/coffee-utils'
12
14
 
13
15
  # ---------------------------------------------------------------------------
14
16
 
package/src/KeyedSet.js CHANGED
@@ -1,18 +1,5 @@
1
1
  // Generated by CoffeeScript 2.7.0
2
2
  // KeyedSet.coffee
3
- import {
4
- assert,
5
- croak,
6
- LOG,
7
- LOGVALUE
8
- } from '@jdeighan/base-utils';
9
-
10
- import {
11
- dbgEnter,
12
- dbgReturn,
13
- dbg
14
- } from '@jdeighan/base-utils/debug';
15
-
16
3
  import {
17
4
  undef,
18
5
  defined,
@@ -23,9 +10,28 @@ import {
23
10
  isNonEmptyString,
24
11
  isArray,
25
12
  isHash,
26
- isArrayOfStrings,
27
13
  isEmpty,
28
14
  nonEmpty
15
+ } from '@jdeighan/base-utils';
16
+
17
+ import {
18
+ assert,
19
+ croak
20
+ } from '@jdeighan/base-utils/exceptions';
21
+
22
+ import {
23
+ LOG,
24
+ LOGVALUE
25
+ } from '@jdeighan/base-utils/log';
26
+
27
+ import {
28
+ dbgEnter,
29
+ dbgReturn,
30
+ dbg
31
+ } from '@jdeighan/base-utils/debug';
32
+
33
+ import {
34
+ isArrayOfStrings
29
35
  } from '@jdeighan/coffee-utils';
30
36
 
31
37
  // ---------------------------------------------------------------------------
@@ -1,11 +1,10 @@
1
1
  # Section.coffee
2
2
 
3
- import {assert, croak} from '@jdeighan/base-utils'
3
+ import {assert, croak} from '@jdeighan/base-utils/exceptions'
4
4
  import {dbg, dbgEnter, dbgReturn} from '@jdeighan/base-utils/debug'
5
5
  import {
6
- pass, undef, defined, isArray, isEmpty, isFunction,
7
- } from '@jdeighan/coffee-utils'
8
- import {toBlock} from '@jdeighan/coffee-utils/block'
6
+ pass, undef, defined, isArray, isEmpty, isFunction, toBlock,
7
+ } from '@jdeighan/base-utils'
9
8
 
10
9
  # ---------------------------------------------------------------------------
11
10
 
package/src/Section.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  assert,
5
5
  croak
6
- } from '@jdeighan/base-utils';
6
+ } from '@jdeighan/base-utils/exceptions';
7
7
 
8
8
  import {
9
9
  dbg,
@@ -17,12 +17,9 @@ import {
17
17
  defined,
18
18
  isArray,
19
19
  isEmpty,
20
- isFunction
21
- } from '@jdeighan/coffee-utils';
22
-
23
- import {
20
+ isFunction,
24
21
  toBlock
25
- } from '@jdeighan/coffee-utils/block';
22
+ } from '@jdeighan/base-utils';
26
23
 
27
24
  // ---------------------------------------------------------------------------
28
25
  export var Section = class Section {
@@ -1,17 +1,19 @@
1
1
  # SectionMap.coffee
2
2
 
3
- import {
4
- assert, croak, LOG, LOGVALUE, LOGTAML, isTAML, fromTAML,
5
- } from '@jdeighan/base-utils'
3
+ import {assert, croak} from '@jdeighan/base-utils/exceptions'
4
+ import {LOG, LOGVALUE, LOGTAML} from '@jdeighan/base-utils/log'
5
+ import {isTAML, fromTAML} from '@jdeighan/base-utils/taml'
6
6
  import {
7
7
  dbg, dbgEnter, dbgReturn, dbgYield, dbgResume,
8
8
  } from '@jdeighan/base-utils/debug'
9
9
  import {
10
10
  pass, undef, defined, notdefined, OL, isEmpty, nonEmpty,
11
- isString, isHash, isArray, isUniqueTree, isNonEmptyString,
12
- isNonEmptyArray, isFunction, jsType, isArrayOfStrings,
11
+ isString, isHash, isArray, isNonEmptyString,
12
+ isFunction, jsType, toBlock,
13
+ } from '@jdeighan/base-utils'
14
+ import {
15
+ isArrayOfStrings, isNonEmptyArray, isUniqueTree,
13
16
  } from '@jdeighan/coffee-utils'
14
- import {toBlock} from '@jdeighan/coffee-utils/block'
15
17
  import {Section} from '@jdeighan/coffee-utils/section'
16
18
 
17
19
  # ---------------------------------------------------------------------------
package/src/SectionMap.js CHANGED
@@ -4,13 +4,19 @@ var isSectionName, isSetName;
4
4
 
5
5
  import {
6
6
  assert,
7
- croak,
7
+ croak
8
+ } from '@jdeighan/base-utils/exceptions';
9
+
10
+ import {
8
11
  LOG,
9
12
  LOGVALUE,
10
- LOGTAML,
13
+ LOGTAML
14
+ } from '@jdeighan/base-utils/log';
15
+
16
+ import {
11
17
  isTAML,
12
18
  fromTAML
13
- } from '@jdeighan/base-utils';
19
+ } from '@jdeighan/base-utils/taml';
14
20
 
15
21
  import {
16
22
  dbg,
@@ -31,17 +37,17 @@ import {
31
37
  isString,
32
38
  isHash,
33
39
  isArray,
34
- isUniqueTree,
35
40
  isNonEmptyString,
36
- isNonEmptyArray,
37
41
  isFunction,
38
42
  jsType,
39
- isArrayOfStrings
40
- } from '@jdeighan/coffee-utils';
43
+ toBlock
44
+ } from '@jdeighan/base-utils';
41
45
 
42
46
  import {
43
- toBlock
44
- } from '@jdeighan/coffee-utils/block';
47
+ isArrayOfStrings,
48
+ isNonEmptyArray,
49
+ isUniqueTree
50
+ } from '@jdeighan/coffee-utils';
45
51
 
46
52
  import {
47
53
  Section
package/src/block.coffee CHANGED
@@ -3,73 +3,12 @@
3
3
  import fs from 'fs'
4
4
  import readline from 'readline'
5
5
 
6
- import {assert, croak} from '@jdeighan/base-utils'
7
- import {blockToArray, arrayToBlock} from '@jdeighan/base-utils/utils'
6
+ import {assert, croak} from '@jdeighan/base-utils/exceptions'
8
7
  import {
9
- undef, pass, defined, notdefined,
10
- isEmpty, isString, isArray, nonEmpty, isArrayOfStrings,
11
- rtrim, OL,
12
- } from '@jdeighan/coffee-utils'
13
-
14
- export {blockToArray, arrayToBlock}
15
-
16
- # ---------------------------------------------------------------------------
17
- # toArray - split a block or array into lines w/o newlines
18
-
19
- export toArray = (item, option=undef) ->
20
- # --- Valid options:
21
- # 'noEmptyLines'
22
- # 'noLeadingEmptyLines'
23
-
24
- if isString(item)
25
- lLines = item.split(/\r?\n/)
26
- else if isArray(item)
27
- lLines = item
28
- else
29
- croak "Not a string or array"
30
-
31
- # --- We need to ensure that no strings contain newlines
32
- # and possibly remove empty lines
33
- lNewLines = []
34
- nonEmptyFound = false
35
- for line in lLines
36
- if isEmpty(line)
37
- if (option == 'noEmptyLines') \
38
- || ((option == 'noLeadingEmptyLines') && ! nonEmptyFound)
39
- pass
40
- else
41
- lNewLines.push ''
42
- else if (line.indexOf("\n") > -1)
43
- for substr in toArray(line)
44
- if isEmpty(substr)
45
- if (option == 'noEmptyLines') \
46
- || ((option == 'noLeadingEmptyLines') && ! nonEmptyFound)
47
- pass
48
- else
49
- lNewLines.push ''
50
- else
51
- nonEmptyFound = true
52
- lNewLines.push substr
53
- else
54
- nonEmptyFound = true
55
- lNewLines.push line
56
- return lNewLines
57
-
58
- # ---------------------------------------------------------------------------
59
- # toBlock - block may have trailing whitespace
60
- # but undef items are ignored
61
-
62
- export toBlock = (lLines) ->
63
-
64
- if notdefined(lLines)
65
- return undef
66
- assert isArrayOfStrings(lLines),
67
- "lLines is not an array of strings: #{OL(lLines)}"
68
- lNewLines = []
69
- for line in lLines
70
- if defined(line)
71
- lNewLines.push rtrim(line)
72
- return lNewLines.join("\n")
8
+ undef, pass, defined, notdefined, rtrim, OL,
9
+ isEmpty, isString, isArray, nonEmpty, toArray, toBlock,
10
+ } from '@jdeighan/base-utils'
11
+ import {isArrayOfStrings} from '@jdeighan/coffee-utils'
73
12
 
74
13
  # ---------------------------------------------------------------------------
75
14
 
@@ -113,7 +52,7 @@ export normalizeBlock = (content) ->
113
52
 
114
53
  if typeof content != 'string'
115
54
  throw new Error("normalizeBlock(): not a string")
116
- lLines = for line in blockToArray(content)
55
+ lLines = for line in toArray(content)
117
56
  line = line.trim()
118
57
  line.replace(/\s+/g, ' ')
119
58
  lLines = lLines.filter (line) -> line != ''
@@ -124,9 +63,9 @@ export normalizeBlock = (content) ->
124
63
 
125
64
  export truncateBlock = (str, numLines) ->
126
65
 
127
- lLines = blockToArray str
66
+ lLines = toArray str
128
67
  lLines.length = numLines
129
- return arrayToBlock lLines
68
+ return toBlock lLines
130
69
 
131
70
  # ---------------------------------------------------------------------------
132
71
 
package/src/block.js CHANGED
@@ -7,99 +7,26 @@ import readline from 'readline';
7
7
  import {
8
8
  assert,
9
9
  croak
10
- } from '@jdeighan/base-utils';
11
-
12
- import {
13
- blockToArray,
14
- arrayToBlock
15
- } from '@jdeighan/base-utils/utils';
10
+ } from '@jdeighan/base-utils/exceptions';
16
11
 
17
12
  import {
18
13
  undef,
19
14
  pass,
20
15
  defined,
21
16
  notdefined,
17
+ rtrim,
18
+ OL,
22
19
  isEmpty,
23
20
  isString,
24
21
  isArray,
25
22
  nonEmpty,
26
- isArrayOfStrings,
27
- rtrim,
28
- OL
29
- } from '@jdeighan/coffee-utils';
30
-
31
- export {
32
- blockToArray,
33
- arrayToBlock
34
- };
35
-
36
- // ---------------------------------------------------------------------------
37
- // toArray - split a block or array into lines w/o newlines
38
- export var toArray = function(item, option = undef) {
39
- var i, j, lLines, lNewLines, len, len1, line, nonEmptyFound, ref, substr;
40
- // --- Valid options:
41
- // 'noEmptyLines'
42
- // 'noLeadingEmptyLines'
43
- if (isString(item)) {
44
- lLines = item.split(/\r?\n/);
45
- } else if (isArray(item)) {
46
- lLines = item;
47
- } else {
48
- croak("Not a string or array");
49
- }
50
- // --- We need to ensure that no strings contain newlines
51
- // and possibly remove empty lines
52
- lNewLines = [];
53
- nonEmptyFound = false;
54
- for (i = 0, len = lLines.length; i < len; i++) {
55
- line = lLines[i];
56
- if (isEmpty(line)) {
57
- if ((option === 'noEmptyLines') || ((option === 'noLeadingEmptyLines') && !nonEmptyFound)) {
58
- pass;
59
- } else {
60
- lNewLines.push('');
61
- }
62
- } else if (line.indexOf("\n") > -1) {
63
- ref = toArray(line);
64
- for (j = 0, len1 = ref.length; j < len1; j++) {
65
- substr = ref[j];
66
- if (isEmpty(substr)) {
67
- if ((option === 'noEmptyLines') || ((option === 'noLeadingEmptyLines') && !nonEmptyFound)) {
68
- pass;
69
- } else {
70
- lNewLines.push('');
71
- }
72
- } else {
73
- nonEmptyFound = true;
74
- lNewLines.push(substr);
75
- }
76
- }
77
- } else {
78
- nonEmptyFound = true;
79
- lNewLines.push(line);
80
- }
81
- }
82
- return lNewLines;
83
- };
23
+ toArray,
24
+ toBlock
25
+ } from '@jdeighan/base-utils';
84
26
 
85
- // ---------------------------------------------------------------------------
86
- // toBlock - block may have trailing whitespace
87
- // but undef items are ignored
88
- export var toBlock = function(lLines) {
89
- var i, lNewLines, len, line;
90
- if (notdefined(lLines)) {
91
- return undef;
92
- }
93
- assert(isArrayOfStrings(lLines), `lLines is not an array of strings: ${OL(lLines)}`);
94
- lNewLines = [];
95
- for (i = 0, len = lLines.length; i < len; i++) {
96
- line = lLines[i];
97
- if (defined(line)) {
98
- lNewLines.push(rtrim(line));
99
- }
100
- }
101
- return lNewLines.join("\n");
102
- };
27
+ import {
28
+ isArrayOfStrings
29
+ } from '@jdeighan/coffee-utils';
103
30
 
104
31
  // ---------------------------------------------------------------------------
105
32
  export var splitBlock = function(block) {
@@ -147,7 +74,7 @@ export var normalizeBlock = function(content) {
147
74
  }
148
75
  lLines = (function() {
149
76
  var i, len, ref, results;
150
- ref = blockToArray(content);
77
+ ref = toArray(content);
151
78
  results = [];
152
79
  for (i = 0, len = ref.length; i < len; i++) {
153
80
  line = ref[i];
@@ -166,9 +93,9 @@ export var normalizeBlock = function(content) {
166
93
  // truncateBlock - limit block to a certain number of lines
167
94
  export var truncateBlock = function(str, numLines) {
168
95
  var lLines;
169
- lLines = blockToArray(str);
96
+ lLines = toArray(str);
170
97
  lLines.length = numLines;
171
- return arrayToBlock(lLines);
98
+ return toBlock(lLines);
172
99
  };
173
100
 
174
101
  // ---------------------------------------------------------------------------
@@ -1,6 +1,6 @@
1
1
  # browser.coffee
2
2
 
3
- import {undef} from '@jdeighan/coffee-utils'
3
+ import {undef} from '@jdeighan/base-utils'
4
4
 
5
5
  audio = undef # audio context - create only when needed, then keep
6
6
 
package/src/browser.js CHANGED
@@ -4,7 +4,7 @@ var audio;
4
4
 
5
5
  import {
6
6
  undef
7
- } from '@jdeighan/coffee-utils';
7
+ } from '@jdeighan/base-utils';
8
8
 
9
9
  audio = undef; // audio context - create only when needed, then keep
10
10
 
@@ -1,7 +1,9 @@
1
- # utils.coffee
1
+ # coffee-utils.coffee
2
2
 
3
- import {assert, croak} from '@jdeighan/base-utils'
4
- import {LOG, LOGVALUE, sep_dash, sep_eq} from '@jdeighan/base-utils/log'
3
+ import {assert, croak} from '@jdeighan/base-utils/exceptions'
4
+ import {
5
+ LOG, LOGVALUE, sep_dash, sep_eq,
6
+ } from '@jdeighan/base-utils/log'
5
7
  import {
6
8
  dbgEnter, dbgReturn, dbgYield, dbgResume, dbg, setDebugging,
7
9
  } from '@jdeighan/base-utils/debug'
@@ -10,21 +12,9 @@ import {
10
12
  deepCopy, escapeStr, unescapeStr, hasChar, quoted, OL,
11
13
  isString, isNumber, isInteger, isHash, isArray, isBoolean,
12
14
  isConstructor, isFunction, isRegExp, isObject, getClassName,
13
- jsType, oneof,
14
- isEmpty, nonEmpty, chomp, rtrim, setCharsAt, words, getOptions,
15
- } from '@jdeighan/base-utils/utils'
16
-
17
- export {
18
- assert, croak,
19
- LOG, LOGVALUE, sep_dash, sep_eq,
20
- dbgEnter, dbgReturn, dbgYield, dbgResume, dbg, setDebugging,
21
- undef, pass, defined, notdefined,
22
- deepCopy, escapeStr, unescapeStr, hasChar, quoted, OL,
23
- isString, isNumber, isInteger, isHash, isArray, isBoolean,
24
- isConstructor, isFunction, isRegExp, isObject, getClassName,
25
- jsType, oneof,
15
+ jsType, oneof, isIterable,
26
16
  isEmpty, nonEmpty, chomp, rtrim, setCharsAt, words, getOptions,
27
- }
17
+ } from '@jdeighan/base-utils'
28
18
 
29
19
  # ---------------------------------------------------------------------------
30
20
 
@@ -347,14 +337,6 @@ export replaceVars = (line, hVars={}, rx=/__(env\.)?([A-Za-z_]\w*)__/g) ->
347
337
 
348
338
  # ---------------------------------------------------------------------------
349
339
 
350
- export isIterable = (obj) ->
351
-
352
- if (obj == undef) || (obj == null)
353
- return false
354
- return typeof obj[Symbol.iterator] == 'function'
355
-
356
- # ---------------------------------------------------------------------------
357
-
358
340
  export className = (aClass) ->
359
341
 
360
342
  if lMatches = aClass.toString().match(/class\s+(\w+)/)
@@ -364,12 +346,6 @@ export className = (aClass) ->
364
346
 
365
347
  # ---------------------------------------------------------------------------
366
348
 
367
- export range = (n) ->
368
-
369
- return [0..n-1]
370
-
371
- # ---------------------------------------------------------------------------
372
-
373
349
  export timestamp = () ->
374
350
 
375
351
  return new Date().toLocaleTimeString("en-US")
@@ -1,11 +1,11 @@
1
1
  // Generated by CoffeeScript 2.7.0
2
- // utils.coffee
2
+ // coffee-utils.coffee
3
3
  var hasProp = {}.hasOwnProperty;
4
4
 
5
5
  import {
6
6
  assert,
7
7
  croak
8
- } from '@jdeighan/base-utils';
8
+ } from '@jdeighan/base-utils/exceptions';
9
9
 
10
10
  import {
11
11
  LOG,
@@ -47,6 +47,7 @@ import {
47
47
  getClassName,
48
48
  jsType,
49
49
  oneof,
50
+ isIterable,
50
51
  isEmpty,
51
52
  nonEmpty,
52
53
  chomp,
@@ -54,52 +55,7 @@ import {
54
55
  setCharsAt,
55
56
  words,
56
57
  getOptions
57
- } from '@jdeighan/base-utils/utils';
58
-
59
- export {
60
- assert,
61
- croak,
62
- LOG,
63
- LOGVALUE,
64
- sep_dash,
65
- sep_eq,
66
- dbgEnter,
67
- dbgReturn,
68
- dbgYield,
69
- dbgResume,
70
- dbg,
71
- setDebugging,
72
- undef,
73
- pass,
74
- defined,
75
- notdefined,
76
- deepCopy,
77
- escapeStr,
78
- unescapeStr,
79
- hasChar,
80
- quoted,
81
- OL,
82
- isString,
83
- isNumber,
84
- isInteger,
85
- isHash,
86
- isArray,
87
- isBoolean,
88
- isConstructor,
89
- isFunction,
90
- isRegExp,
91
- isObject,
92
- getClassName,
93
- jsType,
94
- oneof,
95
- isEmpty,
96
- nonEmpty,
97
- chomp,
98
- rtrim,
99
- setCharsAt,
100
- words,
101
- getOptions
102
- };
58
+ } from '@jdeighan/base-utils';
103
59
 
104
60
  // ---------------------------------------------------------------------------
105
61
  export var isHashComment = (line) => {
@@ -459,14 +415,6 @@ export var replaceVars = function(line, hVars = {}, rx = /__(env\.)?([A-Za-z_]\w
459
415
  return line.replace(rx, replacerFunc);
460
416
  };
461
417
 
462
- // ---------------------------------------------------------------------------
463
- export var isIterable = function(obj) {
464
- if ((obj === undef) || (obj === null)) {
465
- return false;
466
- }
467
- return typeof obj[Symbol.iterator] === 'function';
468
- };
469
-
470
418
  // ---------------------------------------------------------------------------
471
419
  export var className = function(aClass) {
472
420
  var lMatches;
@@ -477,16 +425,6 @@ export var className = function(aClass) {
477
425
  }
478
426
  };
479
427
 
480
- // ---------------------------------------------------------------------------
481
- export var range = function(n) {
482
- var ref;
483
- return (function() {
484
- var results = [];
485
- for (var i = 0, ref = n - 1; 0 <= ref ? i <= ref : i >= ref; 0 <= ref ? i++ : i--){ results.push(i); }
486
- return results;
487
- }).apply(this);
488
- };
489
-
490
428
  // ---------------------------------------------------------------------------
491
429
  export var timestamp = function() {
492
430
  return new Date().toLocaleTimeString("en-US");
package/src/fs.coffee CHANGED
@@ -6,13 +6,14 @@ import fs from 'fs'
6
6
  import readline from 'readline'
7
7
  import NReadLines from 'n-readlines'
8
8
 
9
- import {assert, croak, LOG, fromTAML} from '@jdeighan/base-utils'
10
- import {dbg, dbgEnter, dbgReturn} from '@jdeighan/base-utils/debug'
11
9
  import {
12
10
  undef, pass, defined, rtrim, isEmpty, nonEmpty, getOptions,
13
- isString, isArray, isHash, isRegExp, isFunction, OL,
14
- } from '@jdeighan/coffee-utils'
15
- import {arrayToBlock} from '@jdeighan/coffee-utils/block'
11
+ isString, isArray, isHash, isRegExp, isFunction, OL, toBlock,
12
+ } from '@jdeighan/base-utils'
13
+ import {assert, croak} from '@jdeighan/base-utils/exceptions'
14
+ import {LOG, LOGVALUE} from '@jdeighan/base-utils/log'
15
+ import {dbg, dbgEnter, dbgReturn} from '@jdeighan/base-utils/debug'
16
+ import {fromTAML} from '@jdeighan/base-utils/taml'
16
17
 
17
18
  # ---------------------------------------------------------------------------
18
19
  # mydir() - pass argument import.meta.url and it will return
@@ -216,7 +217,7 @@ export slurp = (filepath, maxLines=undef) ->
216
217
  forEachLine filepath, (line, nLines) ->
217
218
  lLines.push line
218
219
  return (nLines >= maxLines)
219
- contents = arrayToBlock(lLines)
220
+ contents = toBlock(lLines)
220
221
  else
221
222
  filepath = filepath.replace(/\//g, "\\")
222
223
  contents = fs.readFileSync(filepath, 'utf8').toString()
@@ -230,7 +231,7 @@ export barf = (filepath, contents) ->
230
231
  if isEmpty(contents)
231
232
  return
232
233
  if isArray(contents)
233
- contents = arrayToBlock(contents)
234
+ contents = toBlock(contents)
234
235
  else if ! isString(contents)
235
236
  croak "barf(): Invalid contents"
236
237
  contents = rtrim(contents) + "\n"
package/src/fs.js CHANGED
@@ -12,19 +12,6 @@ import readline from 'readline';
12
12
 
13
13
  import NReadLines from 'n-readlines';
14
14
 
15
- import {
16
- assert,
17
- croak,
18
- LOG,
19
- fromTAML
20
- } from '@jdeighan/base-utils';
21
-
22
- import {
23
- dbg,
24
- dbgEnter,
25
- dbgReturn
26
- } from '@jdeighan/base-utils/debug';
27
-
28
15
  import {
29
16
  undef,
30
17
  pass,
@@ -38,12 +25,29 @@ import {
38
25
  isHash,
39
26
  isRegExp,
40
27
  isFunction,
41
- OL
42
- } from '@jdeighan/coffee-utils';
28
+ OL,
29
+ toBlock
30
+ } from '@jdeighan/base-utils';
43
31
 
44
32
  import {
45
- arrayToBlock
46
- } from '@jdeighan/coffee-utils/block';
33
+ assert,
34
+ croak
35
+ } from '@jdeighan/base-utils/exceptions';
36
+
37
+ import {
38
+ LOG,
39
+ LOGVALUE
40
+ } from '@jdeighan/base-utils/log';
41
+
42
+ import {
43
+ dbg,
44
+ dbgEnter,
45
+ dbgReturn
46
+ } from '@jdeighan/base-utils/debug';
47
+
48
+ import {
49
+ fromTAML
50
+ } from '@jdeighan/base-utils/taml';
47
51
 
48
52
  // ---------------------------------------------------------------------------
49
53
  // mydir() - pass argument import.meta.url and it will return
@@ -252,7 +256,7 @@ export var slurp = function(filepath, maxLines = undef) {
252
256
  lLines.push(line);
253
257
  return nLines >= maxLines;
254
258
  });
255
- contents = arrayToBlock(lLines);
259
+ contents = toBlock(lLines);
256
260
  } else {
257
261
  filepath = filepath.replace(/\//g, "\\");
258
262
  contents = fs.readFileSync(filepath, 'utf8').toString();
@@ -267,7 +271,7 @@ export var barf = function(filepath, contents) {
267
271
  return;
268
272
  }
269
273
  if (isArray(contents)) {
270
- contents = arrayToBlock(contents);
274
+ contents = toBlock(contents);
271
275
  } else if (!isString(contents)) {
272
276
  croak("barf(): Invalid contents");
273
277
  }
package/src/fsa.coffee CHANGED
@@ -1,13 +1,12 @@
1
1
  # fsa.coffee
2
2
 
3
- import {assert, croak} from '@jdeighan/base-utils'
3
+ import {assert, croak} from '@jdeighan/base-utils/exceptions'
4
4
  import {LOG} from '@jdeighan/base-utils/log'
5
5
  import {dbg, dbgEnter, dbgReturn} from '@jdeighan/base-utils/debug'
6
6
  import {
7
7
  undef, defined, notdefined, words, isEmpty, nonEmpty,
8
- isString, OL,
9
- } from '@jdeighan/coffee-utils'
10
- import {toArray} from '@jdeighan/coffee-utils/block'
8
+ isString, OL, toArray,
9
+ } from '@jdeighan/base-utils'
11
10
 
12
11
  # ---------------------------------------------------------------------------
13
12
 
package/src/fsa.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  assert,
5
5
  croak
6
- } from '@jdeighan/base-utils';
6
+ } from '@jdeighan/base-utils/exceptions';
7
7
 
8
8
  import {
9
9
  LOG
@@ -23,12 +23,9 @@ import {
23
23
  isEmpty,
24
24
  nonEmpty,
25
25
  isString,
26
- OL
27
- } from '@jdeighan/coffee-utils';
28
-
29
- import {
26
+ OL,
30
27
  toArray
31
- } from '@jdeighan/coffee-utils/block';
28
+ } from '@jdeighan/base-utils';
32
29
 
33
30
  // ---------------------------------------------------------------------------
34
31
  export var FSA = class FSA {
package/src/html.coffee CHANGED
@@ -1,11 +1,10 @@
1
1
  # html.coffee
2
2
 
3
- import {assert, croak} from '@jdeighan/base-utils'
3
+ import {assert, croak} from '@jdeighan/base-utils/exceptions'
4
4
  import {
5
- undef, pass, words, isEmpty, nonEmpty,
6
- } from '@jdeighan/coffee-utils'
5
+ undef, pass, words, isEmpty, nonEmpty, toBlock,
6
+ } from '@jdeighan/base-utils'
7
7
  import {indented} from '@jdeighan/coffee-utils/indent'
8
- import {toBlock} from '@jdeighan/coffee-utils/block'
9
8
 
10
9
  hNoEnd = {}
11
10
  for tagName in words('area base br col command embed hr img input' \
package/src/html.js CHANGED
@@ -5,24 +5,21 @@ var hNoEnd, i, len, ref, tagName;
5
5
  import {
6
6
  assert,
7
7
  croak
8
- } from '@jdeighan/base-utils';
8
+ } from '@jdeighan/base-utils/exceptions';
9
9
 
10
10
  import {
11
11
  undef,
12
12
  pass,
13
13
  words,
14
14
  isEmpty,
15
- nonEmpty
16
- } from '@jdeighan/coffee-utils';
15
+ nonEmpty,
16
+ toBlock
17
+ } from '@jdeighan/base-utils';
17
18
 
18
19
  import {
19
20
  indented
20
21
  } from '@jdeighan/coffee-utils/indent';
21
22
 
22
- import {
23
- toBlock
24
- } from '@jdeighan/coffee-utils/block';
25
-
26
23
  hNoEnd = {};
27
24
 
28
25
  ref = words('area base br col command embed hr img input' + ' keygen link meta param source track wbr');
package/src/indent.coffee CHANGED
@@ -1,11 +1,10 @@
1
1
  # indent.coffee
2
2
 
3
- import {assert, croak} from '@jdeighan/base-utils'
3
+ import {assert, croak} from '@jdeighan/base-utils/exceptions'
4
4
  import {
5
- undef, defined, notdefined,
5
+ undef, defined, notdefined, toArray, toBlock,
6
6
  OL, isInteger, isString, isArray, isEmpty, rtrim,
7
- } from '@jdeighan/coffee-utils'
8
- import {toArray, toBlock} from '@jdeighan/coffee-utils/block'
7
+ } from '@jdeighan/base-utils'
9
8
 
10
9
  # ---------------------------------------------------------------------------
11
10
 
package/src/indent.js CHANGED
@@ -3,24 +3,21 @@
3
3
  import {
4
4
  assert,
5
5
  croak
6
- } from '@jdeighan/base-utils';
6
+ } from '@jdeighan/base-utils/exceptions';
7
7
 
8
8
  import {
9
9
  undef,
10
10
  defined,
11
11
  notdefined,
12
+ toArray,
13
+ toBlock,
12
14
  OL,
13
15
  isInteger,
14
16
  isString,
15
17
  isArray,
16
18
  isEmpty,
17
19
  rtrim
18
- } from '@jdeighan/coffee-utils';
19
-
20
- import {
21
- toArray,
22
- toBlock
23
- } from '@jdeighan/coffee-utils/block';
20
+ } from '@jdeighan/base-utils';
24
21
 
25
22
  // ---------------------------------------------------------------------------
26
23
  export var getOneIndent = function(str) {
package/src/svelte.coffee CHANGED
@@ -1,8 +1,8 @@
1
1
  # svelte.coffee
2
2
 
3
- import {assert, croak} from '@jdeighan/base-utils'
3
+ import {assert, croak} from '@jdeighan/base-utils/exceptions'
4
4
  import {LOG} from '@jdeighan/base-utils/log'
5
- import {isFunction} from '@jdeighan/coffee-utils'
5
+ import {isFunction} from '@jdeighan/base-utils'
6
6
 
7
7
  # ---------------------------------------------------------------------------
8
8
  # svelteSourceCodeEsc - to display source code for a *.starbucks page
package/src/svelte.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  assert,
5
5
  croak
6
- } from '@jdeighan/base-utils';
6
+ } from '@jdeighan/base-utils/exceptions';
7
7
 
8
8
  import {
9
9
  LOG
@@ -11,7 +11,7 @@ import {
11
11
 
12
12
  import {
13
13
  isFunction
14
- } from '@jdeighan/coffee-utils';
14
+ } from '@jdeighan/base-utils';
15
15
 
16
16
  // ---------------------------------------------------------------------------
17
17
  // svelteSourceCodeEsc - to display source code for a *.starbucks page