GitHub - MarketingPipeline/OnThisDay.js: A JavaScript library to find out what e...
source link: https://github.com/MarketingPipeline/OnThisDay.js
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
OnThisDay.js
Show your support!
OnThisDay.js is a JavaScript library for fetching events on specific dates from Wikipedia. It allows you to retrieve historical events, births, and deaths that occurred on the current or a particular date.
Example and usage
How to use OnThisDay.js:
import { OnThisDay } from 'https://cdn.jsdelivr.net/gh/MarketingPipeline/OnThisDay.js@latest/dist/onthisday.min.js';
// Fetch events, births, and deaths for a specific date
try {
let onDate = await OnThisDay('July 4')
console.log('All Data:', onDate.getAll());
console.log('Births:', onDate.getBirths());
console.log('Deaths:', onDate.getDeaths());
console.log('Events:', onDate.getEvents());
} catch (error) {
console.log(error.message)
}
// Fetch events, births, and deaths that happened on the current date.
try {
let onToday = await OnThisDay()
console.log('All Data:', onToday.getAll());
console.log('Births:', onToday.getBirths());
console.log('Deaths:', onToday.getDeaths());
console.log('Events:', onToday.getEvents());
} catch (error) {
console.log(error.message)
}
Contributing
Want to improve this? Create a pull request with detailed changes / improvements! If approved you will be added to the list of contributors of this awesome project!
See also the list of contributors who participate in this project.
License
This library is open-source and available under the MIT License. See the LICENSE file for more details.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK