{"size": 1337, "ext": "js", "max_stars_repo_path": "dist/src/asserts/logo-assert.js", "max_stars_repo_name": "PlatiaTeam/authy-client", "max_stars_repo_stars_event_min_datetime": "2017-08-09T03:54:39.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-25T19:18:16.000Z", "max_issues_repo_path": "dist/src/asserts/logo-assert.js", "max_issues_repo_name": "PlatiaTeam/authy-client", "max_issues_repo_issues_event_min_datetime": "2017-10-09T22:52:38.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-08T22:55:28.000Z", "max_forks_repo_path": "dist/src/asserts/logo-assert.js", "max_forks_repo_name": "PlatiaTeam/authy-client", "max_forks_repo_forks_event_min_datetime": "2017-08-13T15:00:08.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-08T19:38:50.000Z"}
{"max_stars_count": 87, "max_issues_count": 22, "max_forks_count": 17, "avg_line_length": 22.6610169492, "max_line_length": 269, "alphanum_fraction": 0.6522064323}
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = logoAssert;

var _validator = require('validator.js-asserts');

var asserts = _interopRequireWildcard(_validator);

var _validator2 = require('validator.js');

var _lodash = require('lodash');

var _enums = require('../enums');

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

/**
 * Inject `Uri` and `EqualKeys` extra asserts.
 */

/**
 * Module dependencies.
 */

const is = _validator2.Assert.extend((0, _lodash.pick)(asserts, ['Uri', 'EqualKeys']));

/**
 * Resolution choices.
 */

const choices = (0, _lodash.values)(_enums.resolution);

/**
 * Export `LogoAssert`.
 */

function logoAssert() {
  // Class name.
  this.__class__ = 'Logo';

  // Validation algorithm.
  this.validate = value => {
    try {
      is.equalKeys(['res', 'url']).validate(value);
      is.choice(choices).validate(value.res);
      is.uri().validate(value.url);
    } catch (e) {
      throw new _validator2.Violation(e.assert, value, e.violation);
    }

    return true;
  };

  return this;
}
module.exports = exports['default'];