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

availability

Package Overview
Dependencies
Maintainers
4
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.0.1 to 2.0.2

2

package.json
{
"name": "availability",
"version": "2.0.1",
"version": "2.0.2",
"description": "Wix Restaurants Availability Utils Module",

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

@@ -36,4 +36,4 @@ var Status = require("./Status.js");

function getTime(date) {
if (date === null) {
return null;
if (!date) {
return null;
}

@@ -44,4 +44,4 @@ return moment.tz([date.year, date.month - 1, date.day, date.hour, date.minute], tz).valueOf();

function strictlyBefore(window1EndTs, window2StartTs) {
if ((window1EndTs == null) || (window2StartTs == null)) {
return false;
if ((window1EndTs === null) || (window2StartTs === null)) {
return false
}

@@ -85,3 +85,3 @@ return (window1EndTs <= window2StartTs);

index = findInsertionIndex(timeWindows, cal.valueOf());
lastWindowUntilForever = (timeWindows[timeWindows.length-1].end === null);
lastWindowUntilForever = !timeWindows[timeWindows.length-1].end;
} else {

@@ -88,0 +88,0 @@ index = new Index(0, true);

@@ -101,3 +101,3 @@ var should = require('chai').should();

it ('returns a single status when given a single "since forever, until forever" window and pointed to it', function() {
it ('returns a single status when given a single "since forever, until forever" (as null) window and pointed to it', function() {
var cal = moment.tz([2010, 12-1, 12, 0, 0, 0, 0], tz);

@@ -117,2 +117,16 @@

});
it ('returns a single status when given a single "since forever, until forever" (as undefined) window and pointed to it', function() {
var cal = moment.tz([2010, 12-1, 12, 0, 0, 0, 0], tz);
var tester = createTester({
cal: cal,
timeWindows: [{
available: true
}]
});
tester.assertLastStatus(Status.STATUS_AVAILABLE);
tester.assertDone();
});

@@ -119,0 +133,0 @@ it ('returns two statuses when given a single time window and pointed to its start', function() {

@@ -14,2 +14,9 @@ var should = require('chai').should();

/**
* @param cal Moment with tz
*/
self.setCal = function(_cal) {
cal = _cal;
};
/**
* @param status Status

@@ -16,0 +23,0 @@ * @param field "day"

@@ -68,2 +68,21 @@ var should = require('chai').should();

it ('returns the correct status when starting mid-minute in a Sunday-only schedule', function() {
var cal = moment.tz([2010, 12-1, 12, 0, 0, 30, 0], tz);
var tester = createTester({
cal: cal,
weekly: [
{
minuteOfWeek: WeeklyTimeWindow.SUNDAY,
durationMins: WeeklyTimeWindow.DAY
}
]
});
var calNoSeconds = moment.tz([2010, 12-1, 12, 0, 0, 0, 0], tz);
tester.setCal(calNoSeconds);
tester.assertNextStatus(Status.STATUS_AVAILABLE, "day", 1);
});
it ('returns an infinite series of statuses for a Monday-only schedule', function() {

@@ -70,0 +89,0 @@ var 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