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

remit

Package Overview
Dependencies
Maintainers
4
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remit - npm Package Compare versions

Comparing version 2.4.0 to 2.4.1

15

lib/Emitter.js

@@ -174,5 +174,12 @@ const opentracing = require('opentracing')

if (opts.hasOwnProperty('delay')) {
parsedOpts.delay = (typeof opts.delay === 'string')
? ms(opts.delay)
: opts.delay
if (typeof opts.delay === 'string') {
parsedOpts.delay = ms(opts.delay)
parsedOpts.schedule = null
} else if (opts.delay instanceof Date && !isNaN(opts.delay)) {
parsedOpts.delay = null
parsedOpts.schedule = opts.delay
} else {
parsedOpts.delay = opts.delay
parsedOpts.schedule = null
}
}

@@ -192,3 +199,3 @@

) {
throw new Error('Invalid schedule date or delay duration when attempting to send a delayed emission')
throw new Error('Invalid delay date or duration when attempting to send a delayed emission')
}

@@ -195,0 +202,0 @@

{
"name": "remit",
"version": "2.4.0",
"version": "2.4.1",
"description": "A small set of functionality used to create microservices that don't need to be aware of one-another's existence.",

@@ -17,12 +17,12 @@ "main": "index.js",

"dependencies": {
"amqplib": "^0.5.1",
"callable-instance": "^1.0.0",
"amqplib": "^0.5.3",
"callable-instance": "^1.0.1",
"callsite": "^1.0.0",
"cls-hooked": "^4.2.2",
"eventemitter3": "^3.0.0",
"generic-pool": "^3.1.7",
"eventemitter3": "^3.1.0",
"generic-pool": "^3.7.1",
"ms": "^2.1.1",
"opentracing": "^0.14.3",
"serialize-error": "^2.1.0",
"ulid": "^2.2.0"
"serialize-error": "^4.0.0",
"ulid": "^2.3.0"
},

@@ -60,7 +60,7 @@ "repository": {

"devDependencies": {
"chai": "^4.1.1",
"coveralls": "^3.0.0",
"mocha": "^5.0.0",
"nyc": "^11.1.0"
"chai": "^4.2.0",
"coveralls": "^3.0.3",
"mocha": "^6.0.2",
"nyc": "^13.3.0"
}
}

@@ -76,8 +76,22 @@ /* global describe, it, before, expect */

it('should parse timestrings in a delay option', function () {
it('should parse timestrings and dates in a delay option', function () {
const emit = emitRemit.emit('options-timestring-test')
emit.options({delay: 20000})
expect(emit._options).to.have.property('delay', 20000)
expect(emit._options).to.have.property('schedule', null)
const d = new Date()
d.setSeconds(d.getSeconds() + 15)
emit.options({delay: d})
expect(emit._options).to.have.property('delay', null)
expect(emit._options).to.have.property('schedule', d)
emit.options({delay: '30m'})
expect(emit._options).to.have.property('delay', 1800000)
expect(emit._options).to.have.property('schedule', null)
emit.options({delay: '2s'})
expect(emit._options).to.have.property('delay', 2000)
expect(emit._options).to.have.property('schedule', null)
})

@@ -182,3 +196,3 @@

.emit('emit-usage')
.options({schedule: d})
.options({delay: d})
.send({bar: 'baz'})

@@ -185,0 +199,0 @@

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