Joi.extend can be called with arrays

This commit is contained in:
Matthew Bull
2017-12-06 20:38:10 +00:00
parent 67e6191912
commit 166d1a8b35
2 changed files with 8 additions and 1 deletions

View File

@@ -1071,7 +1071,8 @@ export function reach<T extends Schema>(schema: ObjectSchema, path: string): T;
/**
* Creates a new Joi instance customized with the extension(s) you provide included.
*/
export function extend(extention: Extension): any;
export function extend(extention: Extension|Extension[]): any;
export function extend(...extentions: (Extension|Extension[])[]): any;
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

View File

@@ -970,6 +970,12 @@ const Joi3 = Joi.extend({
],
});
const Joi4 = Joi.extend([{ name: '', base: schema }, { name: '', base: schema }]);
const Joi5 = Joi.extend({ name: '', base: schema }, { name: '', base: schema });
const Joi6 = Joi.extend({ name: '', base: schema }, [{ name: '', base: schema }, { name: '', base: schema }]);
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
const defaultsJoi = Joi.defaults((schema) => {