openapi-sampler
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -284,3 +284,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.OpenAPISampler = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
function commonDateTimeSample(min, max, omitTime) { | ||
var res = (0, _utils.toRFCDateTime)(new Date(), omitTime); | ||
var res = (0, _utils.toRFCDateTime)(new Date(), omitTime, false); | ||
if (res.length < min) { | ||
@@ -396,6 +396,6 @@ throw Erorr('Using minLength = ' + min + ' is incorrect with format "date-time"'); | ||
function toRFCDateTime(date, omitTime) { | ||
function toRFCDateTime(date, omitTime, milliseconds) { | ||
var res = date.getUTCFullYear() + '-' + pad(date.getUTCMonth() + 1) + '-' + pad(date.getUTCDate()); | ||
if (!omitTime) { | ||
res += 'T' + pad(date.getUTCHours()) + ':' + pad(date.getUTCMinutes()) + ':' + pad(date.getUTCSeconds()) + '.' + (date.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z'; | ||
res += 'T' + pad(date.getUTCHours()) + ':' + pad(date.getUTCMinutes()) + ':' + pad(date.getUTCSeconds()) + (milliseconds ? '.' + (date.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) : '') + 'Z'; | ||
} | ||
@@ -402,0 +402,0 @@ return res; |
{ | ||
"name": "openapi-sampler", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Tool for generation samples based on OpenAPI payload/response schema", | ||
@@ -5,0 +5,0 @@ "main": "dist/openapi-sampler.js", |
@@ -21,3 +21,3 @@ 'use strict'; | ||
function commonDateTimeSample(min, max, omitTime) { | ||
let res = toRFCDateTime(new Date(), omitTime); | ||
let res = toRFCDateTime(new Date(), omitTime, false); | ||
if (res.length < min) { | ||
@@ -24,0 +24,0 @@ throw Erorr(`Using minLength = ${min} is incorrect with format "date-time"`); |
@@ -10,3 +10,3 @@ 'use strict'; | ||
export function toRFCDateTime(date, omitTime) { | ||
export function toRFCDateTime(date, omitTime, milliseconds) { | ||
var res = date.getUTCFullYear() + | ||
@@ -19,3 +19,3 @@ '-' + pad(date.getUTCMonth() + 1) + | ||
':' + pad(date.getUTCSeconds()) + | ||
'.' + (date.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + | ||
(milliseconds ? '.' + (date.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) : '') + | ||
'Z'; | ||
@@ -22,0 +22,0 @@ } |
49392