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.

index.d.ts 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // TypeScript Version: 3.5
  2. import {Node, Parent} from 'unist'
  3. declare namespace unistUtilIs {
  4. /**
  5. * Check that type property matches expectation for a node
  6. *
  7. * @typeParam T type of node that passes test
  8. */
  9. type TestType<T extends Node> = T['type']
  10. /**
  11. * Check that some attributes on a node are matched
  12. *
  13. * @typeParam T type of node that passes test
  14. */
  15. type TestObject<T extends Node> = Partial<T>
  16. /**
  17. * Check if a node passes a test
  18. *
  19. * @param node node to check
  20. * @param index index of node in parent
  21. * @param parent parent of node
  22. * @typeParam T type of node that passes test
  23. * @returns true if type T is found, false otherwise
  24. */
  25. type TestFunction<T extends Node> = (
  26. node: unknown,
  27. index?: number,
  28. parent?: Parent
  29. ) => node is T
  30. /**
  31. * Union of all the types of tests
  32. *
  33. * @typeParam T type of node that passes test
  34. */
  35. type Test<T extends Node> =
  36. | TestType<T>
  37. | TestObject<T>
  38. | TestFunction<T>
  39. | null
  40. | undefined
  41. }
  42. /**
  43. * Unist utility to check if a node passes a test.
  44. *
  45. * @param node Node to check.
  46. * @param test When nullish, checks if `node` is a `Node`.
  47. * When `string`, works like passing `function (node) {return node.type === test}`.
  48. * When `function` checks if function passed the node is true.
  49. * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values.
  50. * When `array`, checks any one of the subtests pass.
  51. * @param index Position of `node` in `parent`
  52. * @param parent Parent of `node`
  53. * @param context Context object to invoke `test` with
  54. * @typeParam T type that node is compared with
  55. * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`).
  56. */
  57. declare function unistUtilIs<T extends Node>(
  58. node: unknown,
  59. test?: unistUtilIs.Test<T> | Array<unistUtilIs.Test<any>>,
  60. index?: number,
  61. parent?: Parent,
  62. context?: any
  63. ): node is T
  64. export = unistUtilIs