@goast/core 0.2.2 → 0.3.0

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.
Files changed (47) hide show
  1. package/README.md +65 -11
  2. package/cjs/lib/codegen/config.js +5 -1
  3. package/cjs/lib/codegen/generator.js +28 -35
  4. package/cjs/lib/codegen/internal-utils.js +1 -2
  5. package/cjs/lib/collect/collector.js +1 -2
  6. package/cjs/lib/collect/helpers.js +2 -3
  7. package/cjs/lib/internal-utils.js +1 -2
  8. package/cjs/lib/parse/deref-proxy.js +1 -2
  9. package/cjs/lib/parse/parser.js +114 -126
  10. package/cjs/lib/transform/helpers.js +10 -10
  11. package/cjs/lib/transform/transform-document.js +5 -3
  12. package/cjs/lib/transform/transform-endpoint.js +35 -10
  13. package/cjs/lib/transform/transform-schema.js +5 -3
  14. package/cjs/lib/transform/transformer.js +1 -2
  15. package/cjs/lib/utils/array.utils.js +1 -2
  16. package/cjs/lib/utils/class.utils.js +3 -4
  17. package/cjs/lib/utils/common.utils.js +12 -13
  18. package/cjs/lib/utils/condition.js +1 -2
  19. package/cjs/lib/utils/endpoint.utils.js +1 -2
  20. package/cjs/lib/utils/error.utils.js +1 -2
  21. package/cjs/lib/utils/file-system.utils.js +21 -26
  22. package/cjs/lib/utils/generator.utils.js +1 -2
  23. package/cjs/lib/utils/object.utils.js +1 -2
  24. package/cjs/lib/utils/schema.utils.js +12 -4
  25. package/cjs/lib/utils/source-builder.js +5 -3
  26. package/cjs/lib/utils/string-builder/options.js +3 -0
  27. package/cjs/lib/utils/string-builder/string-builder.js +1 -1
  28. package/cjs/lib/utils/string-builder/utils.js +5 -6
  29. package/cjs/lib/utils/string.utils.js +27 -28
  30. package/cjs/lib/utils/type.utils.js +2 -3
  31. package/esm/lib/codegen/config.js +5 -1
  32. package/esm/lib/codegen/generator.js +28 -35
  33. package/esm/lib/parse/parser.js +114 -127
  34. package/esm/lib/transform/transform-document.js +4 -1
  35. package/esm/lib/transform/transform-endpoint.js +34 -8
  36. package/esm/lib/transform/transform-schema.js +4 -1
  37. package/esm/lib/utils/file-system.utils.js +19 -24
  38. package/esm/lib/utils/schema.utils.js +10 -1
  39. package/esm/lib/utils/source-builder.js +6 -4
  40. package/esm/lib/utils/string-builder/options.js +3 -0
  41. package/esm/lib/utils/string-builder/string-builder.js +1 -1
  42. package/esm/lib/utils/string.utils.js +7 -7
  43. package/package.json +6 -5
  44. package/types/lib/codegen/config.d.ts +8 -0
  45. package/types/lib/utils/source-builder.d.ts +11 -1
  46. package/types/lib/utils/string-builder/options.d.ts +8 -2
  47. package/types/lib/utils/string.utils.types.d.ts +1 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformEndpoint = void 0;
3
+ exports.transformEndpoint = transformEndpoint;
4
4
  const helpers_1 = require("./helpers");
5
5
  const transform_schema_1 = require("./transform-schema");
6
6
  const internal_utils_1 = require("../internal-utils");
