mirror of
https://github.com/unraid/api.git
synced 2026-01-19 15:09:40 -06:00
17 lines
445 B
TypeScript
17 lines
445 B
TypeScript
/*!
|
|
* Copyright 2019-2020 Lime Technology Inc. All rights reserved.
|
|
* Written by: Alexis Tyler
|
|
*/
|
|
|
|
import { LooseObject } from '../../types';
|
|
|
|
/**
|
|
* Check if object has fields.
|
|
* @param obj Object to check fields on
|
|
* @param fields Fields to check
|
|
*/
|
|
export const hasFields = (object: LooseObject, fields: string[]) => {
|
|
const keys = Object.keys(object);
|
|
return keys.length >= 1 ? fields.filter(field => !keys.includes(field)) : fields;
|
|
};
|