nearest-periodic-value
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "nearest-periodic-value.js", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"homepage": "https://github.com/jmeas/nearest-periodic-value.js", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -1,9 +0,3 @@ | ||
(function (root, factory) { | ||
if (typeof define === "function" && define.amd) { | ||
define([], factory); | ||
} else if (typeof exports !== "undefined") { | ||
module.exports = factory(); | ||
} else { | ||
root.nearestPeriodicValue = factory(); | ||
} | ||
(function (global, factory) { | ||
typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global.nearestPeriodicValue = factory(); | ||
})(this, function () { | ||
@@ -14,3 +8,3 @@ "use strict"; | ||
var nearestPeriodicValue = function (point, value, period) { | ||
function nearestPeriodicValue(point, value, period) { | ||
var relation = (value - point) / period; | ||
@@ -31,9 +25,8 @@ | ||
return mod + (value - period * Math.round(relation)); | ||
}; | ||
} | ||
var nearest_periodic_value = nearestPeriodicValue; | ||
return nearestPeriodicValue; | ||
return nearest_periodic_value; | ||
}); | ||
//# sourceMappingURL=nearest-periodic-value.js.map | ||
//# sourceMappingURL=./nearest-periodic-value.js.map |
@@ -1,2 +0,2 @@ | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b):"undefined"!=typeof exports?module.exports=b():a.nearestPeriodicValue=b()}(this,function(){"use strict";var a=function(a,b,c){var d=(b-a)/c,e=!(d%.5)&&d%1,f=e?c:0;return f+(b-c*Math.round(d))};return a}); | ||
!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.nearestPeriodicValue=b()}(this,function(){"use strict";function a(a,b,c){var d=(b-a)/c,e=!(d%.5)&&d%1,f=e?c:0;return f+(b-c*Math.round(d))}var b=a;return b}); | ||
//# sourceMappingURL=nearest-periodic-value.min.js.map |
@@ -5,3 +5,7 @@ var gulp = require('gulp'); | ||
}); | ||
const fs = require('fs'); | ||
const del = require('del'); | ||
const path = require('path'); | ||
const isparta = require('isparta'); | ||
const esperanto = require('esperanto'); | ||
const browserify = require('browserify'); | ||
@@ -33,2 +37,3 @@ const runSequence = require('run-sequence'); | ||
return gulp.src(['src/**/*.js', '!src/wrapper.js']) | ||
.pipe($.plumber()) | ||
.pipe($.jshint()) | ||
@@ -43,2 +48,3 @@ .pipe($.jshint.reporter('jshint-stylish')) | ||
return gulp.src(['test/unit/**/*.js']) | ||
.pipe($.plumber()) | ||
.pipe($.jshint()) | ||
@@ -51,18 +57,33 @@ .pipe($.jshint.reporter('jshint-stylish')) | ||
// Build two versions of the library | ||
gulp.task('build', ['lint:src', 'clean'], function() { | ||
return gulp.src('src/wrapper.js') | ||
.pipe($.template(config)) | ||
.pipe($.preprocess()) | ||
.pipe($.rename(config.exportFileName + '.js')) | ||
.pipe($.sourcemaps.init()) | ||
.pipe($.to5({blacklist: ['useStrict'], modules: 'ignore'})) | ||
.pipe($.sourcemaps.write('./')) | ||
.pipe(gulp.dest(config.destinationFolder)) | ||
.pipe($.filter(['*', '!**/*.js.map'])) | ||
.pipe($.rename(config.exportFileName + '.min.js')) | ||
.pipe($.uglifyjs({ | ||
outSourceMap: true, | ||
inSourceMap: config.destinationFolder + '/' + config.exportFileName + '.js.map', | ||
})) | ||
.pipe(gulp.dest(config.destinationFolder)); | ||
gulp.task('build', ['lint:src', 'clean'], function(done) { | ||
esperanto.bundle({ | ||
base: 'src', | ||
entry: config.entryFileName, | ||
}).then(function(bundle) { | ||
res = bundle.toUmd({ | ||
sourceMap: true, | ||
sourceMapSource: config.entryFileName + '.js', | ||
sourceMapFile: config.exportFileName + '.js', | ||
name: config.exportVarName | ||
}); | ||
// Write the generated sourcemap | ||
fs.mkdirSync(config.destinationFolder); | ||
fs.writeFileSync(path.join(config.destinationFolder, config.exportFileName + '.js'), res.map.toString()); | ||
$.file(config.exportFileName + '.js', res.code, { src: true }) | ||
.pipe($.plumber()) | ||
.pipe($.sourcemaps.init({ loadMaps: true })) | ||
.pipe($.to5({ blacklist: ['useStrict'] })) | ||
.pipe($.sourcemaps.write('./', {addComment: false})) | ||
.pipe(gulp.dest(config.destinationFolder)) | ||
.pipe($.filter(['*', '!**/*.js.map'])) | ||
.pipe($.rename(config.exportFileName + '.min.js')) | ||
.pipe($.uglifyjs({ | ||
outSourceMap: true, | ||
inSourceMap: config.destinationFolder + '/' + config.exportFileName + '.js.map', | ||
})) | ||
.pipe(gulp.dest(config.destinationFolder)) | ||
.on('end', done); | ||
}); | ||
}); | ||
@@ -75,3 +96,4 @@ | ||
return gulp.src(['src/**/*.js', '!src/wrapper.js']) | ||
.pipe($.to5({modules: 'common'})) | ||
.pipe($.plumber()) | ||
.pipe($.to5({modules: 'common', loose: ['es6.modules']})) | ||
.pipe(gulp.dest('tmp')) | ||
@@ -87,2 +109,7 @@ .pipe($.filter([config.entryFileName + '.js'])) | ||
return bundleStream | ||
.on('error', function(err){ | ||
console.log(err.message); | ||
this.emit('end'); | ||
}) | ||
.pipe($.plumber()) | ||
.pipe(source('./tmp/__spec-build.js')) | ||
@@ -95,3 +122,5 @@ .pipe(gulp.dest('')) | ||
gulp.src(['src/*.js', '!src/wrapper.js']) | ||
.pipe($.istanbul()) | ||
.pipe($.plumber()) | ||
.pipe($.istanbul({ instrumenter: isparta.Instrumenter })) | ||
.pipe($.istanbul.hookRequire()) | ||
.on('finish', function() { | ||
@@ -106,2 +135,3 @@ return test() | ||
return gulp.src(['test/setup/node.js', 'test/unit/**/*.js'], {read: false}) | ||
.pipe($.plumber()) | ||
.pipe($.mocha({reporter: 'dot', globals: config.mochaGlobals})); | ||
@@ -122,13 +152,9 @@ }; | ||
// This is used when testing in the browser. Reloads the tests | ||
// when the lib, or the tests themselves, change. | ||
gulp.task('watch', function() { | ||
// Set up a livereload environment for our spec runner | ||
gulp.task('test:browser', ['build_in_sequence'], function() { | ||
$.livereload.listen({port: 35729, host: 'localhost', start: true}); | ||
gulp.watch(['src/**/*.js', 'test/**/*', '.jshintrc', 'test/.jshintrc', 'config/index.json'], ['build_in_sequence']); | ||
return gulp.watch(['src/**/*.js', 'test/**/*', '.jshintrc', 'test/.jshintrc', 'config/index.json'], ['build_in_sequence']); | ||
}); | ||
// Set up a livereload environment for our spec runner | ||
gulp.task('test:browser', ['build_in_sequence', 'watch']); | ||
// An alias of test | ||
gulp.task('default', ['test']); |
{ | ||
"name": "nearest-periodic-value", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Find the nearest value of a discrete periodic function, given a point.", | ||
@@ -29,10 +29,13 @@ "main": "dist/nearest-periodic-value.js", | ||
"devDependencies": { | ||
"6to5": "^2.12.6", | ||
"6to5": "^3.3.3", | ||
"browserify": "^8.1.1", | ||
"chai": "^1.10.0", | ||
"del": "^1.1.1", | ||
"esperanto": "^0.6.7", | ||
"gulp": "^3.8.10", | ||
"gulp-6to5": "^2.0.2", | ||
"gulp-6to5": "^3.0.0", | ||
"gulp-file": "^0.2.0", | ||
"gulp-filter": "^2.0.0", | ||
"gulp-istanbul": "git://github.com/jmeas/gulp-istanbul.git#isparta", | ||
"gulp-intercept": "^0.1.0", | ||
"gulp-istanbul": "^0.6.0", | ||
"gulp-jshint": "^1.9.0", | ||
@@ -43,2 +46,3 @@ "gulp-livereload": "^3.4.0", | ||
"gulp-notify": "^2.1.0", | ||
"gulp-plumber": "^0.6.6", | ||
"gulp-preprocess": "^1.2.0", | ||
@@ -49,2 +53,3 @@ "gulp-rename": "^1.2.0", | ||
"gulp-uglifyjs": "^0.5.0", | ||
"isparta": "^1.0.1", | ||
"jshint-stylish": "^1.0.0", | ||
@@ -51,0 +56,0 @@ "mocha": "^2.1.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
25755
396
29
20
2