@@ -8,7 +8,10 @@ function transformEndpoint(context, endpointInfo) {
8
8
  var _a, _b, _c, _d;
9
9
  const apiPath = transformApiPath(context, endpointInfo.path, endpointInfo.pathItem);
10
10
  const endpoint = {
11
- $src: Object.assign(Object.assign({}, endpointInfo.operation.$src), { component: endpointInfo.operation }),
11
+ $src: {
12
+ ...endpointInfo.operation.$src,
13
+ component: endpointInfo.operation,
14
+ },
12
15
  $ref: undefined,
13
16
  id: context.idGenerator.generateId('endpoint'),
14
17
  name: (0, helpers_1.determineEndpointName)(endpointInfo),
@@ -46,7 +49,6 @@ function transformEndpoint(context, endpointInfo) {
46
49
  context.endpoints.set(`${endpointInfo.method}:${endpointInfo.path}`, endpoint);
47
50
  return endpoint;
48
51
  }
49
- exports.transformEndpoint = transformEndpoint;
50
52
  function transformApiPath(context, path, pathItem, isReference = false) {
51
53
  var _a, _b;
52
54
  const existingPath = context.paths.get(path);
@@ -58,7 +60,10 @@ function transformApiPath(context, path, pathItem, isReference = false) {
58
60
  return existing;
59
61
  const ref = pathItem.$ref ? transformApiPath(context, path, pathItem.$ref, true) : undefined;
60
62
  const apiPath = {
61
- $src: Object.assign(Object.assign({}, pathItem.$src), { component: pathItem }),
63
+ $src: {
64
+ ...pathItem.$src,
65
+ component: pathItem,
66
+ },
62
67
  $ref: ref,
63
68
  id: context.idGenerator.generateId('path'),
64
69
  summary: pathItem.summary,
@@ -89,7 +94,10 @@ function transformParameter(context, parameter) {
89
94
  const ref = parameter.$ref ? transformParameter(context, parameter.$ref) : undefined;
90
95
  const id = context.idGenerator.generateId('parameter');
91
96
  const p = {
92
- $src: Object.assign(Object.assign({}, parameter.$src), { component: parameter }),
97
+ $src: {
98
+ ...parameter.$src,
99
+ component: parameter,
100
+ },
93
101
  $ref: ref,
94
102
  id: id,
95
103
  name: (_a = parameter.name) !== null && _a !== void 0 ? _a : id,
@@ -114,7 +122,10 @@ function transformRequestBody(context, requestBody) {
114
122
  return existing;
115
123
  const ref = requestBody.$ref ? transformRequestBody(context, requestBody.$ref) : undefined;
116
124
  const rb = {
117
- $src: Object.assign(Object.assign({}, requestBody.$src), { component: requestBody }),
125
+ $src: {
126
+ ...requestBody.$src,
127
+ component: requestBody,
128
+ },
118
129
  $ref: ref,
119
130
  id: context.idGenerator.generateId('requestBody'),
120
131
  description: requestBody.description,
@@ -142,7 +153,10 @@ function transformResponse(context, response, status) {
142
153
  return existing;
143
154
  const ref = response.$ref ? transformResponse(context, response.$ref, status) : undefined;
144
155
  const r = {
145
- $src: Object.assign(Object.assign({}, response.$src), { component: response }),
156
+ $src: {
157
+ ...response.$src,
158
+ component: response,
159
+ },
146
160
  $ref: ref,
147
161
  id: context.idGenerator.generateId('response'),
148
162
  statusCode: Number(status) || undefined,
@@ -171,7 +185,10 @@ function transformMediaType(context, mediaType, media) {
171
185
  return existing;
172
186
  const ref = mediaType.$ref ? transformMediaType(context, mediaType.$ref, media) : undefined;
173
187
  const mt = {
174
- $src: Object.assign(Object.assign({}, mediaType.$src), { component: mediaType }),
188
+ $src: {
189
+ ...mediaType.$src,
190
+ component: mediaType,
191
+ },
175
192
  $ref: ref,
176
193
  id: context.idGenerator.generateId('content'),
177
194
  type: media,
@@ -218,7 +235,11 @@ function transformHeader(context, header, name) {
218
235
  const id = context.idGenerator.generateId('header');
219
236
  if (isSchema(header)) {
220
237
  h = {
221
- $src: Object.assign(Object.assign({}, header.$src), { component: header }),
238
+ $src: {
239
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
240
+ ...header.$src,
241
+ component: header,
242
+ },
222
243
  $ref: ref,
223
244
  id,
224
245
  name,
@@ -234,7 +255,11 @@ function transformHeader(context, header, name) {
234
255
  }
235
256
  else {
236
257
  h = {
237
- $src: Object.assign(Object.assign({}, header.$src), { component: header }),
258
+ $src: {
259
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
260
+ ...header.$src,
261
+ component: header,
262
+ },
238
263
  $ref: ref,
239
264
  id,
240
265
  name,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformSchema = void 0;
3
+ exports.transformSchema = transformSchema;
4
4
  const helpers_1 = require("./helpers");
5
5
  const utils_1 = require("../utils");
6
6
  function transformSchema(context, schema) {
@@ -39,7 +39,10 @@ function transformSchema(context, schema) {
39
39
  const id = context.idGenerator.generateId('schema');
40
40
  const nameInfo = (0, helpers_1.determineSchemaName)(schema, id);
41
41
  const incompleteSchema = {
42
- $src: Object.assign(Object.assign({}, schema.$src), { component: schema }),
42
+ $src: {
43
+ ...schema.$src,
44
+ component: schema,
45
+ },
43
46
  $ref: undefined,
44
47
  id,
45
48
  name: nameInfo.name,
@@ -76,7 +79,6 @@ function transformSchema(context, schema) {
76
79
  context.schemas.set(schemaSource, completeSchema);
77
80
  return completeSchema;
78
81
  }
79
- exports.transformSchema = transformSchema;
80
82
  const schemaTransformers = {
81
83
  oneOf: (schema, context) => {
82
84
  var _a, _b;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformOpenApi = void 0;
3
+ exports.transformOpenApi = transformOpenApi;
4
4
  const helpers_1 = require("./helpers");
5
5
  const transform_document_1 = require("./transform-document");
6
6
  const transform_endpoint_1 = require("./transform-endpoint");
@@ -40,4 +40,3 @@ function transformOpenApi(data) {
40
40
  schemas: Array.from(context.schemas.values()),
41
41
  };
42
42
  }
43
- exports.transformOpenApi = transformOpenApi;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.removeItems = void 0;
3
+ exports.removeItems = removeItems;
4
4
  function removeItems(array, predicate) {
5
5
  for (let i = array.length - 1; i >= 0; i--) {
6
6
  if (predicate(array[i])) {
@@ -8,4 +8,3 @@ function removeItems(array, predicate) {
8
8
  }
9
9
  }
10
10
  }
11
- exports.removeItems = removeItems;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getIsInstanceOf = exports.isInstanceOf = exports.classifyArray = void 0;
3
+ exports.classifyArray = classifyArray;
4
+ exports.isInstanceOf = isInstanceOf;
5
+ exports.getIsInstanceOf = getIsInstanceOf;
4
6
  function classifyArray(items, classification) {
5
7
  const result = { rest: [] };
6
8
  for (const key in classification) {
@@ -22,12 +24,9 @@ function classifyArray(items, classification) {
22
24
  }
23
25
  return result;
24
26
  }
25
- exports.classifyArray = classifyArray;
26
27
  function isInstanceOf(item, type) {
27
28
  return item instanceof type;
28
29
  }
29
- exports.isInstanceOf = isInstanceOf;
30
30
  function getIsInstanceOf(type) {
31
31
  return (item) => item instanceof type;
32
32
  }
33
- exports.getIsInstanceOf = getIsInstanceOf;
@@ -1,14 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.asVoid = exports.transformEach = exports.runEach = exports.modifyEach = exports.transform = exports.run = exports.modify = exports.toArray = exports.isIterable = exports.concatSingleOrMultiple = exports.notNullish = exports.isNullish = void 0;
3
+ exports.isNullish = isNullish;
4
+ exports.notNullish = notNullish;
5
+ exports.concatSingleOrMultiple = concatSingleOrMultiple;
6
+ exports.isIterable = isIterable;
7
+ exports.toArray = toArray;
8
+ exports.modify = modify;
9
+ exports.run = run;
10
+ exports.transform = transform;
11
+ exports.modifyEach = modifyEach;
12
+ exports.runEach = runEach;
13
+ exports.transformEach = transformEach;
14
+ exports.asVoid = asVoid;
4
15
  function isNullish(value) {
5
16
  return value === null || value === undefined;
6
17
  }
7
- exports.isNullish = isNullish;
8
18
  function notNullish(value) {
9
19
  return !isNullish(value);
10
20
  }
11
- exports.notNullish = notNullish;
12
21
  function concatSingleOrMultiple(...values) {
13
22
  if (values.length === 1) {
14
23
  return values[0];
@@ -24,11 +33,9 @@ function concatSingleOrMultiple(...values) {
24
33
  }
25
34
  return result;
26
35
  }
27
- exports.concatSingleOrMultiple = concatSingleOrMultiple;
28
36
  function isIterable(value) {
29
37
  return typeof value === 'object' && value !== null && Symbol.iterator in value;
30
38
  }
31
- exports.isIterable = isIterable;
32
39
  function toArray(value) {
33
40
  if (Array.isArray(value)) {
34
41
  return value;
@@ -38,23 +45,19 @@ function toArray(value) {
38
45
  }
39
46
  return [value];
40
47
  }
41
- exports.toArray = toArray;
42
48
  function modify(value, callback) {
43
49
  if (notNullish(value)) {
44
50
  callback(value);
45
51
  }
46
52
  return value;
47
53
  }
48
- exports.modify = modify;
49
54
  function run(value, callback) {
50
55
  callback(value);
51
56
  return value;
52
57
  }
53
- exports.run = run;
54
58
  function transform(value, callback) {
55
59
  return callback(value);
56
60
  }
57
- exports.transform = transform;
58
61
  function modifyEach(values, callback) {
59
62
  for (const value of values) {
60
63
  if (notNullish(value)) {
@@ -63,14 +66,12 @@ function modifyEach(values, callback) {
63
66
  }
64
67
  return values;
65
68
  }
66
- exports.modifyEach = modifyEach;
67
69
  function runEach(values, callback) {
68
70
  for (const value of values) {
69
71
  callback(value);
70
72
  }
71
73
  return values;
72
74
  }
73
- exports.runEach = runEach;
74
75
  function transformEach(values, callback) {
75
76
  const result = [];
76
77
  for (const value of values) {
@@ -78,8 +79,6 @@ function transformEach(values, callback) {
78
79
  }
79
80
  return result;
80
81
  }
81
- exports.transformEach = transformEach;
82
82
  function asVoid(_) {
83
83
  // Do nothing
84
84
  }
85
- exports.asVoid = asVoid;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.evalCondition = void 0;
3
+ exports.evalCondition = evalCondition;
4
4
  function evalCondition(condition, ctx) {
5
5
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
6
6
  return typeof condition === 'function' ? condition(ctx) : condition;
7
7
  }
8
- exports.evalCondition = evalCondition;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEndpointUrlPreview = void 0;
3
+ exports.getEndpointUrlPreview = getEndpointUrlPreview;
4
4
  function getEndpointUrlPreview(endpoint) {
5
5
  let url = endpoint.path;
6
6
  const queryParams = endpoint.parameters.filter((p) => p.target === 'query');
@@ -9,4 +9,3 @@ function getEndpointUrlPreview(endpoint) {
9
9
  }
10
10
  return url;
11
11
  }
12
- exports.getEndpointUrlPreview = getEndpointUrlPreview;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.throwExp = void 0;
3
+ exports.throwExp = throwExp;
4
4
  function throwExp(message) {
5
5
  throw new Error(message);
6
6
  }
7
- exports.throwExp = throwExp;
@@ -1,40 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFiles = exports.defaultDirectoryScanOptions = void 0;
4
- const tslib_1 = require("tslib");
3
+ exports.defaultDirectoryScanOptions = void 0;
4
+ exports.getFiles = getFiles;
5
5
  const path_1 = require("path");
6
6
  const fs_extra_1 = require("fs-extra");
7
7
  exports.defaultDirectoryScanOptions = {
8
8
  recursive: false,
9
9
  maxDepth: 5,
10
10
  };
11
- function getFiles(dir, options) {
12
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
13
- const opts = Object.assign(Object.assign({}, exports.defaultDirectoryScanOptions), options);
14
- const files = [];
15
- yield getFilesImpl(dir, opts, files, 0);
16
- return files;
17
- });
11
+ async function getFiles(dir, options) {
12
+ const opts = { ...exports.defaultDirectoryScanOptions, ...options };
13
+ const files = [];
14
+ await getFilesImpl(dir, opts, files, 0);
15
+ return files;
18
16
  }
19
- exports.getFiles = getFiles;
20
- function getFilesImpl(dir, options, files, currentDepth) {
21
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
- const dirFiles = yield (0, fs_extra_1.readdir)(dir);
23
- for (const file of dirFiles) {
24
- const filePath = (0, path_1.resolve)(dir, file);
25
- const stat = yield (0, fs_extra_1.lstat)(filePath);
26
- if (stat.isDirectory()) {
27
- if (options.recursive) {
28
- if (options.maxDepth && options.maxDepth > currentDepth) {
29
- getFilesImpl(filePath, options, files, currentDepth + 1);
30
- }
17
+ async function getFilesImpl(dir, options, files, currentDepth) {
18
+ const dirFiles = await (0, fs_extra_1.readdir)(dir);
19
+ for (const file of dirFiles) {
20
+ const filePath = (0, path_1.resolve)(dir, file);
21
+ const stat = await (0, fs_extra_1.lstat)(filePath);
22
+ if (stat.isDirectory()) {
23
+ if (options.recursive) {
24
+ if (options.maxDepth && options.maxDepth > currentDepth) {
25
+ getFilesImpl(filePath, options, files, currentDepth + 1);
31
26
  }
32
27
  }
33
- else {
34
- if (!options.filter || options.filter(file)) {
35
- files.push(filePath);
36
- }
28
+ }
29
+ else {
30
+ if (!options.filter || options.filter(file)) {
31
+ files.push(filePath);
37
32
  }
38
33
  }
39
- });
34
+ }
40
35
  }
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInitializedValue = void 0;
3
+ exports.getInitializedValue = getInitializedValue;
4
4
  function getInitializedValue(value) {
5
5
  if (value === undefined) {
6
6
  throw new Error('Generator not initialized.');
7
7
  }
8
8
  return value;
9
9
  }
10
- exports.getInitializedValue = getInitializedValue;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createOverwriteProxy = void 0;
3
+ exports.createOverwriteProxy = createOverwriteProxy;
4
4
  function createOverwriteProxy(target, values) {
5
5
  const proxy = new Proxy(target, new OverwriteProxyHandler());
6
6
  if (values) {
@@ -8,7 +8,6 @@ function createOverwriteProxy(target, values) {
8
8
  }
9
9
  return proxy;
10
10
  }
11
- exports.createOverwriteProxy = createOverwriteProxy;
12
11
  class OverwriteProxyHandler {
13
12
  constructor() {
14
13
  this._overwrittenValues = {};
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSchemaReference = exports.resolveAnyOfAndAllOf = void 0;
3
+ exports.resolveAnyOfAndAllOf = resolveAnyOfAndAllOf;
4
+ exports.getSchemaReference = getSchemaReference;
4
5
  const internal_utils_1 = require("../internal-utils");
5
6
  function resolveAnyOfAndAllOf(schema, ignoreNonObjectParts) {
6
7
  if (!ignoreNonObjectParts && (hasInvalidSubSchema(schema.anyOf) || hasInvalidSubSchema(schema.allOf))) {
@@ -17,9 +18,17 @@ function resolveAnyOfAndAllOf(schema, ignoreNonObjectParts) {
17
18
  if (properties.size === 0 && initialAdditionalProperties === additionalProperties) {
18
19
  return undefined;
19
20
  }
20
- return Object.assign(Object.assign({}, schema), { kind: 'object', type: 'object', anyOf: [], allOf: [], properties: properties, required: required, additionalProperties });
21
+ return {
22
+ ...schema,
23
+ kind: 'object',
24
+ type: 'object',
25
+ anyOf: [],
26
+ allOf: [],
27
+ properties: properties,
28
+ required: required,
29
+ additionalProperties,
30
+ };
21
31
  }
22
- exports.resolveAnyOfAndAllOf = resolveAnyOfAndAllOf;
23
32
  function collectSubSchemaProperties(subSchemas, properties, required, optional) {
24
33
  for (const subSchema of subSchemas) {
25
34
  if (subSchema.kind === 'object') {
@@ -106,4 +115,3 @@ function getSchemaReference(schema, propertiesToIgnore) {
106
115
  const hasPropertiesDefined = Object.keys(schema.$src.originalComponent).some((key) => (0, internal_utils_1.isOpenApiObjectProperty)(key) && !propertiesToIgnore.includes(key));
107
116
  return hasPropertiesDefined ? schema : getSchemaReference(schema.$ref, propertiesToIgnore);
108
117
  }
109
- exports.getSchemaReference = getSchemaReference;
@@ -1,14 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.builderTemplate = exports.SourceBuilder = exports.defaultSourceBuilderOptions = void 0;
4
- const os_1 = require("os");
5
4
  const common_utils_1 = require("./common.utils");
6
5
  const condition_1 = require("./condition");
7
6
  const string_builder_1 = require("./string-builder");
8
7
  const string_utils_1 = require("./string.utils");
8
+ /**
9
+ * Default options for the `SourceBuilder` class.
10
+ */
9
11
  exports.defaultSourceBuilderOptions = {
12
+ ...string_builder_1.defaultStringBuilderOptions,
10
13
  indent: { type: 'spaces', count: 2 },
11
- newLine: os_1.EOL,
12
14
  };
13
15
  /**
14
16
  * Represents an in-memory source file.
@@ -30,7 +32,7 @@ class SourceBuilder extends string_builder_1.StringBuilder {
30
32
  this._isLastLineEmpty = true;
31
33
  this._isCurrentLineEmpty = true;
32
34
  this._linePrefixNodes = [];
33
- this.__options = Object.assign(Object.assign({}, exports.defaultSourceBuilderOptions), options);
35
+ this.__options = { ...exports.defaultSourceBuilderOptions, ...options };
34
36
  this._indentString = this.__options.indent.type === 'tabs' ? '\t' : ' '.repeat(this.__options.indent.count);
35
37
  }
36
38
  /**
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultStringBuilderOptions = void 0;
4
4
  const os_1 = require("os");
5
+ /**
6
+ * Default options for the `StringBuilder` class.
7
+ */
5
8
  exports.defaultStringBuilderOptions = {
6
9
  newLine: os_1.EOL,
7
10
  };
@@ -20,7 +20,7 @@ class StringBuilder {
20
20
  */
21
21
  constructor(options) {
22
22
  this.str = '';
23
- this._options = Object.assign(Object.assign({}, options_1.defaultStringBuilderOptions), options);
23
+ this._options = { ...options_1.defaultStringBuilderOptions, ...options };
24
24
  }
25
25
  /**
26
26
  * Creates a new StringBuilder instance and appends the specified string to it.
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.concatAppendValues = exports.isAppendValueGroup = exports.isAppendValue = exports.appendValueGroup = exports.basicAppendValueGroup = void 0;
3
+ exports.basicAppendValueGroup = basicAppendValueGroup;
4
+ exports.appendValueGroup = appendValueGroup;
5
+ exports.isAppendValue = isAppendValue;
6
+ exports.isAppendValueGroup = isAppendValueGroup;
7
+ exports.concatAppendValues = concatAppendValues;
4
8
  const common_utils_1 = require("../common.utils");
5
9
  function basicAppendValueGroup(values, separator) {
6
10
  var _a;
@@ -10,7 +14,6 @@ function basicAppendValueGroup(values, separator) {
10
14
  separator: separator !== null && separator !== void 0 ? separator : null,
11
15
  };
12
16
  }
13
- exports.basicAppendValueGroup = basicAppendValueGroup;
14
17
  function appendValueGroup(values, separator) {
15
18
  var _a;
16
19
  return {
@@ -19,7 +22,6 @@ function appendValueGroup(values, separator) {
19
22
  separator: separator !== null && separator !== void 0 ? separator : null,
20
23
  };
21
24
  }
22
- exports.appendValueGroup = appendValueGroup;
23
25
  function isAppendValue(value) {
24
26
  return (typeof value === 'string' ||
25
27
  typeof value === 'number' ||
@@ -27,12 +29,9 @@ function isAppendValue(value) {
27
29
  typeof value === 'function' ||
28
30
  isAppendValueGroup(value));
29
31
  }
30
- exports.isAppendValue = isAppendValue;
31
32
  function isAppendValueGroup(value) {
32
33
  return typeof value === 'object' && value !== null && '__type' in value && value.__type === 'append-value-group';
33
34
  }
34
- exports.isAppendValueGroup = isAppendValueGroup;
35
35
  function concatAppendValues(...values) {
36
36
  return (0, common_utils_1.concatSingleOrMultiple)(...values);
37
37
  }
38
- exports.concatAppendValues = concatAppendValues;