@jdeighan/coffee-utils 8.0.6 → 8.0.7

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": "8.0.6",
4
+ "version": "8.0.7",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
@@ -12,34 +12,34 @@ export class Section
12
12
 
13
13
  constructor: (@name) ->
14
14
 
15
- @lLines = []
15
+ @lParts = []
16
16
 
17
17
  # ..........................................................
18
18
 
19
19
  length: () ->
20
20
 
21
- return @lLines.length
21
+ return @lParts.length
22
22
 
23
23
  # ..........................................................
24
24
 
25
25
  indent: (level=1) ->
26
26
 
27
- lNewLines = for line in @lLines
27
+ lNewLines = for line in @lParts
28
28
  indented(line, level)
29
- @lLines = lNewLines
29
+ @lParts = lNewLines
30
30
  return
31
31
 
32
32
  # ..........................................................
33
33
 
34
34
  isEmpty: () ->
35
35
 
36
- return (@lLines.length == 0)
36
+ return (@lParts.length == 0)
37
37
 
38
38
  # ..........................................................
39
39
 
40
40
  nonEmpty: () ->
41
41
 
42
- return (@lLines.length > 0)
42
+ return (@lParts.length > 0)
43
43
 
44
44
  # ..........................................................
45
45
 
@@ -47,9 +47,9 @@ export class Section
47
47
 
48
48
  if isArray(data)
49
49
  for line in data
50
- @lLines.push line
50
+ @lParts.push line
51
51
  else
52
- @lLines.push data
52
+ @lParts.push data
53
53
  return
54
54
 
55
55
  # ..........................................................
@@ -57,16 +57,22 @@ export class Section
57
57
  prepend: (data) ->
58
58
 
59
59
  if isArray(data)
60
- @lLines = [data..., @lLines...]
60
+ @lParts = [data..., @lParts...]
61
61
  else
62
- @lLines = [data, @lLines...]
62
+ @lParts = [data, @lParts...]
63
63
  return
64
64
 
65
65
  # ..........................................................
66
66
 
67
+ getParts: () ->
68
+
69
+ return @lParts
70
+
71
+ # ..........................................................
72
+
67
73
  getBlock: () ->
68
74
 
69
- if (@lLines.length == 0)
75
+ if (@lParts.length == 0)
70
76
  return undef
71
77
  else
72
- return arrayToBlock(@lLines)
78
+ return arrayToBlock(@lParts)
package/src/Section.js CHANGED
@@ -21,12 +21,12 @@ import {
21
21
  export var Section = class Section {
22
22
  constructor(name) {
23
23
  this.name = name;
24
- this.lLines = [];
24
+ this.lParts = [];
25
25
  }
26
26
 
27
27
  // ..........................................................
28
28
  length() {
29
- return this.lLines.length;
29
+ return this.lParts.length;
30
30
  }
31
31
 
32
32
  // ..........................................................
@@ -34,7 +34,7 @@ export var Section = class Section {
34
34
  var lNewLines, line;
35
35
  lNewLines = (function() {
36
36
  var i, len, ref, results;
37
- ref = this.lLines;
37
+ ref = this.lParts;
38
38
  results = [];
39
39
  for (i = 0, len = ref.length; i < len; i++) {
40
40
  line = ref[i];
@@ -42,17 +42,17 @@ export var Section = class Section {
42
42
  }
43
43
  return results;
44
44
  }).call(this);
45
- this.lLines = lNewLines;
45
+ this.lParts = lNewLines;
46
46
  }
47
47
 
48
48
  // ..........................................................
49
49
  isEmpty() {
50
- return this.lLines.length === 0;
50
+ return this.lParts.length === 0;
51
51
  }
52
52
 
53
53
  // ..........................................................
54
54
  nonEmpty() {
55
- return this.lLines.length > 0;
55
+ return this.lParts.length > 0;
56
56
  }
57
57
 
58
58
  // ..........................................................
@@ -61,28 +61,33 @@ export var Section = class Section {
61
61
  if (isArray(data)) {
62
62
  for (i = 0, len = data.length; i < len; i++) {
63
63
  line = data[i];
64
- this.lLines.push(line);
64
+ this.lParts.push(line);
65
65
  }
66
66
  } else {
67
- this.lLines.push(data);
67
+ this.lParts.push(data);
68
68
  }
69
69
  }
70
70
 
71
71
  // ..........................................................
72
72
  prepend(data) {
73
73
  if (isArray(data)) {
74
- this.lLines = [...data, ...this.lLines];
74
+ this.lParts = [...data, ...this.lParts];
75
75
  } else {
76
- this.lLines = [data, ...this.lLines];
76
+ this.lParts = [data, ...this.lParts];
77
77
  }
78
78
  }
79
79
 
80
+ // ..........................................................
81
+ getParts() {
82
+ return this.lParts;
83
+ }
84
+
80
85
  // ..........................................................
81
86
  getBlock() {
82
- if (this.lLines.length === 0) {
87
+ if (this.lParts.length === 0) {
83
88
  return undef;
84
89
  } else {
85
- return arrayToBlock(this.lLines);
90
+ return arrayToBlock(this.lParts);
86
91
  }
87
92
  }
88
93
 
@@ -120,7 +120,8 @@ export class SectionMap
120
120
  return
121
121
 
122
122
  # ..........................................................
123
- # --- procFunc should be (name, text) -> return processedText
123
+ # --- procFunc should be (name, block) ->
124
+ # return processed block
124
125
 
125
126
  getBlock: (procFunc=undef, lTree=undef) ->
126
127
 
package/src/SectionMap.js CHANGED
@@ -147,7 +147,8 @@ export var SectionMap = class SectionMap {
147
147
  }
148
148
 
149
149
  // ..........................................................
150
- // --- procFunc should be (name, text) -> return processedText
150
+ // --- procFunc should be (name, block) ->
151
+ // return processed block
151
152
  getBlock(procFunc = undef, lTree = undef) {
152
153
  var j, lParts, len, part, result, text;
153
154
  debug("enter getBlock()");