@jdeighan/coffee-utils 7.0.39 → 7.0.42
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +3 -3
- package/src/coffee_utils.coffee +12 -0
- package/src/coffee_utils.js +8 -0
- package/src/indent_utils.coffee +3 -3
- package/src/indent_utils.js +3 -3
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.42",
|
5
5
|
"description": "A set of utility functions for CoffeeScript",
|
6
6
|
"main": "coffee_utils.js",
|
7
7
|
"exports": {
|
@@ -49,9 +49,9 @@
|
|
49
49
|
"js-yaml": "^4.1.0",
|
50
50
|
"n-readlines": "^1.0.1",
|
51
51
|
"readline-sync": "^1.4.10",
|
52
|
-
"svelte": "^3.
|
52
|
+
"svelte": "^3.48.0"
|
53
53
|
},
|
54
54
|
"devDependencies": {
|
55
|
-
"@jdeighan/unit-tester": "^2.0.
|
55
|
+
"@jdeighan/unit-tester": "^2.0.1"
|
56
56
|
}
|
57
57
|
}
|
package/src/coffee_utils.coffee
CHANGED
@@ -7,6 +7,18 @@ LOG = (lArgs...) -> console.log lArgs... # synonym for console.log()
|
|
7
7
|
|
8
8
|
export doHaltOnError = false
|
9
9
|
|
10
|
+
# ---------------------------------------------------------------------------
|
11
|
+
# TEMP!!!!!
|
12
|
+
|
13
|
+
export isComment = (line) ->
|
14
|
+
|
15
|
+
lMatches = line.match(///^
|
16
|
+
\s*
|
17
|
+
\#
|
18
|
+
(\s|$)
|
19
|
+
///)
|
20
|
+
return defined(lMatches)
|
21
|
+
|
10
22
|
# ---------------------------------------------------------------------------
|
11
23
|
|
12
24
|
export haltOnError = () ->
|
package/src/coffee_utils.js
CHANGED
@@ -15,6 +15,14 @@ LOG = function(...lArgs) {
|
|
15
15
|
|
16
16
|
export var doHaltOnError = false;
|
17
17
|
|
18
|
+
// ---------------------------------------------------------------------------
|
19
|
+
// TEMP!!!!!
|
20
|
+
export var isComment = function(line) {
|
21
|
+
var lMatches;
|
22
|
+
lMatches = line.match(/^\s*\#(\s|$)/);
|
23
|
+
return defined(lMatches);
|
24
|
+
};
|
25
|
+
|
18
26
|
// ---------------------------------------------------------------------------
|
19
27
|
export var haltOnError = function() {
|
20
28
|
return doHaltOnError = true;
|
package/src/indent_utils.coffee
CHANGED
@@ -32,10 +32,10 @@ export indentation = (level) ->
|
|
32
32
|
# indentLevel - determine indent level of a string
|
33
33
|
# it's OK if the string is ONLY indentation
|
34
34
|
|
35
|
-
export indentLevel = (
|
35
|
+
export indentLevel = (line) ->
|
36
36
|
|
37
|
-
assert isString(
|
38
|
-
lMatches =
|
37
|
+
assert isString(line), "indentLevel(): non-string #{OL(line)}"
|
38
|
+
lMatches = line.match(/^\t*/)
|
39
39
|
return lMatches[0].length
|
40
40
|
|
41
41
|
# ---------------------------------------------------------------------------
|
package/src/indent_utils.js
CHANGED
@@ -43,10 +43,10 @@ export var indentation = function(level) {
|
|
43
43
|
// ---------------------------------------------------------------------------
|
44
44
|
// indentLevel - determine indent level of a string
|
45
45
|
// it's OK if the string is ONLY indentation
|
46
|
-
export var indentLevel = function(
|
46
|
+
export var indentLevel = function(line) {
|
47
47
|
var lMatches;
|
48
|
-
assert(isString(
|
49
|
-
lMatches =
|
48
|
+
assert(isString(line), `indentLevel(): non-string ${OL(line)}`);
|
49
|
+
lMatches = line.match(/^\t*/);
|
50
50
|
return lMatches[0].length;
|
51
51
|
};
|
52
52
|
|