Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swagger-mock-parser

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-mock-parser - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

43

dist/Parser.js

@@ -59,25 +59,3 @@ 'use strict';

value: function getParser(node) {
if (!Array.prototype.find) {
Array.prototype.find = function (predicate) {
if (this === null) {
throw new TypeError('Array.prototype.find called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = list.length >>> 0;
var thisArg = arguments[1];
var value;
for (var i = 0; i < length; i++) {
value = list[i];
if (predicate.call(thisArg, value, i, list)) {
return value;
}
}
return undefined;
};
}
var parser = this.parsers.find(function (p) {
var parser = this.findParser(function (p) {
return p.canParse(node);

@@ -96,2 +74,21 @@ });

}, {
key: 'findParser',
value: function findParser(predicate) {
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = this.parsers;
var length = list.length >>> 0;
var thisArg = arguments[1];
var value;
for (var i = 0; i < length; i++) {
value = list[i];
if (predicate.call(thisArg, value, i, list)) {
return value;
}
}
return undefined;
}
}, {
key: 'parsers',

@@ -98,0 +95,0 @@ get: function get() {

{
"name": "swagger-mock-parser",
"version": "1.0.5",
"version": "1.0.6",
"description": "use chance.js to parse definition schema to mock data",

@@ -5,0 +5,0 @@ "keywords": [

@@ -29,26 +29,4 @@ import StringParser from './Parsers/StringParser'

getParser(node) {
if (!Array.prototype.find) {
Array.prototype.find = function (predicate) {
if (this === null) {
throw new TypeError('Array.prototype.find called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = list.length >>> 0;
var thisArg = arguments[1];
var value;
let parser = this.findParser(p => p.canParse(node));
for (var i = 0; i < length; i++) {
value = list[i];
if (predicate.call(thisArg, value, i, list)) {
return value;
}
}
return undefined;
};
}
let parser = this.parsers.find(p => p.canParse(node));
if (!parser)

@@ -63,2 +41,20 @@ throw new Error(`Can't handle ${node.type || 'Unknown'} type.`);

}
findParser(predicate){
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = this.parsers;
var length = list.length >>> 0;
var thisArg = arguments[1];
var value;
for (var i = 0; i < length; i++) {
value = list[i];
if (predicate.call(thisArg, value, i, list)) {
return value;
}
}
return undefined;
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc