@jdeighan/coffee-utils 11.0.18 → 11.0.19
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +3 -3
- package/src/utils.coffee +2 -17
- package/src/utils.js +4 -21
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@jdeighan/coffee-utils",
|
3
3
|
"type": "module",
|
4
|
-
"version": "11.0.
|
4
|
+
"version": "11.0.19",
|
5
5
|
"description": "A set of utility functions for CoffeeScript",
|
6
6
|
"main": "coffee_utils.js",
|
7
7
|
"exports": {
|
@@ -50,7 +50,7 @@
|
|
50
50
|
},
|
51
51
|
"homepage": "https://github.com/johndeighan/coffee-utils#readme",
|
52
52
|
"dependencies": {
|
53
|
-
"@jdeighan/exceptions": "^1.0.
|
53
|
+
"@jdeighan/exceptions": "^1.0.17",
|
54
54
|
"cross-env": "^7.0.3",
|
55
55
|
"js-yaml": "^4.1.0",
|
56
56
|
"n-readlines": "^1.0.1",
|
@@ -58,6 +58,6 @@
|
|
58
58
|
"svelte": "^3.52.0"
|
59
59
|
},
|
60
60
|
"devDependencies": {
|
61
|
-
"@jdeighan/unit-tester": "^2.0.
|
61
|
+
"@jdeighan/unit-tester": "^2.0.41"
|
62
62
|
}
|
63
63
|
}
|
package/src/utils.coffee
CHANGED
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
isString, isNumber, isInteger, isHash, isArray, isBoolean,
|
9
9
|
isConstructor, isFunction, isRegExp, isObject, getClassName,
|
10
10
|
jsType,
|
11
|
-
isEmpty, nonEmpty, chomp, rtrim, setCharsAt, words,
|
11
|
+
isEmpty, nonEmpty, chomp, rtrim, setCharsAt, words, getOptions,
|
12
12
|
} from '@jdeighan/exceptions/utils'
|
13
13
|
|
14
14
|
export {
|
@@ -17,7 +17,7 @@ export {
|
|
17
17
|
isString, isNumber, isInteger, isHash, isArray, isBoolean,
|
18
18
|
isConstructor, isFunction, isRegExp, isObject, getClassName,
|
19
19
|
jsType,
|
20
|
-
isEmpty, nonEmpty, chomp, rtrim, setCharsAt, words,
|
20
|
+
isEmpty, nonEmpty, chomp, rtrim, setCharsAt, words, getOptions,
|
21
21
|
}
|
22
22
|
|
23
23
|
# ---------------------------------------------------------------------------
|
@@ -368,21 +368,6 @@ export range = (n) ->
|
|
368
368
|
|
369
369
|
# ---------------------------------------------------------------------------
|
370
370
|
|
371
|
-
export getOptions = (hOptions, hDefault={}) ->
|
372
|
-
# --- If hOptions is a string, break into words and set each to true
|
373
|
-
|
374
|
-
if isString(hOptions)
|
375
|
-
h = {}
|
376
|
-
for word in words(hOptions)
|
377
|
-
h[word] = true
|
378
|
-
return h
|
379
|
-
else if isHash(hOptions)
|
380
|
-
return hOptions
|
381
|
-
else
|
382
|
-
return hDefault
|
383
|
-
|
384
|
-
# ---------------------------------------------------------------------------
|
385
|
-
|
386
371
|
export timestamp = () ->
|
387
372
|
|
388
373
|
return new Date().toLocaleTimeString("en-US")
|
package/src/utils.js
CHANGED
@@ -41,7 +41,8 @@ import {
|
|
41
41
|
chomp,
|
42
42
|
rtrim,
|
43
43
|
setCharsAt,
|
44
|
-
words
|
44
|
+
words,
|
45
|
+
getOptions
|
45
46
|
} from '@jdeighan/exceptions/utils';
|
46
47
|
|
47
48
|
export {
|
@@ -74,7 +75,8 @@ export {
|
|
74
75
|
chomp,
|
75
76
|
rtrim,
|
76
77
|
setCharsAt,
|
77
|
-
words
|
78
|
+
words,
|
79
|
+
getOptions
|
78
80
|
};
|
79
81
|
|
80
82
|
// ---------------------------------------------------------------------------
|
@@ -468,25 +470,6 @@ export var range = function(n) {
|
|
468
470
|
}).apply(this);
|
469
471
|
};
|
470
472
|
|
471
|
-
// ---------------------------------------------------------------------------
|
472
|
-
export var getOptions = function(hOptions, hDefault = {}) {
|
473
|
-
var h, i, len, ref, word;
|
474
|
-
// --- If hOptions is a string, break into words and set each to true
|
475
|
-
if (isString(hOptions)) {
|
476
|
-
h = {};
|
477
|
-
ref = words(hOptions);
|
478
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
479
|
-
word = ref[i];
|
480
|
-
h[word] = true;
|
481
|
-
}
|
482
|
-
return h;
|
483
|
-
} else if (isHash(hOptions)) {
|
484
|
-
return hOptions;
|
485
|
-
} else {
|
486
|
-
return hDefault;
|
487
|
-
}
|
488
|
-
};
|
489
|
-
|
490
473
|
// ---------------------------------------------------------------------------
|
491
474
|
export var timestamp = function() {
|
492
475
|
return new Date().toLocaleTimeString("en-US");
|