index.ts 869 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author David Sehnal <david.sehnal@gmail.com>
  5. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  6. */
  7. import BitFlags from './bit-flags'
  8. import Computation from './computation'
  9. import Scheduler from './scheduler'
  10. import StringBuilder from './string-builder'
  11. import Time from './time'
  12. import UUID from './uuid'
  13. export { BitFlags, Computation, Scheduler, StringBuilder, Time, UUID }
  14. export function arrayEqual<T>(arr1: T[], arr2: T[]) {
  15. const length = arr1.length
  16. if (length !== arr2.length) return false
  17. for (let i = 0; i < length; i++) {
  18. if (arr1[i] !== arr2[i]) {
  19. return false
  20. }
  21. }
  22. return true
  23. }
  24. export function defaults (value: any, defaultValue: any) {
  25. return value !== undefined ? value : defaultValue
  26. }