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

timer-machine

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timer-machine - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

.travis.yml

16

lib/timer.js

@@ -149,2 +149,18 @@ /**

/**
* Return a string representation of the timer.
* @return {String}
*/
Timer.prototype.toString = function () {
return this.time() + 'ms'
}
/**
* Return a numeric value of the timer in milliseconds.
* @return {Number}
*/
Timer.prototype.valueOf = function () {
return this.time()
}
/**
* Get the current time in milliseconds.

@@ -151,0 +167,0 @@ * @return {Number}

5

package.json
{
"name": "timer-machine",
"version": "0.1.0",
"version": "1.0.0",
"description": "A lightweight, pause-able timer class",
"main": "lib/timer.js",
"scripts": {
"test": "mocha"
"test": "jshint lib test && mocha"
},

@@ -26,2 +26,3 @@ "repository": {

"devDependencies": {
"jshint": "^2.5.2",
"mocha": "^1.20.1",

@@ -28,0 +29,0 @@ "should": "^4.0.4",

2

test/events.js

@@ -0,1 +1,3 @@

/*jshint expr: true*/
var should = require('should')

@@ -2,0 +4,0 @@ var Timer = require('../lib/timer')

@@ -0,1 +1,3 @@

/*jshint freeze: false*/
var originalGetTime = Date.prototype.getTime

@@ -2,0 +4,0 @@

@@ -0,1 +1,3 @@

/*jshint expr: true*/
var should = require('should')

@@ -2,0 +4,0 @@ var Timer = require('../lib/timer')

var should = require('should')
var sinon = require('sinon')
var Timer = require('../lib/timer')
var getTimeMock = require('./mocks/date-get-time')
var getTimeMock = require('./mocks/date-get-time')
var timerTimeMock = require('./mocks/timer-time')

@@ -190,2 +191,25 @@

describe('toString prototype method', function () {
it('should return a string', function () {
timer.toString().should.be.a.String
})
it('should be a whole number followed by"ms"', function () {
timer.toString().should.match(/\d+ms/)
})
})
describe('valueOf prototype method', function () {
it('should be an alias of time()', function () {
var expected = {}
sinon.stub(timer, 'time').returns(expected)
timer.valueOf().should.equal(expected)
timer.time.restore()
})
})
})

Sorry, the diff of this file is not supported yet

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