calendar-link
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,2 +0,5 @@ | ||
declare const a = "a"; | ||
export { a }; | ||
import { CalendarEvent } from "./interfaces"; | ||
export declare const eventify: (event: CalendarEvent) => CalendarEvent; | ||
export declare const google: (event: CalendarEvent) => string; | ||
export declare const outlook: (event: CalendarEvent) => string; | ||
export declare const yahoo: (event: CalendarEvent) => string; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const a = "a"; | ||
exports.a = a; | ||
const dayjs_1 = __importDefault(require("dayjs")); | ||
const querystring_1 = require("querystring"); | ||
exports.eventify = (event) => { | ||
event.start = dayjs_1.default(event.start).toDate(); | ||
if (event.duration && event.duration.length && !event.end) { | ||
const duration = Number(event.duration[0]); | ||
const unit = event.duration[1]; | ||
event.end = dayjs_1.default(event.start) | ||
.add(duration, unit) | ||
.toDate(); | ||
} | ||
return event; | ||
}; | ||
exports.google = (event) => { | ||
event = exports.eventify(event); | ||
const startDate = dayjs_1.default(event.start) | ||
.toISOString() | ||
.replace(/-/g, "") | ||
.replace(/:/g, "") | ||
.replace(/\./g, ""); | ||
const endDate = dayjs_1.default(event.end) | ||
.toISOString() | ||
.replace(/-/g, "") | ||
.replace(/:/g, "") | ||
.replace(/\./g, ""); | ||
const details = { | ||
action: "TEMPLATE", | ||
text: event.title, | ||
details: event.description, | ||
location: event.location, | ||
trp: event.busy, | ||
dates: startDate.substring(0, startDate.length - 4) + | ||
"Z/" + | ||
endDate.substring(0, endDate.length - 4) + | ||
"Z" | ||
}; | ||
if (event.guests && event.guests.length) { | ||
details.add = event.guests.join(); | ||
} | ||
return `https://calendar.google.com/calendar/render?${querystring_1.stringify(details)}`; | ||
}; | ||
exports.outlook = (event) => { | ||
event = exports.eventify(event); | ||
const details = { | ||
path: "/calendar/action/compose", | ||
rru: "addevent", | ||
startdt: dayjs_1.default(event.start).format("YYYYMMDD[T]HHmmss"), | ||
enddt: dayjs_1.default(event.end).format("YYYYMMDD[T]HHmmss"), | ||
subject: event.title, | ||
body: event.description, | ||
location: event.location | ||
}; | ||
return `https://outlook.live.com/owa/?${querystring_1.stringify(details)}`; | ||
}; | ||
exports.yahoo = (event) => { | ||
event = exports.eventify(event); | ||
const details = { | ||
v: 60, | ||
title: event.title, | ||
st: dayjs_1.default(event.start).format("YYYYMMDD[T]HHmmss"), | ||
et: dayjs_1.default(event.end).format("YYYYMMDD[T]HHmmss"), | ||
desc: event.description, | ||
in_loc: event.location | ||
}; | ||
return `https://calendar.yahoo.com/?${querystring_1.stringify(details)}`; | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "calendar-link", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
11390
9
120
0