validate.js 533 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. /*
  3. Copyright 2018 Google LLC
  4. Use of this source code is governed by an MIT-style
  5. license that can be found in the LICENSE file or at
  6. https://opensource.org/licenses/MIT.
  7. */
  8. module.exports = (options, schema) => {
  9. const _schema$validate = schema.validate(options, {
  10. language: {
  11. object: {
  12. allowUnknown: 'is not a supported parameter.'
  13. }
  14. }
  15. }),
  16. value = _schema$validate.value,
  17. error = _schema$validate.error;
  18. if (error) {
  19. throw error;
  20. }
  21. return value;
  22. };