object-to-property-value-array
This commit is contained in:
@@ -7,10 +7,10 @@ export * from './entity/index.js';
|
||||
export * from './modals/index.js';
|
||||
export * from './paths.js';
|
||||
export * from './submittable/index.js';
|
||||
export * from './utils/object-to-property-value-array.function.js';
|
||||
export * from './workspace-context.interface.js';
|
||||
export * from './workspace-property-dataset/index.js';
|
||||
export * from './workspace.context-token.js';
|
||||
export * from './workspace.element.js';
|
||||
export * from './workspace.element.js';
|
||||
export type * from './conditions/index.js';
|
||||
export type * from './types.js';
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { UmbPropertyValueData } from '../../property/types';
|
||||
|
||||
/**
|
||||
* @function UmbObjectToPropertyValueArray
|
||||
* @param {object} data - an object with properties to be converted.
|
||||
* @returns {Array<UmbPropertyValueData> | undefined} - and array of property values or undefined
|
||||
*/
|
||||
export function umbObjectToPropertyValueArray(data: object | undefined): Array<UmbPropertyValueData> | undefined {
|
||||
if (!data) return;
|
||||
return Object.keys(data).map((key) => ({
|
||||
alias: key,
|
||||
value: (data as any)[key],
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user