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.js 791B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict'
  2. var convert = require('./convert')
  3. module.exports = is
  4. is.convert = convert
  5. // Assert if `test` passes for `node`.
  6. // When a `parent` node is known the `index` of node should also be given.
  7. function is(node, test, index, parent, context) {
  8. var check = convert(test)
  9. if (
  10. index != null &&
  11. (typeof index !== 'number' || index < 0 || index === Infinity)
  12. ) {
  13. throw new Error('Expected positive finite index')
  14. }
  15. if (parent != null && (!is(parent) || !parent.children)) {
  16. throw new Error('Expected parent node')
  17. }
  18. if ((parent == null) !== (index == null)) {
  19. throw new Error('Expected both parent and index')
  20. }
  21. return node && node.type && typeof node.type === 'string'
  22. ? Boolean(check.call(context, node, index, parent))
  23. : false
  24. }