@jdeighan/coffee-utils 14.0.3 → 14.0.5

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": "14.0.3",
4
+ "version": "14.0.5",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
@@ -49,13 +49,13 @@
49
49
  },
50
50
  "homepage": "https://github.com/johndeighan/coffee-utils#readme",
51
51
  "dependencies": {
52
- "@jdeighan/base-utils": "^4.0.0",
52
+ "@jdeighan/base-utils": "^4.0.2",
53
53
  "cross-env": "^7.0.3",
54
54
  "n-readlines": "^1.0.1",
55
55
  "readline-sync": "^1.4.10",
56
56
  "svelte": "^3.55.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@jdeighan/unit-tester": "^3.0.17"
59
+ "@jdeighan/unit-tester": "^3.0.19"
60
60
  }
61
61
  }
package/src/indent.coffee CHANGED
@@ -160,36 +160,6 @@ export undented = (input, level=undef, oneIndent="\t") ->
160
160
  else
161
161
  return lNewLines
162
162
 
163
- # ---------------------------------------------------------------------------
164
- # tabify - convert leading spaces to TAB characters
165
- # if numSpaces is not defined, then the first line
166
- # that contains at least one space sets it
167
-
168
- export tabify = (str, numSpaces=undef) ->
169
-
170
- lLines = []
171
- for str in toArray(str)
172
- [_, prefix, theRest] = str.match(/^(\s*)(.*)$/)
173
- prefixLen = prefix.length
174
- if prefixLen == 0
175
- lLines.push theRest
176
- else
177
- assert (prefix.indexOf('\t') == -1), "found TAB"
178
- if numSpaces == undef
179
- numSpaces = prefixLen
180
- assert (prefixLen % numSpaces == 0), "Bad prefix"
181
- level = prefixLen / numSpaces
182
- lLines.push '\t'.repeat(level) + theRest
183
- result = toBlock(lLines)
184
- return result
185
-
186
- # ---------------------------------------------------------------------------
187
- # untabify - convert ALL TABs to spaces
188
-
189
- export untabify = (str, numSpaces=3) ->
190
-
191
- return str.replace(/\t/g, ' '.repeat(numSpaces))
192
-
193
163
  # ---------------------------------------------------------------------------
194
164
  # enclose - indent text, surround with pre and post
195
165
 
package/src/indent.js CHANGED
@@ -183,40 +183,6 @@ export var undented = function(input, level = undef, oneIndent = "\t") {
183
183
  }
184
184
  };
185
185
 
186
- // ---------------------------------------------------------------------------
187
- // tabify - convert leading spaces to TAB characters
188
- // if numSpaces is not defined, then the first line
189
- // that contains at least one space sets it
190
- export var tabify = function(str, numSpaces = undef) {
191
- var _, i, lLines, len1, level, prefix, prefixLen, ref, result, theRest;
192
- lLines = [];
193
- ref = toArray(str);
194
- for (i = 0, len1 = ref.length; i < len1; i++) {
195
- str = ref[i];
196
- [_, prefix, theRest] = str.match(/^(\s*)(.*)$/);
197
- prefixLen = prefix.length;
198
- if (prefixLen === 0) {
199
- lLines.push(theRest);
200
- } else {
201
- assert(prefix.indexOf('\t') === -1, "found TAB");
202
- if (numSpaces === undef) {
203
- numSpaces = prefixLen;
204
- }
205
- assert(prefixLen % numSpaces === 0, "Bad prefix");
206
- level = prefixLen / numSpaces;
207
- lLines.push('\t'.repeat(level) + theRest);
208
- }
209
- }
210
- result = toBlock(lLines);
211
- return result;
212
- };
213
-
214
- // ---------------------------------------------------------------------------
215
- // untabify - convert ALL TABs to spaces
216
- export var untabify = function(str, numSpaces = 3) {
217
- return str.replace(/\t/g, ' '.repeat(numSpaces));
218
- };
219
-
220
186
  // ---------------------------------------------------------------------------
221
187
  // enclose - indent text, surround with pre and post
222
188
  export var enclose = function(text, pre, post, oneIndent = "\t") {