@kubb/adapter-oas 5.0.0-alpha.71 → 5.0.0-alpha.73

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/dist/index.js CHANGED
@@ -308,6 +308,93 @@ function mergeDeep(target, source) {
308
308
  //#endregion
309
309
  //#region ../../internals/utils/src/reserved.ts
310
310
  /**
311
+ * JavaScript and Java reserved words.
312
+ * @link https://github.com/jonschlinkert/reserved/blob/master/index.js
313
+ */
314
+ const reservedWords = new Set([
315
+ "abstract",
316
+ "arguments",
317
+ "boolean",
318
+ "break",
319
+ "byte",
320
+ "case",
321
+ "catch",
322
+ "char",
323
+ "class",
324
+ "const",
325
+ "continue",
326
+ "debugger",
327
+ "default",
328
+ "delete",
329
+ "do",
330
+ "double",
331
+ "else",
332
+ "enum",
333
+ "eval",
334
+ "export",
335
+ "extends",
336
+ "false",
337
+ "final",
338
+ "finally",
339
+ "float",
340
+ "for",
341
+ "function",
342
+ "goto",
343
+ "if",
344
+ "implements",
345
+ "import",
346
+ "in",
347
+ "instanceof",
348
+ "int",
349
+ "interface",
350
+ "let",
351
+ "long",
352
+ "native",
353
+ "new",
354
+ "null",
355
+ "package",
356
+ "private",
357
+ "protected",
358
+ "public",
359
+ "return",
360
+ "short",
361
+ "static",
362
+ "super",
363
+ "switch",
364
+ "synchronized",
365
+ "this",
366
+ "throw",
367
+ "throws",
368
+ "transient",
369
+ "true",
370
+ "try",
371
+ "typeof",
372
+ "var",
373
+ "void",
374
+ "volatile",
375
+ "while",
376
+ "with",
377
+ "yield",
378
+ "Array",
379
+ "Date",
380
+ "hasOwnProperty",
381
+ "Infinity",
382
+ "isFinite",
383
+ "isNaN",
384
+ "isPrototypeOf",
385
+ "length",
386
+ "Math",
387
+ "name",
388
+ "NaN",
389
+ "Number",
390
+ "Object",
391
+ "prototype",
392
+ "String",
393
+ "toString",
394
+ "undefined",
395
+ "valueOf"
396
+ ]);
397
+ /**
311
398
  * Returns `true` when `name` is a syntactically valid JavaScript variable name.
312
399
  *
313
400
  * @example
@@ -318,12 +405,8 @@ function mergeDeep(target, source) {
318
405
  * ```
319
406
  */
320
407
  function isValidVarName(name) {
321
- try {
322
- new Function(`var ${name}`);
323
- } catch {
324
- return false;
325
- }
326
- return true;
408
+ if (!name || reservedWords.has(name)) return false;
409
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
327
410
  }
328
411
  //#endregion
329
412
  //#region ../../internals/utils/src/urlPath.ts