UNPKG

@knowmax/genericlist-core

Version:

Knowmax Generic list with basic CRUD support without any user interface implementation.

24 lines (23 loc) 715 B
/** Returns given param id optionally prefixed with id of given list. */ export const getParamId = (id, listId) => { if (listId !== undefined && listId !== '') { return `${listId}.${id}`; } else { return id; } }; /** Get value for param with id optionally prefixed with id of given list. */ export const getParamValue = (id, params, listId) => { const prefixedid = getParamId(id, listId); if (prefixedid !== id) { return params.get(prefixedid); } else { return params.get(id); } }; /** Returns true if given id starts with given listId, false otherwise. */ export const hasListPrefix = (id, listId) => { return id.startsWith(`${listId}.`); };