-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: vanpho93 <vanpho02@gmail.com>
- Loading branch information
Showing
19 changed files
with
647 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import SimpleSchema from "simpl-schema"; | ||
|
||
const validatorSchema = new SimpleSchema({ | ||
name: String, | ||
fn: Function | ||
}); | ||
|
||
// Objects with `name` and `fn` properties | ||
export const customOrderValidators = []; | ||
|
||
/** | ||
* @summary Will be called for every plugin | ||
* @param {Object} options The options object that the plugin passed to registerPackage | ||
* @returns {undefined} | ||
*/ | ||
export function registerPluginHandlerForOrder({ name, order }) { | ||
if (order) { | ||
const { customValidators } = order; | ||
|
||
if (!Array.isArray(customValidators)) throw new Error(`In ${name} plugin registerPlugin object, order.customValidators must be an array`); | ||
validatorSchema.validate(customValidators); | ||
|
||
customOrderValidators.push(...customValidators); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.