export function formListOfKeys()

in src/NoSqlProviderUtils.ts [75:92]


export function formListOfKeys(keyOrKeys: KeyType|KeyType[], keyPath: KeyPathType): any[] {
    if (isCompoundKeyPath(keyPath)) {
        if (!isArray(keyOrKeys)) {
            throw new Error('formListOfKeys called with a compound keypath (' + JSON.stringify(keyPath) +
                ') but a non-compound keyOrKeys (' + JSON.stringify(keyOrKeys) + ')');
        }
        if (!isArray(keyOrKeys[0])) {
            // Looks like a single compound key, so make it a list of a single key
            return [keyOrKeys];
        }

        // Array of arrays, so looks fine
        return keyOrKeys;
    }

    // Non-compound, so just make sure it's a list when it comes out in case it's a single key passed
    return arrayify(keyOrKeys);
}