Comparing version 1.1.0 to 1.1.1
30
index.js
@@ -9,11 +9,11 @@ 'use strict'; | ||
var runtimes = hasNativeWeakMap ? new WeakMap() : new WM(); | ||
var runtimes = new WM(); | ||
function isFunction(fn){ | ||
function isFunction(fn) { | ||
return (typeof fn === 'function'); | ||
} | ||
function isExtensible(fn){ | ||
if(hasNativeWeakMap){ | ||
// native weakmap doesn't care about extensible | ||
function isExtensible(fn) { | ||
if (hasNativeWeakMap) { | ||
// Native weakmap doesn't care about extensible | ||
return true; | ||
@@ -25,3 +25,3 @@ } | ||
function lastRun(fn, timeResolution){ | ||
function lastRun(fn, timeResolution) { | ||
assert(isFunction(fn), 'Only functions can check lastRun'); | ||
@@ -32,20 +32,12 @@ assert(isExtensible(fn), 'Only extensible functions can check lastRun'); | ||
if(time == null){ | ||
if (time == null) { | ||
return; | ||
} | ||
if(timeResolution == null){ | ||
timeResolution = defaultResolution(); | ||
} else { | ||
timeResolution = parseInt(timeResolution, 10); | ||
} | ||
var resolution = defaultResolution(timeResolution); | ||
if(timeResolution){ | ||
return time - (time % timeResolution); | ||
} | ||
return time; | ||
return time - (time % resolution); | ||
} | ||
function capture(fn, timestamp){ | ||
function capture(fn, timestamp) { | ||
assert(isFunction(fn), 'Only functions can be captured'); | ||
@@ -59,3 +51,3 @@ assert(isExtensible(fn), 'Only extensible functions can be captured'); | ||
function release(fn){ | ||
function release(fn) { | ||
assert(isFunction(fn), 'Only functions can be captured'); | ||
@@ -62,0 +54,0 @@ assert(isExtensible(fn), 'Only extensible functions can be captured'); |
{ | ||
"name": "last-run", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Capture and retrieve the last time a function was run", | ||
"author": "Blaine Bublitz <blaine@iceddev.com> (http://iceddev.com)", | ||
"contributors": [], | ||
"repository": "phated/last-run", | ||
"author": "Gulp Team <team@gulpjs.com> (http://gulpjs.com/)", | ||
"contributors": [ | ||
"Blaine Bublitz <blaine.bublitz@gmail.com>" | ||
], | ||
"repository": "gulpjs/last-run", | ||
"license": "MIT", | ||
@@ -18,11 +20,21 @@ "engines": { | ||
"scripts": { | ||
"test": "lab -cvL" | ||
"lint": "eslint . && jscs index.js test/", | ||
"pretest": "npm run lint", | ||
"test": "mocha --async-only", | ||
"cover": "istanbul cover _mocha --report lcovonly", | ||
"coveralls": "npm run cover && istanbul-coveralls" | ||
}, | ||
"dependencies": { | ||
"default-resolution": "^1.0.0", | ||
"es6-weak-map": "^1.0.1" | ||
"default-resolution": "^2.0.0", | ||
"es6-weak-map": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"code": "^1.4.0", | ||
"lab": "^5.5.1" | ||
"eslint": "^1.7.3", | ||
"eslint-config-gulp": "^2.0.0", | ||
"expect": "^1.19.0", | ||
"istanbul": "^0.4.3", | ||
"istanbul-coveralls": "^1.0.3", | ||
"jscs": "^2.3.5", | ||
"jscs-preset-gulp": "^1.0.0", | ||
"mocha": "^2.4.5" | ||
}, | ||
@@ -29,0 +41,0 @@ "keywords": [ |
@@ -0,6 +1,12 @@ | ||
<p align="center"> | ||
<a href="http://gulpjs.com"> | ||
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png"> | ||
</a> | ||
</p> | ||
# last-run | ||
[![Travis Build Status](https://img.shields.io/travis/phated/last-run/master.svg?label=travis&style=flat-square)](https://travis-ci.org/phated/last-run) | ||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] | ||
Capture and retrieve the last time a function was run | ||
Capture and retrieve the last time a function was run. | ||
@@ -41,4 +47,4 @@ ## Usage | ||
The default time resolution is 1000 on node v0.10, 0 on node 0.11+ and iojs. | ||
More information at [`default-resolution`](https://github.com/phated/default-resolution) and | ||
[undertaker PR #17](https://github.com/phated/undertaker/pull/17#issuecomment-82374512). | ||
More information at [`default-resolution`][default-resolution] and | ||
[undertaker PR #17][undertaker-17]. | ||
@@ -58,1 +64,20 @@ ### lastRun.capture(fn, [timestamp]) | ||
MIT | ||
[default-resolution]: https://github.com/gulpjs/default-resolution | ||
[undertaker-17]: https://github.com/gulpjs/undertaker/pull/17#issuecomment-82374512 | ||
[downloads-image]: http://img.shields.io/npm/dm/last-run.svg | ||
[npm-url]: https://www.npmjs.com/package/last-run | ||
[npm-image]: http://img.shields.io/npm/v/last-run.svg | ||
[travis-url]: https://travis-ci.org/gulpjs/last-run | ||
[travis-image]: http://img.shields.io/travis/gulpjs/last-run.svg?label=travis-ci | ||
[appveyor-url]: https://ci.appveyor.com/project/gulpjs/last-run | ||
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/last-run.svg?label=appveyor | ||
[coveralls-url]: https://coveralls.io/r/gulpjs/last-run | ||
[coveralls-image]: http://img.shields.io/coveralls/gulpjs/last-run/master.svg | ||
[gitter-url]: https://gitter.im/gulpjs/gulp | ||
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg |
Sorry, the diff of this file is not supported yet
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
6456
82
8
40
+ Addeddefault-resolution@2.0.0(transitive)
+ Addedes6-weak-map@2.0.3(transitive)
- Removedd@0.1.1(transitive)
- Removeddefault-resolution@1.0.1(transitive)
- Removedes6-iterator@0.1.3(transitive)
- Removedes6-symbol@2.0.1(transitive)
- Removedes6-weak-map@1.0.2(transitive)
Updateddefault-resolution@^2.0.0
Updatedes6-weak-map@^2.0.1