@jdeighan/coffee-utils 7.0.10 → 7.0.13

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jdeighan/coffee-utils",
3
3
  "type": "module",
4
- "version": "7.0.10",
4
+ "version": "7.0.13",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
@@ -49,7 +49,7 @@
49
49
  "js-yaml": "^4.1.0",
50
50
  "n-readlines": "^1.0.1",
51
51
  "readline-sync": "^1.4.10",
52
- "svelte": "^3.46.6"
52
+ "svelte": "^3.47.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@jdeighan/unit-tester": "^1.0.5"
@@ -11,6 +11,7 @@ import {
11
11
  } from '@jdeighan/coffee-utils'
12
12
  import {log, LOG} from '@jdeighan/coffee-utils/log'
13
13
  import {debug} from '@jdeighan/coffee-utils/debug'
14
+ import {arrayToBlock} from '@jdeighan/coffee-utils/block'
14
15
 
15
16
  # ---------------------------------------------------------------------------
16
17
  # mydir() - pass argument `import.meta.url` and it will return
package/src/fs_utils.js CHANGED
@@ -34,6 +34,10 @@ import {
34
34
  debug
35
35
  } from '@jdeighan/coffee-utils/debug';
36
36
 
37
+ import {
38
+ arrayToBlock
39
+ } from '@jdeighan/coffee-utils/block';
40
+
37
41
  // ---------------------------------------------------------------------------
38
42
  // mydir() - pass argument `import.meta.url` and it will return
39
43
  // the directory your file is in
@@ -15,23 +15,28 @@ putstr = undef
15
15
  export stringify = undef
16
16
 
17
17
  # ---------------------------------------------------------------------------
18
- # This is useful for debugging and easy to remove after debugging
18
+ # This is useful for debugging
19
19
 
20
20
  export LOG = (lArgs...) ->
21
21
 
22
22
  [label, item] = lArgs
23
23
  if lArgs.length > 1
24
- console.log sep_dash
25
- if item?
26
- console.log "#{label}:"
27
- console.log untabify(orderedStringify(item))
24
+ # --- There's both a label and an item
25
+ if ! item?
26
+ console.log "#{label}: UNDEFINED"
28
27
  else
29
- console.log "[#{label}]: UNDEFINED"
30
- console.log sep_dash
28
+ console.log sep_dash
29
+ console.log "#{label}:"
30
+ if isString(item)
31
+ console.log item
32
+ else
33
+ console.log untabify(orderedStringify(item))
34
+ console.log sep_dash
31
35
  else
32
36
  console.log label
33
37
  return
34
38
 
39
+ # --- Use this instead to make it easier to remove all instances
35
40
  export DEBUG = LOG # synonym
36
41
 
37
42
  # ---------------------------------------------------------------------------
@@ -93,7 +98,7 @@ export orderedStringify = (obj, escape=false) ->
93
98
  skipInvalid: true
94
99
  indent: 1
95
100
  sortKeys: true
96
- lineWidth: -1
101
+ lineWidth: 40
97
102
  replacer: if escape then escReplacer else (name,value) -> value
98
103
  })
99
104
 
package/src/log_utils.js CHANGED
@@ -34,24 +34,29 @@ putstr = undef;
34
34
  export var stringify = undef;
35
35
 
36
36
  // ---------------------------------------------------------------------------
37
- // This is useful for debugging and easy to remove after debugging
37
+ // This is useful for debugging
38
38
  export var LOG = function(...lArgs) {
39
39
  var item, label;
40
40
  [label, item] = lArgs;
41
41
  if (lArgs.length > 1) {
42
- console.log(sep_dash);
43
- if (item != null) {
44
- console.log(`${label}:`);
45
- console.log(untabify(orderedStringify(item)));
42
+ if (item == null) {
43
+ console.log(`${label}: UNDEFINED`);
46
44
  } else {
47
- console.log(`[${label}]: UNDEFINED`);
45
+ console.log(sep_dash);
46
+ console.log(`${label}:`);
47
+ if (isString(item)) {
48
+ console.log(item);
49
+ } else {
50
+ console.log(untabify(orderedStringify(item)));
51
+ }
52
+ console.log(sep_dash);
48
53
  }
49
- console.log(sep_dash);
50
54
  } else {
51
55
  console.log(label);
52
56
  }
53
57
  };
54
58
 
59
+ // --- Use this instead to make it easier to remove all instances
55
60
  export var DEBUG = LOG; // synonym
56
61
 
57
62
 
@@ -113,7 +118,7 @@ export var orderedStringify = function(obj, escape = false) {
113
118
  skipInvalid: true,
114
119
  indent: 1,
115
120
  sortKeys: true,
116
- lineWidth: -1,
121
+ lineWidth: 40,
117
122
  replacer: escape ? escReplacer : function(name, value) {
118
123
  return value;
119
124
  }