"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/request/node_modules/har-validator/lib/index.js" (7 Feb 2017, 554 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

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