import { DECORATORS } from '../constants' ; import { createMixedDecorator } from './helpers' ; import { clone } from 'lodash' ; export function ApiExtension ( extensionKey , extensionProperties ) { if ( ! extensionKey . startsWith ( 'x-' ) ) { throw new Error ( 'Extension key is not prefixed. Please ensure you prefix it with `x-`.' ) ; } const extensionObject = { [ extensionKey ] : clone ( extensionProperties ) } ; return createMixedDecorator ( DECORATORS . API_EXTENSION , extensionObject ) ; }