@dwp/govuk-casa
Version:
A framework for building GOVUK Collect-And-Submit-Applications
51 lines (50 loc) • 1.53 kB
TypeScript
/**
* @param {...any} objects Objects to merge
* @returns {object} Merged object
*/
export function mergeObjects(...objects: any[]): object;
/**
* Determine whether a value exists in a list.
*
* @memberof NunjucksFilters
* @param {any[]} source List of items to search
* @param {any} search Item to search within the `source`
* @returns {boolean} True if the search item was found
*/
export function includes(source?: any[], search?: any): boolean;
/**
* Format a given date.
*
* Requires NodeJS >= 14 to make use of bundled date locale data.
*
* `date` may be any of the following types: object - {dd:'', mm:'', yyyy:''}
*
* @memberof NunjucksFilters
* @param {object} date Date
* @param {string} date.dd Day
* @param {string} date.mm Month
* @param {string} date.yyyy Year
* @param {object} [config] Options
* @param {string} [config.locale] Locale (default 'en')
* @param {string} [config.format] Format (default 'd MMMM yyyy')
* @returns {string} Formatted date
*/
export function formatDateObject(date: {
dd: string;
mm: string;
yyyy: string;
}, config?: {
locale?: string | undefined;
format?: string | undefined;
}): string;
/**
* Attribute values will be HTML/attribute escaped.
*
* Example: Given: {class: 'basic', 'data-ga': 3} Output: class="basic"
* data-ga="3"
*
* @memberof NunjucksFilters
* @param {object} attrsObject Attributes object (in name:value pairs)
* @returns {string} Formatted
*/
export function renderAsAttributes(attrsObject: object): string;