Comparing version 0.1.4 to 0.1.5
120
Jakefile.js
/*jshint nomen:false */ | ||
/*globals require, console, complete, __dirname, process */ | ||
(function () { | ||
'use strict'; | ||
'use strict'; | ||
var exec = require('child_process').exec, | ||
var exec = require('child_process').exec, | ||
commands = { | ||
minify: './node_modules/.bin/uglifyjs ./src/css-time.js --compress --mangle --output ./src/css-time.min.js', | ||
test: './node_modules/.bin/mocha --ui tdd --reporter spec --colors --slow 50 ./test/css-time', | ||
lint: './node_modules/.bin/jshint ./src/css-time.js --config config/jshint.json', | ||
prepare: 'npm install' | ||
}; | ||
commands = { | ||
minify: './node_modules/.bin/uglifyjs ./src/css-time.js --compress --mangle --output ./src/css-time.min.js', | ||
test: './node_modules/.bin/mocha --ui tdd --reporter spec --colors --slow 50 ./test', | ||
lint: './node_modules/.bin/jshint ./src/css-time.js --config config/jshint.json', | ||
prepare: 'npm install' | ||
}; | ||
desc('Minify the source code for deployment.'); | ||
task('minify', [ 'prepare', 'lint', 'test' ], function () { | ||
runTask(minify, 'Minifying...'); | ||
}, { | ||
async: true | ||
}); | ||
desc('Minify the source code for deployment.'); | ||
task('minify', [ 'prepare', 'lint', 'test' ], function () { | ||
runTask(minify, 'Minifying...'); | ||
}, { | ||
async: true | ||
}); | ||
desc('Run the unit tests.'); | ||
task('test', [ 'prepare' ], function () { | ||
runTask(test, 'Testing...'); | ||
}, { | ||
async: true | ||
}); | ||
desc('Run the unit tests.'); | ||
task('test', [ 'prepare' ], function () { | ||
runTask(test, 'Testing...'); | ||
}, { | ||
async: true | ||
}); | ||
desc('Lint the source code.'); | ||
task('lint', [ 'prepare' ], function () { | ||
runTask(lint, 'Linting...'); | ||
}, { | ||
async: true | ||
}); | ||
desc('Lint the source code.'); | ||
task('lint', [ 'prepare' ], function () { | ||
runTask(lint, 'Linting...'); | ||
}, { | ||
async: true | ||
}); | ||
desc('Install dependencies.'); | ||
task('prepare', function () { | ||
runTask(prepare, 'Preparing the build environment...'); | ||
}, { | ||
async: true | ||
}); | ||
desc('Install dependencies.'); | ||
task('prepare', function () { | ||
runTask(prepare, 'Preparing the build environment...'); | ||
}, { | ||
async: true | ||
}); | ||
function runTask (operation, message) { | ||
console.log(message); | ||
operation(); | ||
} | ||
function runTask (operation, message) { | ||
console.log(message); | ||
operation(); | ||
} | ||
function minify () { | ||
runCommand(commands.minify); | ||
} | ||
function minify () { | ||
runCommand(commands.minify); | ||
} | ||
function test () { | ||
runCommand(commands.test); | ||
} | ||
function test () { | ||
runCommand(commands.test); | ||
} | ||
function lint () { | ||
runCommand(commands.lint); | ||
} | ||
function lint () { | ||
runCommand(commands.lint); | ||
} | ||
function prepare () { | ||
runCommand(commands.prepare); | ||
} | ||
function prepare () { | ||
runCommand(commands.prepare); | ||
} | ||
function runCommand (command) { | ||
exec(command, { cwd: __dirname }, function (error, stdout, stderr) { | ||
console.log(stdout); | ||
console.log(stderr); | ||
if (typeof error === 'object' && error !== null) { | ||
console.log(error.message); | ||
process.exit(1); | ||
} | ||
complete(); | ||
}); | ||
} | ||
}()); | ||
function runCommand (command) { | ||
exec(command, { cwd: __dirname }, function (error, stdout, stderr) { | ||
console.log(stdout); | ||
console.log(stderr); | ||
if (typeof error === 'object' && error !== null) { | ||
console.log(error.message); | ||
process.exit(1); | ||
} | ||
complete(); | ||
}); | ||
} | ||
{ | ||
"name": "css-time", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"author": "Phil Booth <pmbooth@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "A tiny library that converts milliseconds to and from CSS time.", |
@@ -33,21 +33,13 @@ # css-time.js | ||
#### Via CommonJS | ||
Both | ||
CommonJS | ||
(e.g. if you're using [Browserify]) | ||
and AMD | ||
(e.g. if you're using [Require.js][require]) | ||
loading styles are supported. | ||
If neither system is detected, | ||
the library defaults to | ||
exporting it's interface globally | ||
as `cssTime`. | ||
``` | ||
var cssTime = require('css-time'); | ||
``` | ||
#### Via AMD | ||
``` | ||
require('css-time', function (cssTime) { | ||
}); | ||
``` | ||
#### Globally | ||
``` | ||
<script src="css-time.min.js"></script> | ||
``` | ||
### Calling the exported functions | ||
@@ -54,0 +46,0 @@ |
@@ -1,2 +0,2 @@ | ||
/*globals define, module, window, setTimeout */ | ||
/*globals define, module */ | ||
@@ -6,3 +6,3 @@ // This module contains functions for converting milliseconds | ||
(function () { | ||
(function (globals) { | ||
'use strict'; | ||
@@ -47,10 +47,12 @@ | ||
if (typeof define === 'function' && define.amd) { | ||
define(['css-time'], functions); | ||
define(function () { | ||
return functions; | ||
}); | ||
} else if (typeof module === 'object' && module !== null) { | ||
module.exports = functions; | ||
} else { | ||
window.cssTime = functions; | ||
globals.cssTime = functions; | ||
} | ||
} | ||
}()); | ||
}(this)); | ||
@@ -1,1 +0,1 @@ | ||
(function(){"use strict";function e(e){var n=t.exec(e);return parseFloat(n[1])*("s"===n[3]?1e3:1)}function n(e){if("number"!=typeof e||isNaN(e))throw Error("Invalid milliseconds");return e+"ms"}function o(){"function"==typeof define&&define.amd?define(["css-time"],i):"object"==typeof module&&null!==module?module.exports=i:window.cssTime=i}var t=/^([\-\+]?[0-9]+(\.[0-9]+)?)(m?s)$/,i={from:e,to:n};o()})(); | ||
(function(e){"use strict";function n(e){var n=r.exec(e);if(null===n)throw Error("Invalid CSS time");return parseFloat(n[1])*("s"===n[3]?1e3:1)}function o(e){if("number"!=typeof e||isNaN(e))throw Error("Invalid milliseconds");return e+"ms"}function t(){"function"==typeof define&&define.amd?define(function(){return i}):"object"==typeof module&&null!==module?module.exports=i:e.cssTime=i}var r=/^([\-\+]?[0-9]+(\.[0-9]+)?)(m?s)$/,i={from:n,to:o};t()})(this); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11811
106