a zip code crypto-currency system good for red ONLY

index.js 554B

1234567891011121314151617181920212223
  1. 'use strict'
  2. var Promise = require('pinkie-promise')
  3. var runner = require('./runner')
  4. var schemas = require('./schemas')
  5. var promisify = function (schema) {
  6. return function (data) {
  7. return new Promise(function (resolve, reject) {
  8. runner(schema, data, function (err, valid) {
  9. return err === null ? resolve(data) : reject(err)
  10. })
  11. })
  12. }
  13. }
  14. module.exports = promisify(schemas.har)
  15. // utility methods for all parts of the schema
  16. Object.keys(schemas).map(function (name) {
  17. module.exports[name] = promisify(schemas[name])
  18. })