Skip to content
Snippets Groups Projects
Select Git revision
  • 91c083223e5529900050074e5c3cd6b162d658cd
  • master default protected
  • iopsys
  • develop
  • gh-pages
  • 0.4.x
  • v0.5.0-rc23
  • v0.5.0-rc22
  • v0.5.0-rc21
  • v0.5.0-rc20
  • v0.5.0-rc19
  • v0.5.0-rc18
  • v0.5.0-rc17
  • 0.5.0-rc16
  • v0.5.0-rc15
  • v0.4.7
  • v0.5.0-rc12
  • v0.5.0-rc11
  • v0.4.3
  • v0.5.0-rc10
  • v0.5.0-rc9
  • v0.5.0-rc8
  • v0.5.0-rc7
  • v0.5.0-rc6
  • v0.5.0-rc5
  • v0.5.0-rc4
26 results

index.umd.js

Blame
  • index.umd.js 74.52 KiB
    /*!
     * json-schema-faker v0.5.0-rc21
     * (c) Alvaro Cabrera <pateketrueke@gmail.com> (https://soypache.co)
     * Released under the MIT License.
     */
    (function (global, factory) {
      typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('json-schema-ref-parser'), require('jsonpath-plus')) :
      typeof define === 'function' && define.amd ? define(['json-schema-ref-parser', 'jsonpath-plus'], factory) :
      (global = global || self, global.JSONSchemaFaker = factory(global.$RefParser, global.jsonpathPlus));
    }(this, function ($RefParser, jsonpathPlus) { 'use strict';
    
      $RefParser = $RefParser && $RefParser.hasOwnProperty('default') ? $RefParser['default'] : $RefParser;
    
      /**
       * This class defines a registry for custom formats used within JSF.
       */
      var Registry = function Registry() {
        // empty by default
        this.data = {};
      };
      /**
       * Unregisters custom format(s)
       * @param name
       */
    
    
      Registry.prototype.unregister = function unregister (name) {
        if (!name) {
          this.data = {};
        } else {
          delete this.data[name];
        }
      };
      /**
       * Registers custom format
       */
    
    
      Registry.prototype.register = function register (name, callback) {
        this.data[name] = callback;
      };
      /**
       * Register many formats at one shot
       */
    
    
      Registry.prototype.registerMany = function registerMany (formats) {
          var this$1 = this;
    
        Object.keys(formats).forEach(function (name) {
          this$1.data[name] = formats[name];
        });
      };
      /**
       * Returns element by registry key
       */
    
    
      Registry.prototype.get = function get (name) {
        var format = this.data[name];
        return format;
      };
      /**
       * Returns the whole registry content
       */
    
    
      Registry.prototype.list = function list () {
        return this.data;
      };