@jdeighan/coffee-utils 7.0.46 → 7.0.49
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +2 -2
- package/src/DataStores.js +1 -1
- package/src/arrow.js +1 -1
- package/src/block_utils.js +1 -1
- package/src/browser_utils.js +1 -1
- package/src/call_stack.js +1 -1
- package/src/coffee_utils.js +1 -1
- package/src/debug_utils.coffee +10 -4
- package/src/debug_utils.js +13 -5
- package/src/fs_utils.js +1 -1
- package/src/indent_utils.coffee +9 -0
- package/src/indent_utils.js +10 -1
- package/src/log_utils.js +1 -1
- package/src/server_utils.js +1 -1
- package/src/svelte_utils.js +1 -1
- package/src/taml.js +1 -1
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@jdeighan/coffee-utils",
|
3
3
|
"type": "module",
|
4
|
-
"version": "7.0.
|
4
|
+
"version": "7.0.49",
|
5
5
|
"description": "A set of utility functions for CoffeeScript",
|
6
6
|
"main": "coffee_utils.js",
|
7
7
|
"exports": {
|
@@ -52,6 +52,6 @@
|
|
52
52
|
"svelte": "^3.48.0"
|
53
53
|
},
|
54
54
|
"devDependencies": {
|
55
|
-
"@jdeighan/unit-tester": "^2.0.
|
55
|
+
"@jdeighan/unit-tester": "^2.0.3"
|
56
56
|
}
|
57
57
|
}
|
package/src/DataStores.js
CHANGED
package/src/arrow.js
CHANGED
package/src/block_utils.js
CHANGED
package/src/browser_utils.js
CHANGED
package/src/call_stack.js
CHANGED
package/src/coffee_utils.js
CHANGED
package/src/debug_utils.coffee
CHANGED
@@ -143,7 +143,6 @@ adjustStack = (str) ->
|
|
143
143
|
undef
|
144
144
|
if shouldLogString(str) then 'string' else undef
|
145
145
|
]
|
146
|
-
return
|
147
146
|
|
148
147
|
# ---------------------------------------------------------------------------
|
149
148
|
|
@@ -159,15 +158,22 @@ export debug = (lArgs...) ->
|
|
159
158
|
|
160
159
|
if doDebugDebug
|
161
160
|
if nArgs==1
|
162
|
-
LOG "debug('#{escapeStr(label)}')"
|
161
|
+
LOG "debug('#{escapeStr(label)}') - 1 arg"
|
163
162
|
else
|
164
|
-
LOG "debug('#{escapeStr(label)}', #{typeof item})"
|
163
|
+
LOG "debug('#{escapeStr(label)}', #{typeof item}) - 2 args"
|
164
|
+
LOG "debugging flag = #{OL(debugging)}"
|
165
165
|
|
166
166
|
# --- We always need to manipulate the stack when we encounter
|
167
167
|
# either "enter X" or "return from X", so we can't short-circuit
|
168
168
|
# when debugging is off
|
169
169
|
|
170
|
-
|
170
|
+
lResult = adjustStack(label)
|
171
|
+
if doDebugDebug
|
172
|
+
LOG 'lResult', lResult
|
173
|
+
[mainPre, auxPre, hEnv, type] = lResult
|
174
|
+
if doDebugDebug && (type == undef)
|
175
|
+
LOG "type is undef - NOT LOGGING"
|
176
|
+
|
171
177
|
hOptions = {
|
172
178
|
prefix: mainPre
|
173
179
|
itemPrefix: auxPre
|
package/src/debug_utils.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Generated by CoffeeScript 2.
|
1
|
+
// Generated by CoffeeScript 2.7.0
|
2
2
|
// debug_utils.coffee
|
3
3
|
var adjustStack, doDebugDebug, reMethod, resetDebugging, shouldLogFunc, shouldLogString, stack;
|
4
4
|
|
@@ -161,7 +161,7 @@ adjustStack = function(str) {
|
|
161
161
|
|
162
162
|
// ---------------------------------------------------------------------------
|
163
163
|
export var debug = function(...lArgs) {
|
164
|
-
var auxPre, hEnv, hOptions, item, label, mainPre, nArgs, orgDebugging, trans, type;
|
164
|
+
var auxPre, hEnv, hOptions, item, lResult, label, mainPre, nArgs, orgDebugging, trans, type;
|
165
165
|
// --- We want to allow item to be undef. Therefore, we need to
|
166
166
|
// distinguish between 1 arg sent vs. 2 args sent
|
167
167
|
nArgs = lArgs.length;
|
@@ -170,15 +170,23 @@ export var debug = function(...lArgs) {
|
|
170
170
|
assert(isString(label), `debug(): 1st arg ${OL(label)} should be a string`);
|
171
171
|
if (doDebugDebug) {
|
172
172
|
if (nArgs === 1) {
|
173
|
-
LOG(`debug('${escapeStr(label)}')`);
|
173
|
+
LOG(`debug('${escapeStr(label)}') - 1 arg`);
|
174
174
|
} else {
|
175
|
-
LOG(`debug('${escapeStr(label)}', ${typeof item})`);
|
175
|
+
LOG(`debug('${escapeStr(label)}', ${typeof item}) - 2 args`);
|
176
176
|
}
|
177
|
+
LOG(`debugging flag = ${OL(debugging)}`);
|
177
178
|
}
|
178
179
|
// --- We always need to manipulate the stack when we encounter
|
179
180
|
// either "enter X" or "return from X", so we can't short-circuit
|
180
181
|
// when debugging is off
|
181
|
-
|
182
|
+
lResult = adjustStack(label);
|
183
|
+
if (doDebugDebug) {
|
184
|
+
LOG('lResult', lResult);
|
185
|
+
}
|
186
|
+
[mainPre, auxPre, hEnv, type] = lResult;
|
187
|
+
if (doDebugDebug && (type === undef)) {
|
188
|
+
LOG("type is undef - NOT LOGGING");
|
189
|
+
}
|
182
190
|
hOptions = {
|
183
191
|
prefix: mainPre,
|
184
192
|
itemPrefix: auxPre
|
package/src/fs_utils.js
CHANGED
package/src/indent_utils.coffee
CHANGED
@@ -38,6 +38,15 @@ export indentLevel = (line) ->
|
|
38
38
|
lMatches = line.match(/^\t*/)
|
39
39
|
return lMatches[0].length
|
40
40
|
|
41
|
+
# ---------------------------------------------------------------------------
|
42
|
+
# isUndented - true iff indentLevel(line) == 0
|
43
|
+
|
44
|
+
export isUndented = (line) ->
|
45
|
+
|
46
|
+
assert isString(line), "non-string #{OL(line)}"
|
47
|
+
lMatches = line.match(/^\t*/)
|
48
|
+
return (lMatches[0].length == 0)
|
49
|
+
|
41
50
|
# ---------------------------------------------------------------------------
|
42
51
|
# indented - add indentation to each string in a block
|
43
52
|
|
package/src/indent_utils.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// Generated by CoffeeScript 2.
|
1
|
+
// Generated by CoffeeScript 2.7.0
|
2
2
|
// indent_utils.coffee
|
3
3
|
import {
|
4
4
|
assert,
|
@@ -50,6 +50,15 @@ export var indentLevel = function(line) {
|
|
50
50
|
return lMatches[0].length;
|
51
51
|
};
|
52
52
|
|
53
|
+
// ---------------------------------------------------------------------------
|
54
|
+
// isUndented - true iff indentLevel(line) == 0
|
55
|
+
export var isUndented = function(line) {
|
56
|
+
var lMatches;
|
57
|
+
assert(isString(line), `non-string ${OL(line)}`);
|
58
|
+
lMatches = line.match(/^\t*/);
|
59
|
+
return lMatches[0].length === 0;
|
60
|
+
};
|
61
|
+
|
53
62
|
// ---------------------------------------------------------------------------
|
54
63
|
// indented - add indentation to each string in a block
|
55
64
|
export var indented = function(input, level = 1) {
|
package/src/log_utils.js
CHANGED
package/src/server_utils.js
CHANGED
package/src/svelte_utils.js
CHANGED
package/src/taml.js
CHANGED