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.

combine-extensions.js 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. 'use strict'
  2. var hasOwnProperty = require('../constant/has-own-property.js')
  3. var chunkedSplice = require('./chunked-splice.js')
  4. var miniflat = require('./miniflat.js')
  5. // Combine several syntax extensions into one.
  6. function combineExtensions(extensions) {
  7. var all = {}
  8. var index = -1
  9. while (++index < extensions.length) {
  10. extension(all, extensions[index])
  11. }
  12. return all
  13. }
  14. function extension(all, extension) {
  15. var hook
  16. var left
  17. var right
  18. var code
  19. for (hook in extension) {
  20. left = hasOwnProperty.call(all, hook) ? all[hook] : (all[hook] = {})
  21. right = extension[hook]
  22. for (code in right) {
  23. left[code] = constructs(
  24. miniflat(right[code]),
  25. hasOwnProperty.call(left, code) ? left[code] : []
  26. )
  27. }
  28. }
  29. }
  30. function constructs(list, existing) {
  31. var index = -1
  32. var before = []
  33. while (++index < list.length) {
  34. ;(list[index].add === 'after' ? existing : before).push(list[index])
  35. }
  36. chunkedSplice(existing, 0, 0, before)
  37. return existing
  38. }
  39. module.exports = combineExtensions