New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

timeeditapi

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timeeditapi - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

16

api.js

@@ -83,11 +83,22 @@ 'use strict';

*/
const getTodaysSchedule = _getSchedule => id =>
const getScheduleByDate = _getSchedule => (id, date = new Date()) =>
new Promise((resolve, reject) => {
_getSchedule(id)
.then(data => JSON.parse(data))
.then(parsedData => resolve(dataParser.buildTodaysSchedule(parsedData, id)))
.then(parsedData => resolve(dataParser.buildScheduleByDate(parsedData, id, date)))
.catch(reject);
});
/**
* [gets todays schedule]
* @param {[object]} _getSchedule [initilized _getSchedule object]
* @param {[string / array of strings]} id [name of a thing]
* @return {[promise]} [todays schedule]
*/
const getTodaysSchedule = _getSchedule => id =>
getScheduleByDate(_getSchedule)(id);
/**
* [gets schedule for multible days un parsed]

@@ -120,2 +131,3 @@ * @param {[object]} scraper [initilized scraper object]

getSchedule: getSchedule(_getSchedule(scraper)),
getScheduleByDate: getScheduleByDate(_getSchedule(scraper)),
getTodaysSchedule: getTodaysSchedule(_getSchedule(scraper)),

@@ -122,0 +134,0 @@ search: search(scraper),

17

dataParser.js

@@ -68,14 +68,15 @@ 'use strict';

/**
* [todays room schedule information]
* [gets room schedule information by specific date]
* @param {[object]} object [cherio html object]
* @return {[object]} [only todays room schedule information]
* @param {[string]} id [sechdule id]
* @param {Date} [date=new Date()] [Date object]
* @return {[object]} [only room schedule information for specific date]
*/
const buildTodaysSchedule = (object, id) => {
const buildScheduleByDate = (object, id, date = new Date()) => {
const todaysSchedule = buildSchedule(object, id)
.filter((reservation) => {
const reservationDate = _parseDate(reservation.time.startDate);
const todaysDate = new Date();
return reservationDate.getFullYear() === todaysDate.getFullYear() &&
reservationDate.getMonth() === todaysDate.getMonth() &&
reservationDate.getDate() === todaysDate.getDate();
return reservationDate.getFullYear() === date.getFullYear() &&
reservationDate.getMonth() === date.getMonth() &&
reservationDate.getDate() === date.getDate();
});

@@ -92,3 +93,3 @@ return todaysSchedule.length > 0 ? todaysSchedule : null;

isValidSearch,
buildTodaysSchedule,
buildScheduleByDate,
buildSchedule,

@@ -95,0 +96,0 @@ getSearchId,

{
"name": "timeeditapi",
"version": "4.0.0",
"version": "4.1.0",
"description": "web scraper api to easy get schedule information from timeedit",

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

@@ -24,2 +24,10 @@

// schedule by specific date: year, month, day
timeEdit.getScheduleByDate('ny105', new Date())
.then((roomSchedule) => {
console.log(JSON.stringify(roomSchedule, null, 2));
}).catch((er) => {
console.log(er);
});
// full schedule

@@ -26,0 +34,0 @@ timeEdit.getSchedule('ny105')

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