Skip to content
Snippets Groups Projects
index.ts 798 B
Newer Older
David Sehnal's avatar
David Sehnal committed
/**
 * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
 *
 * @author David Sehnal <david.sehnal@gmail.com>
 * @author Alexander Rose <alexander.rose@weirdbyte.de>
David Sehnal's avatar
David Sehnal committed
 */

import BitFlags from './bit-flags'
import StringBuilder from './string-builder'
import UUID from './uuid'
import Mask from './mask'
David Sehnal's avatar
David Sehnal committed

export * from './value-cell'
export { BitFlags, StringBuilder, UUID, Mask }

export function arrayEqual<T>(arr1: T[], arr2: T[]) {
    const length = arr1.length
    if (length !== arr2.length) return false
    for (let i = 0; i < length; i++) {
        if (arr1[i] !== arr2[i]) {
            return false
        }
    }
    return true
}

export function defaults (value: any, defaultValue: any) {
    return value !== undefined ? value : defaultValue