Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

validators.js 913B

12345678910111213141516171819202122232425262728293031323334
  1. import t from "@babel/types";
  2. import virtualTypes from "../../lib/path/lib/virtual-types.js";
  3. import definitions from "@babel/types/lib/definitions/index.js";
  4. export default function generateValidators() {
  5. let output = `/*
  6. * This file is auto-generated! Do not modify it directly.
  7. * To re-generate run 'make build'
  8. */
  9. import * as t from "@babel/types";
  10. import NodePath from "../index";
  11. export interface NodePathValidators {
  12. `;
  13. for (const type of [...t.TYPES].sort()) {
  14. output += `is${type}(opts?: object): this is NodePath<t.${type}>;`;
  15. }
  16. for (const type of Object.keys(virtualTypes)) {
  17. if (type[0] === "_") continue;
  18. if (definitions.NODE_FIELDS[type] || definitions.FLIPPED_ALIAS_KEYS[type]) {
  19. output += `is${type}(opts?: object): this is NodePath<t.${type}>;`;
  20. } else {
  21. output += `is${type}(opts?: object): boolean;`;
  22. }
  23. }
  24. output += `
  25. }
  26. `;
  27. return output;
  28. }