Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

made module export a single function

  • Loading branch information...
commit 9c4ca1f405d3ff856295fb918a6ba52eb4d674cb 1 parent 75d22d2
@brianc authored
Showing with 16 additions and 18 deletions.
  1. +12 −14 lib/index.js
  2. +4 −4 test/initial-tests.js
View
26 lib/index.js
@@ -13,21 +13,19 @@ var executeAction = function(action, callback) {
doAction(action)
}
-module.exports = {
- bench: function(config) {
- return function(callback) {
- var i = 0;
- var doAction = function(action) {
- if(action) {
- action.repeat = config.repeat;
- executeAction(action, function() {
- doAction(config.actions[i++])
- })
- } else {
- callback();
- }
+module.exports = function(config) {
+ return function(callback) {
+ var i = 0;
+ var doAction = function(action) {
+ if(action) {
+ action.repeat = config.repeat;
+ executeAction(action, function() {
+ doAction(config.actions[i++])
+ })
+ } else {
+ callback();
}
- doAction(config.actions[i++]);
}
+ doAction(config.actions[i++]);
}
}
View
8 test/initial-tests.js
@@ -1,9 +1,9 @@
var helper = require(__dirname + '/test-helper');
-var bencher = require(__dirname + '/../lib');
+var bench = require(__dirname + '/../lib');
test('single repeat',function() {
var ran = 0;
- var benchmark = bencher.bench({
+ var benchmark = bench({
repeat: 1,
actions:[{
name: 'first',
@@ -23,7 +23,7 @@ test('single repeat',function() {
test('multiple itterations', function() {
var ran = 0;
- var benchmark = bencher.bench({
+ var benchmark = bench({
repeat: 3,
actions:[{
name: 'multiple',
@@ -46,7 +46,7 @@ test('multiple actions', function() {
var oneCalled = 0
var twoCalled = 0
var threeCalled = 0
- var benchmark = bencher.bench({
+ var benchmark = bench({
repeat: 3,
actions:[{
name: 'calling 1',
Please sign in to comment.
Something went wrong with that request. Please try again.