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

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