@jdeighan/coffee-utils 11.0.1 → 11.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/package.json +14 -13
  2. package/src/DataStores.coffee +6 -15
  3. package/src/DataStores.js +8 -21
  4. package/src/Section.coffee +1 -1
  5. package/src/Section.js +1 -2
  6. package/src/SectionMap.coffee +5 -7
  7. package/src/SectionMap.js +6 -14
  8. package/src/arrow.coffee +1 -1
  9. package/src/arrow.js +1 -1
  10. package/src/{block_utils.coffee → block.coffee} +5 -5
  11. package/src/{block_utils.js → block.js} +4 -6
  12. package/src/{browser_utils.coffee → browser.coffee} +1 -1
  13. package/src/{browser_utils.js → browser.js} +1 -1
  14. package/src/{debug_utils.coffee → debug.coffee} +7 -12
  15. package/src/{debug_utils.js → debug.js} +6 -25
  16. package/src/{fs_utils.coffee → fs.coffee} +5 -40
  17. package/src/{fs_utils.js → fs.js} +9 -51
  18. package/src/fsa.coffee +1 -2
  19. package/src/fsa.js +2 -5
  20. package/src/{html_utils.coffee → html.coffee} +5 -6
  21. package/src/{html_utils.js → html.js} +5 -10
  22. package/src/{indent_utils.coffee → indent.coffee} +7 -9
  23. package/src/{indent_utils.js → indent.js} +7 -9
  24. package/src/{log_utils.coffee → log.coffee} +5 -44
  25. package/src/{log_utils.js → log.js} +6 -55
  26. package/src/placeholders.coffee +1 -1
  27. package/src/placeholders.js +1 -2
  28. package/src/{server_utils.coffee → server.coffee} +1 -1
  29. package/src/{server_utils.js → server.js} +1 -1
  30. package/src/{call_stack.coffee → stack.coffee} +2 -2
  31. package/src/{call_stack.js → stack.js} +2 -2
  32. package/src/{svelte_utils.coffee → svelte.coffee} +4 -5
  33. package/src/{svelte_utils.js → svelte.js} +6 -10
  34. package/src/taml.coffee +29 -30
  35. package/src/taml.js +39 -43
  36. package/src/{coffee_utils.coffee → utils.coffee} +14 -6
  37. package/src/{coffee_utils.js → utils.js} +25 -17
@@ -1,12 +1,12 @@
1
1
  // Generated by CoffeeScript 2.7.0
2
- // log_utils.coffee
2
+ // log.coffee
3
3
  var doDebugLog, fixForTerminal, fourSpaces, loaded, maxOneLine, putBlock, putstr;
4
4
 
5
5
  import {
6
+ LOG,
6
7
  assert,
7
- error,
8
8
  croak
9
- } from '@jdeighan/unit-tester/utils';
9
+ } from '@jdeighan/exceptions';
10
10
 
11
11
  import {
12
12
  undef,
@@ -23,16 +23,9 @@ import {
23
23
  } from '@jdeighan/coffee-utils';
24
24
 
25
25
  import {
26
- blockToArray
26
+ toArray
27
27
  } from '@jdeighan/coffee-utils/block';
28
28
 
29
- import {
30
- tabify,
31
- untabify,
32
- indentation,
33
- indented
34
- } from '@jdeighan/coffee-utils/indent';
35
-
36
29
  import {
37
30
  toTAML
38
31
  } from '@jdeighan/coffee-utils/taml';
@@ -54,48 +47,6 @@ export var debugLog = function(flag = true) {
54
47
  }
55
48
  };
56
49
 
57
- // ---------------------------------------------------------------------------
58
- // This is useful for debugging
59
- export var LOG = function(...lArgs) {
60
- var item, label;
61
- [label, item] = lArgs;
62
- if (lArgs.length > 1) {
63
- // --- There's both a label and an item
64
- if (item === undef) {
65
- console.log(`${label} = undef`);
66
- } else if (item === null) {
67
- console.log(`${label} = null`);
68
- } else {
69
- console.log(sep_dash);
70
- console.log(`${label}:`);
71
- if (isString(item)) {
72
- console.log(untabify(item));
73
- } else {
74
- console.log(untabify(orderedStringify(item)));
75
- }
76
- console.log(sep_dash);
77
- }
78
- } else {
79
- console.log(label);
80
- }
81
- return true; // to allow use in boolean expressions
82
- };
83
-
84
-
85
- // --- Use this instead to make it easier to remove all instances
86
- export var DEBUG = LOG; // synonym
87
-
88
-
89
- // ---------------------------------------------------------------------------
90
- export var LOGLINES = function(label, lLines) {
91
- var i, len, line;
92
- LOG(`${label}:`);
93
- for (i = 0, len = lLines.length; i < len; i++) {
94
- line = lLines[i];
95
- LOG(`${OL(line)}`);
96
- }
97
- };
98
-
99
50
  // ---------------------------------------------------------------------------
