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

availability

Package Overview
Dependencies
Maintainers
1
Versions
944
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

availability - npm Package Compare versions

Comparing version 2.1.83 to 2.1.84

11

dist/AvailabilityIterator.js

@@ -17,4 +17,10 @@ "use strict";

var AvailabilityIterator = exports.AvailabilityIterator = function () {
/**
* @param availability availability.Availability
* @param cal Moment with tz
*/
function AvailabilityIterator(_ref) {
var availability = _ref.availability;
var _ref$availability = _ref.availability;
var availability = _ref$availability === undefined ? {} : _ref$availability;
var cal = _ref.cal;

@@ -24,4 +30,3 @@

availability = availability || null; // availability.Availability
cal = cal || null; // Moment with tz
availability = availability || {}; // null availability is treated as empty availability

@@ -28,0 +33,0 @@ this._it = new _MergingStatusIterator.MergingStatusIterator({

@@ -110,4 +110,10 @@ "use strict";

var DisjunctiveAvailabilityIterator = exports.DisjunctiveAvailabilityIterator = function () {
/**
* @param availabilities List<availability.Availability>
* @param cal Moment with tz
*/
function DisjunctiveAvailabilityIterator(_ref2) {
var availabilities = _ref2.availabilities;
var _ref2$availabilities = _ref2.availabilities;
var availabilities = _ref2$availabilities === undefined ? [] : _ref2$availabilities;
var cal = _ref2.cal;

@@ -117,4 +123,3 @@

availabilities = availabilities || []; // List<availability.Availability>
cal = cal || null; // Moment with tz
availabilities = availabilities || []; // null availabilities are treated as empty array

@@ -121,0 +126,0 @@ this._it = new _MergingStatusIterator.MergingStatusIterator({

{
"name": "availability",
"version": "2.1.83",
"version": "2.1.84",
"description": "Wix Restaurants Availability Utils Module",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -7,5 +7,8 @@ "use strict"

export class AvailabilityIterator {
constructor({availability, cal}) {
availability = availability || null // availability.Availability
cal = cal || null // Moment with tz
/**
* @param availability availability.Availability
* @param cal Moment with tz
*/
constructor({availability = {}, cal}) {
availability = availability || {} // null availability is treated as empty availability

@@ -12,0 +15,0 @@ this._it = new MergingStatusIterator({

@@ -79,5 +79,8 @@ "use strict"

export class DisjunctiveAvailabilityIterator {
constructor({availabilities, cal}) {
availabilities = availabilities || [] // List<availability.Availability>
cal = cal || null // Moment with tz
/**
* @param availabilities List<availability.Availability>
* @param cal Moment with tz
*/
constructor({availabilities = [], cal}) {
availabilities = availabilities || [] // null availabilities are treated as empty array

@@ -84,0 +87,0 @@ this._it = new MergingStatusIterator({

@@ -52,2 +52,37 @@ "use strict"

it ('defaults to treating availability as empty', function() {
let cal = moment.tz([2010, 12-1, 13, 0, 0, 0, 0], tz)
let yesterday = cal.clone()
advancer.advance(yesterday, "day", -1)
const tester = new StatusIteratorTester({
it: new AvailabilityIterator({
cal: cal
}),
cal: cal
})
tester.assertLastStatus(Status.STATUS_AVAILABLE)
tester.assertDone()
})
it ('treats null availability as empty availability', function() {
let cal = moment.tz([2010, 12-1, 13, 0, 0, 0, 0], tz)
let yesterday = cal.clone()
advancer.advance(yesterday, "day", -1)
const tester = new StatusIteratorTester({
it: new AvailabilityIterator({
availability: null,
cal: cal
}),
cal: cal
})
tester.assertLastStatus(Status.STATUS_AVAILABLE)
tester.assertDone()
})
it ('returns a single status for a full weekly schedule with a redundant exception', function() {

@@ -54,0 +89,0 @@ let cal = moment.tz([2010, 12-1, 13, 0, 0, 0, 0], tz)

@@ -13,5 +13,2 @@ "use strict"

function createTester({cal, availabilities}) {
cal = cal || null // Moment with tz
availabilities = availabilities || [] // List<Availability>
return new StatusIteratorTester({

@@ -48,3 +45,32 @@ it: new DisjunctiveAvailabilityIterator({

let tz = "Asia/Jerusalem"
it ('defaults to treating availabilities as empty array', function() {
let cal = moment.tz([2010, 12-1, 13, 0, 0, 0, 0], tz)
let yesterday = cal.clone()
advancer.advance(yesterday, "day", -1)
let tester = createTester({
cal: yesterday
})
tester.assertLastStatus(Status.STATUS_UNAVAILABLE)
tester.assertDone()
})
it ('defaults to treating null availabilities as empty availabilities', function() {
let cal = moment.tz([2010, 12-1, 13, 0, 0, 0, 0], tz)
let yesterday = cal.clone()
advancer.advance(yesterday, "day", -1)
let tester = createTester({
availabilities: null,
cal: yesterday
})
tester.assertLastStatus(Status.STATUS_UNAVAILABLE)
tester.assertDone()
})
it ('returns a single status for a full weekly schedule with a redundant exception', function() {

@@ -51,0 +77,0 @@ let cal = moment.tz([2010, 12-1, 13, 0, 0, 0, 0], tz)

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