Merge pull request #22014 from wingsbob/joi-extend-accepts-arrays

Joi.extend can be called with arrays
This commit is contained in:
Mine Starks
2017-12-11 16:00:21 -08:00
committed by GitHub
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -1071,7 +1071,7 @@ 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(extension: Extension|Extension[], ...extensions: (Extension|Extension[])[]): any;
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
+6
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) => {