100
51
  export var setStringifier = function(func) {
101
52
  var orgStringifier;
@@ -210,7 +161,7 @@ export var logItem = function(label, item, pre = '', itemPre = undef) {
210
161
  if (label) {
211
162
  putstr(`${pre}${label}:`);
212
163
  }
213
- ref = blockToArray(stringify(item, true));
164
+ ref = toArray(stringify(item, true));
214
165
  // --- escape special chars
215
166
  for (i = 0, len = ref.length; i < len; i++) {
216
167
  str = ref[i];
@@ -239,7 +190,7 @@ fixForTerminal = function(str) {
239
190
  putBlock = function(item, prefix = '') {
240
191
  var i, len, line, ref;
241
192
  putstr(`${prefix}${sep_eq}`);
242
- ref = blockToArray(item);
193
+ ref = toArray(item);
243
194
  for (i = 0, len = ref.length; i < len; i++) {
244
195
  line = ref[i];
245
196
  putstr(`${prefix}${escapeStr(line)}`);
@@ -1,6 +1,6 @@
1
1
  # placeholders.coffee
2
2
 
3
- import {assert, error, croak} from '@jdeighan/unit-tester/utils'
3
+ import {assert, croak} from '@jdeighan/exceptions'
4
4
  import {undef, defined} from '@jdeighan/coffee-utils'
5
5
 
6
6
  hDefOptions = {
@@ -4,9 +4,8 @@ var hDefOptions;
4
4
 
5
5
  import {
6
6
  assert,
7
- error,
8
7
  croak
9
- } from '@jdeighan/unit-tester/utils';
8
+ } from '@jdeighan/exceptions';
10
9
 
11
10
  import {
12
11
  undef,
@@ -1,4 +1,4 @@
1
- # server_utils.coffee
1
+ # server.coffee
2
2
 
3
3
  import getline from 'readline-sync'
4
4
  import {execSync} from 'child_process'
@@ -1,5 +1,5 @@
1
1
  // Generated by CoffeeScript 2.7.0
2
- // server_utils.coffee
2
+ // server.coffee
3
3
  import getline from 'readline-sync';
4
4
 
5
5
  import {
@@ -1,6 +1,6 @@
1
- # call_stack.coffee
1
+ # stack.coffee
2
2
 
3
- import {assert, croak} from '@jdeighan/unit-tester/utils'
3
+ import {assert, croak} from '@jdeighan/exceptions'
4
4
  import {
5
5
  undef, defined, OL, escapeStr, deepCopy,
6
6
  isArray, isBoolean,
@@ -1,11 +1,11 @@
1
1
  // Generated by CoffeeScript 2.7.0
2
- // call_stack.coffee
2
+ // stack.coffee
3
3
  var doDebugStack;
4
4
 
5
5
  import {
6
6
  assert,
7
7
  croak
8
- } from '@jdeighan/unit-tester/utils';
8
+ } from '@jdeighan/exceptions';
9
9
 
10
10
  import {
11
11
  undef,
@@ -1,8 +1,7 @@
1
- # svelte_utils.coffee
1
+ # svelte.coffee
2
2
 
3
- import {assert, error, croak} from '@jdeighan/unit-tester/utils'
3
+ import {assert, croak, LOG} from '@jdeighan/exceptions'
4
4
  import {isFunction} from '@jdeighan/coffee-utils'
5
- import {log} from '@jdeighan/coffee-utils/log'
6
5
 
7
6
  # ---------------------------------------------------------------------------
8
7
  # svelteSourceCodeEsc - to display source code for a *.starbucks page
@@ -33,10 +32,10 @@ export onInterval = (func, secs, doLog=false) ->
33
32
  assert isFunction(func), "onInterval(): 1st arg not a function"
34
33
  ms = Math.floor(1000 * secs)
35
34
  if doLog
36
- log "calling func every #{ms} ms."
35
+ LOG "calling func every #{ms} ms."
37
36
  interval = setInterval(func, ms)
38
37
 
39
38
  return () ->
40
39
  if doLog
41
- log "destroying interval timer"
40
+ LOG "destroying interval timer"
42
41
  clearInterval interval
@@ -1,19 +1,15 @@
1
1
  // Generated by CoffeeScript 2.7.0
2
- // svelte_utils.coffee
2
+ // svelte.coffee
3
3
  import {
4
4
  assert,
5
- error,
6
- croak
7
- } from '@jdeighan/unit-tester/utils';
5
+ croak,
6
+ LOG
7
+ } from '@jdeighan/exceptions';
8
8
 
9
9
  import {
10
10
  isFunction
11
11
  } from '@jdeighan/coffee-utils';
12
12
 
13
- import {
14
- log
15
- } from '@jdeighan/coffee-utils/log';
16
-
17
13
  // ---------------------------------------------------------------------------
18
14
  // svelteSourceCodeEsc - to display source code for a *.starbucks page
19
15
  export var svelteSourceCodeEsc = function(str) {
@@ -32,12 +28,12 @@ export var onInterval = function(func, secs, doLog = false) {
32
28
  assert(isFunction(func), "onInterval(): 1st arg not a function");
33
29
  ms = Math.floor(1000 * secs);
34
30
  if (doLog) {
35
- log(`calling func every ${ms} ms.`);
31
+ LOG(`calling func every ${ms} ms.`);
36
32
  }
37
33
  interval = setInterval(func, ms);
38
34
  return function() {
39
35
  if (doLog) {
40
- log("destroying interval timer");
36
+ LOG("destroying interval timer");
41
37
  }
42
38
  return clearInterval(interval);
43
39
  };
package/src/taml.coffee CHANGED
@@ -2,16 +2,16 @@
2
2
 
3
3
  import yaml from 'js-yaml'
4
4
 
5
- import {assert, error, croak} from '@jdeighan/unit-tester/utils'
5
+ import {assert, croak} from '@jdeighan/exceptions'
6
6
  import {
7
- undef, oneline, isString, chomp, escapeStr,
7
+ undef, defined, notdefined, OL, chomp, escapeStr,
8
+ isString, isObject, isEmpty,
8
9
  } from '@jdeighan/coffee-utils'
9
- import {untabify, tabify, splitLine} from '@jdeighan/coffee-utils/indent'
10
- import {slurp} from '@jdeighan/coffee-utils/fs'
11
- import {debug} from '@jdeighan/coffee-utils/debug'
10
+ import {splitLine} from '@jdeighan/coffee-utils/indent'
12
11
  import {
13
- firstLine, blockToArray, arrayToBlock,
12
+ firstLine, toArray, toBlock,
14
13
  } from '@jdeighan/coffee-utils/block'
14
+ import {slurp} from '@jdeighan/coffee-utils/fs'
15
15
 
16
16
  # ---------------------------------------------------------------------------
17
17
  # isTAML - is the string valid TAML?
@@ -20,24 +20,16 @@ export isTAML = (text) ->
20
20
 
21
21
  return isString(text) && (firstLine(text).indexOf('---') == 0)
22
22
 
23
- # ---------------------------------------------------------------------------
24
-
25
- squote = (text) ->
26
-
27
- return "'" + text.replace(/'/g, "''") + "'"
28
-
29
23
  # ---------------------------------------------------------------------------
30
24
  # taml - convert valid TAML string to a JavaScript value
31
25
 
32
- export taml = (text) ->
26
+ export fromTAML = (text) ->
33
27
 
34
- debug "enter taml(#{oneline(text)})"
35
- if ! text?
36
- debug "return undef from taml() - text is not defined"
28
+ if notdefined(text)
37
29
  return undef
38
- assert isTAML(text), "taml(): string #{oneline(text)} isn't TAML"
30
+ assert isTAML(text), "string #{OL(text)} isn't TAML"
39
31
 
40
- lLines = for line in blockToArray(text)
32
+ lLines = for line in toArray(text)
41
33
  [level, str] = splitLine(line)
42
34
  prefix = ' '.repeat(level)
43
35
  if lMatches = line.match(///^
@@ -55,41 +47,48 @@ export taml = (text) ->
55
47
  else
56
48
  prefix + str
57
49
 
58
- debug "return from taml()"
59
- return yaml.load(arrayToBlock(lLines), {skipInvalid: true})
50
+ return yaml.load(toBlock(lLines), {skipInvalid: true})
60
51
 
61
52
  # ---------------------------------------------------------------------------
53
+ # --- a replacer is (key, value) -> newvalue
62
54
 
63
- export fromTAML = taml
55
+ myReplacer = (name, value) ->
64
56
 
65
- # ---------------------------------------------------------------------------
66
-
67
- escReplacer = (name, value) ->
68
-
69
- if ! isString(value)
57
+ if isString(value)
58
+ return escapeStr(value)
59
+ else if isObject(value, ['tamlReplacer'])
60
+ return value.tamlReplacer()
61
+ else
70
62
  return value
71
- return escapeStr(value)
72
63
 
73
64
  # ---------------------------------------------------------------------------
74
65
 
75
66
  export toTAML = (obj, hOptions={}) ->
76
67
 
77
- {useTabs, sortKeys, escape} = hOptions
68
+ {useTabs, sortKeys, escape, replacer} = hOptions
69
+ if notdefined(replacer)
70
+ replacer = myReplacer
78
71
  str = yaml.dump(obj, {
79
72
  skipInvalid: true
80
73
  indent: 3
81
74
  sortKeys: !!sortKeys
82
75
  lineWidth: -1
83
- replacer: if !!escape then escReplacer else (name,value) -> value
76
+ replacer
84
77
  })
85
78
  if useTabs
86
79
  str = str.replace(/ /g, "\t")
87
80
  return "---\n" + chomp(str)
88
81
 
82
+ # ---------------------------------------------------------------------------
83
+
84
+ squote = (text) ->
85
+
86
+ return "'" + text.replace(/'/g, "''") + "'"
87
+
89
88
  # ---------------------------------------------------------------------------
90
89
  # slurpTAML - read TAML from a file
91
90
 
92
91
  export slurpTAML = (filepath) ->
93
92
 
94
93
  contents = slurp(filepath)
95
- return taml(contents)
94
+ return fromTAML(contents)
package/src/taml.js CHANGED
@@ -1,67 +1,57 @@
1
1
  // Generated by CoffeeScript 2.7.0
2
2
  // taml.coffee
3
- var escReplacer, squote;
3
+ var myReplacer, squote;
4
4
 
5
5
  import yaml from 'js-yaml';
6
6
 
7
7
  import {
8
8
  assert,
9
- error,
10
9
  croak
11
- } from '@jdeighan/unit-tester/utils';
10
+ } from '@jdeighan/exceptions';
12
11
 
13
12
  import {
14
13
  undef,
15
- oneline,
16
- isString,
14
+ defined,
15
+ notdefined,
16
+ OL,
17
17
  chomp,
18
- escapeStr
18
+ escapeStr,
19
+ isString,
20
+ isObject,
21
+ isEmpty
19
22
  } from '@jdeighan/coffee-utils';
20
23
 
21
24
  import {
22
- untabify,
23
- tabify,
24
25
  splitLine
25
26
  } from '@jdeighan/coffee-utils/indent';
26
27
 
27
- import {
28
- slurp
29
- } from '@jdeighan/coffee-utils/fs';
30
-
31
- import {
32
- debug
33
- } from '@jdeighan/coffee-utils/debug';
34
-
35
28
  import {
36
29
  firstLine,
37
- blockToArray,
38
- arrayToBlock
30
+ toArray,
31
+ toBlock
39
32
  } from '@jdeighan/coffee-utils/block';
40
33
 
34
+ import {
35
+ slurp
36
+ } from '@jdeighan/coffee-utils/fs';
37
+
41
38
  // ---------------------------------------------------------------------------
42
39
  // isTAML - is the string valid TAML?
43
40
  export var isTAML = function(text) {
44
41
  return isString(text) && (firstLine(text).indexOf('---') === 0);
45
42
  };
46
43
 
47
- // ---------------------------------------------------------------------------
48
- squote = function(text) {
49
- return "'" + text.replace(/'/g, "''") + "'";
50
- };
51
-
52
44
  // ---------------------------------------------------------------------------
53
45
  // taml - convert valid TAML string to a JavaScript value
54
- export var taml = function(text) {
46
+ export var fromTAML = function(text) {
55
47
  var _, key, lLines, lMatches, level, line, prefix, str;
56
- debug(`enter taml(${oneline(text)})`);
57
- if (text == null) {
58
- debug("return undef from taml() - text is not defined");
48
+ if (notdefined(text)) {
59
49
  return undef;
60
50
  }
61
- assert(isTAML(text), `taml(): string ${oneline(text)} isn't TAML`);
51
+ assert(isTAML(text), `string ${OL(text)} isn't TAML`);
62
52
  lLines = (function() {
63
53
  var i, len, ref, results;
64
- ref = blockToArray(text);
54
+ ref = toArray(text);
65
55
  results = [];
66
56
  for (i = 0, len = ref.length; i < len; i++) {
67
57
  line = ref[i];
@@ -80,35 +70,36 @@ export var taml = function(text) {
80
70
  }
81
71
  return results;
82
72
  })();
83
- debug("return from taml()");
84
- return yaml.load(arrayToBlock(lLines), {
73
+ return yaml.load(toBlock(lLines), {
85
74
  skipInvalid: true
86
75
  });
87
76
  };
88
77
 
89
78
  // ---------------------------------------------------------------------------
90
- export var fromTAML = taml;
91
-
92
- // ---------------------------------------------------------------------------
93
- escReplacer = function(name, value) {
94
- if (!isString(value)) {
79
+ // --- a replacer is (key, value) -> newvalue
80
+ myReplacer = function(name, value) {
81
+ if (isString(value)) {
82
+ return escapeStr(value);
83
+ } else if (isObject(value, ['tamlReplacer'])) {
84
+ return value.tamlReplacer();
85
+ } else {
95
86
  return value;
96
87
  }
97
- return escapeStr(value);
98
88
  };
99
89
 
100
90
  // ---------------------------------------------------------------------------
101
91
  export var toTAML = function(obj, hOptions = {}) {
102
- var escape, sortKeys, str, useTabs;
103
- ({useTabs, sortKeys, escape} = hOptions);
92
+ var escape, replacer, sortKeys, str, useTabs;
93
+ ({useTabs, sortKeys, escape, replacer} = hOptions);
94
+ if (notdefined(replacer)) {
95
+ replacer = myReplacer;
96
+ }
104
97
  str = yaml.dump(obj, {
105
98
  skipInvalid: true,
106
99
  indent: 3,
107
100
  sortKeys: !!sortKeys,
108
101
  lineWidth: -1,
109
- replacer: !!escape ? escReplacer : function(name, value) {
110
- return value;
111
- }
102
+ replacer
112
103
  });
113
104
  if (useTabs) {
114
105
  str = str.replace(/ /g, "\t");
@@ -116,10 +107,15 @@ export var toTAML = function(obj, hOptions = {}) {
116
107
  return "---\n" + chomp(str);
117
108
  };
118
109
 
110
+ // ---------------------------------------------------------------------------
111
+ squote = function(text) {
112
+ return "'" + text.replace(/'/g, "''") + "'";
113
+ };
114
+
119
115
  // ---------------------------------------------------------------------------
120
116
  // slurpTAML - read TAML from a file
121
117
  export var slurpTAML = function(filepath) {
122
118
  var contents;
123
119
  contents = slurp(filepath);
124
- return taml(contents);
120
+ return fromTAML(contents);
125
121
  };
@@ -1,11 +1,10 @@
1
- # coffee_utils.coffee
1
+ # utils.coffee
2
2
 
3
- import {assert, error, croak} from '@jdeighan/unit-tester/utils'
3
+ import {LOG, assert, croak} from '@jdeighan/exceptions'
4
4
 
5
5
  export sep_dash = '-'.repeat(42)
6
6
  export sep_eq = '='.repeat(42)
7
7
  `export const undef = undefined`
8
- LOG = (lArgs...) -> console.log lArgs... # synonym for console.log()
9
8
 
10
9
  # ---------------------------------------------------------------------------
11
10
  # TEMP!!!!!
@@ -162,13 +161,22 @@ export isBoolean = (x) ->
162
161
 
163
162
  # ---------------------------------------------------------------------------
164
163
 
165
- export isObject = (x) ->
164
+ export isObject = (x, lReqKeys=undef) ->
166
165
 
167
- return (typeof x == 'object') \
166
+ result = (typeof x == 'object') \
168
167
  && ! isString(x) \
169
168
  && ! isArray(x) \
170
169
  && ! isHash(x) \
171
170
  && ! isNumber(x)
171
+ if result
172
+ if defined(lReqKeys)
173
+ assert isArray(lReqKeys), "lReqKeys is not an array"
174
+ for key in lReqKeys
175
+ if ! x.hasOwnProperty(key)
176
+ return false
177
+ return true
178
+ else
179
+ return false
172
180
 
173
181
  # ---------------------------------------------------------------------------
174
182
 
@@ -249,7 +257,7 @@ export nonEmpty = (x) ->
249
257
  if isHash(x)
250
258
  return Object.keys(x).length > 0
251
259
  else
252
- error "isEmpty(): Invalid parameter"
260
+ croak "isEmpty(): Invalid parameter"
253
261
 
254
262
  # ---------------------------------------------------------------------------
255
263
 
@@ -1,12 +1,10 @@
1
1
  // Generated by CoffeeScript 2.7.0
2
- // coffee_utils.coffee
3
- var LOG;
4
-
2
+ // utils.coffee
5
3
  import {
4
+ LOG,
6
5
  assert,
7
- error,
8
6
  croak
9
- } from '@jdeighan/unit-tester/utils';
7
+ } from '@jdeighan/exceptions';
10
8
 
11
9
  export var sep_dash = '-'.repeat(42);
12
10
 
@@ -14,11 +12,6 @@ export var sep_eq = '='.repeat(42);
14
12
 
15
13
  export const undef = undefined;
16
14
 
17
- LOG = function(...lArgs) {
18
- return console.log(...lArgs); // synonym for console.log()
19
- };
20
-
21
-
22
15
  // ---------------------------------------------------------------------------
23
16
  // TEMP!!!!!
24
17
  export var isComment = function(line) {
@@ -103,8 +96,8 @@ export var isConstructor = function(f) {
103
96
  var err;
104
97
  try {
105
98
  new f();
106
- } catch (error1) {
107
- err = error1;
99
+ } catch (error) {
100
+ err = error;
108
101
  if (err.message.indexOf('is not a constructor') >= 0) {
109
102
  return false;
110
103
  }
@@ -177,8 +170,23 @@ export var isBoolean = function(x) {
177
170
  };
178
171
 
179
172
  // ---------------------------------------------------------------------------
180
- export var isObject = function(x) {
181
- return (typeof x === 'object') && !isString(x) && !isArray(x) && !isHash(x) && !isNumber(x);
173
+ export var isObject = function(x, lReqKeys = undef) {
174
+ var i, key, len1, result;
175
+ result = (typeof x === 'object') && !isString(x) && !isArray(x) && !isHash(x) && !isNumber(x);
176
+ if (result) {
177
+ if (defined(lReqKeys)) {
178
+ assert(isArray(lReqKeys), "lReqKeys is not an array");
179
+ for (i = 0, len1 = lReqKeys.length; i < len1; i++) {
180
+ key = lReqKeys[i];
181
+ if (!x.hasOwnProperty(key)) {
182
+ return false;
183
+ }
184
+ }
185
+ }
186
+ return true;
187
+ } else {
188
+ return false;
189
+ }
182
190
  };
183
191
 
184
192
  // ---------------------------------------------------------------------------
@@ -265,7 +273,7 @@ export var nonEmpty = function(x) {
265
273
  if (isHash(x)) {
266
274
  return Object.keys(x).length > 0;
267
275
  } else {
268
- return error("isEmpty(): Invalid parameter");
276
+ return croak("isEmpty(): Invalid parameter");
269
277
  }
270
278
  };
271
279
 
@@ -501,8 +509,8 @@ export var deepCopy = function(obj) {
501
509
  objStr = JSON.stringify(obj);
502
510
  try {
503
511
  newObj = JSON.parse(objStr);
504
- } catch (error1) {
505
- err = error1;
512
+ } catch (error) {
513
+ err = error;
506
514
  croak("ERROR: err.message", objStr);
507
515
  }
508
516
  return newObj;