UNPKG

@platform/cell.schema

Version:

URI and database schemas for the `cell.os`.

20 lines (19 loc) 716 B
export function isHttp(input = '') { input = input.trim(); return input.startsWith('https://') || input.startsWith('http://'); } export const isNilOrEmptyObject = (value, options = {}) => { return value === null ? true : isUndefinedOrEmptyObject(value, options); }; export const isUndefinedOrEmptyObject = (value, options = {}) => { return value === undefined ? true : isEmptyObject(value, options); }; export const isEmptyObject = (value, options = {}) => { if (value === null || typeof value !== 'object') { return false; } const keys = options.ignoreHash ? Object.keys(value).filter(key => key !== 'hash') : Object.keys(value); return keys.length === 0; };