UNPKG

scrivito

Version:

Scrivito is a professional, yet easy to use SaaS Enterprise Content Management Service, built for digital agencies and medium to large businesses. It is completely maintenance-free, cost-effective, and has unprecedented performance and security.

30 lines (24 loc) 779 B
import { initialContentFor } from './initial_content_registry'; import { Schema } from './schema'; import { AttributeValue } from './wrap_in_app_class'; interface Attributes { [key: string]: AttributeValue | undefined; } export function initialAttributesFor( providedAttributes: object, schema: Schema, appClassName: string ): Attributes { const initialAttributes: Attributes = {}; Object.keys(schema.attributes()).forEach((attributeName) => { if ( !Object.prototype.hasOwnProperty.call(providedAttributes, attributeName) ) { const initialValue = initialContentFor(appClassName, attributeName); if (initialValue !== undefined) { initialAttributes[attributeName] = initialValue; } } }); return initialAttributes; }