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

timetable-fns

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timetable-fns - npm Package Compare versions

Comparing version 0.1.13 to 0.1.14

LICENSE

4

bench.js
const benchmark = require('benchmark')
const chalk = require('chalk')
const dateFns = require('date-fns')
const moment = require('moment')

@@ -58,2 +59,5 @@ const timetable = require('./index')

})
.add('date-fns', function () {
dateFns.differenceInCalendarDays(new Date(2019, 8, 17), new Date(1912, 3, 14))
})
.run()

@@ -1,2 +0,10 @@

var moment = require('moment')
// Optionally require moment (only needed for the conversion helpers)
var moment = null
try {
moment = require.resolve('moment')
} catch (e) {
if (e.code !== 'MODULE_NOT_FOUND') {
throw e
}
}

@@ -66,2 +74,5 @@ var reDate = /^(\d{4})-(\d{2})-(\d{2})$/

function coerce (dt) {
if (!moment) {
throw new Error("Cannot find module 'moment': please install manually to use the conversion helpers")
}
return moment.isMoment(dt) ? dt.format('YYYY-MM-DD') : dt

@@ -71,2 +82,5 @@ }

function coerceTime (dt) {
if (!moment) {
throw new Error("Cannot find module 'moment': please install manually to use the conversion helpers")
}
return moment.isMoment(dt) ? dt.format('HH:mm') : dt

@@ -76,2 +90,5 @@ }

function format (dt) {
if (!moment) {
throw new Error("Cannot find module 'moment': please install manually to use the conversion helpers")
}
return moment(dt, 'YYYY-MM-DD', true).format('L')

@@ -78,0 +95,0 @@ }

9

package.json
{
"name": "timetable-fns",
"version": "0.1.13",
"version": "0.1.14",
"description": "Useful date and time utility functions for working with timetables.",

@@ -21,9 +21,10 @@ "main": "index.js",

"private": false,
"dependencies": {
"moment": "^2.24.0"
"peerDependencies": {
"moment": "^2.0.0"
},
"devDependencies": {
"benchmark": "^2.1.4",
"chalk": "^2.4.2"
"chalk": "^2.4.2",
"date-fns": "^1.30.1"
}
}

@@ -65,9 +65,11 @@ Handy library of utility functions for working with timetables (such as flight or train schedules).

timetable x 1,280,728 ops/sec ±1.92% (90 runs sampled)
moment x 52,968 ops/sec ±1.68% (90 runs sampled)
moment (reuse) x 519,085 ops/sec ±1.60% (92 runs sampled)
timetable x 1,334,060 ops/sec ±1.23% (88 runs sampled)
moment x 61,841 ops/sec ±0.57% (95 runs sampled)
moment (reuse) x 591,905 ops/sec ±1.90% (86 runs sampled)
date-fns x 375,733 ops/sec ±0.60% (92 runs sampled)
timetable was fastest
moment (reuse) was 59.3% ops/sec slower (factor 2.5)
moment was 95.9% ops/sec slower (factor 24.1)
moment (reuse) was 55.9% ops/sec slower (factor 2.3)
date-fns was 71.7% ops/sec slower (factor 3.5)
moment was 95.3% ops/sec slower (factor 21.4)
```

@@ -84,1 +86,2 @@

https://alcor.concordia.ca/~gpkatch/gdate-algorithm.html
[Archived Version](https://web.archive.org/web/20170507133619/https://alcor.concordia.ca/~gpkatch/gdate-algorithm.html)

Sorry, the diff of this file is not supported yet

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