blogs_modules
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -8,6 +8,6 @@ /** | ||
* req | ||
* .on('data', function(buffer){ | ||
* .on('data', (buffer) => { | ||
* bs.push(buffer); | ||
* }) | ||
* .once('end', function(){ | ||
* .once('end', () => { | ||
* var data = bs.toBuffer(); | ||
@@ -14,0 +14,0 @@ * }); |
@@ -93,11 +93,11 @@ var DONE = 1; | ||
var data = this.data; | ||
var queues = this.queues; | ||
var queue = queues[key]; | ||
var queue = this.queues[key]; | ||
if (queue === DONE) { | ||
callback(null, data[key].value); | ||
} else if (isUndef(queue)) { | ||
queue = queues[key] = [callback]; | ||
this.queues[key] = [callback]; | ||
getter((error, value, ttl = 60) => { | ||
queue = this.queues[key]; | ||
if (!error) { | ||
queues[key] = DONE; | ||
this.queues[key] = DONE; | ||
data[key] = { | ||
@@ -108,5 +108,5 @@ value: value, | ||
} | ||
queue.forEach((callback) => { | ||
callback(error, value); | ||
}); | ||
while (0 < queue.length) { | ||
queue.pop().call(null, error, value); | ||
} | ||
}); | ||
@@ -113,0 +113,0 @@ } else { |
@@ -30,3 +30,3 @@ var BufferStack = require('./-buffer-stack'); | ||
pipe.emit('data', bs.toBuffer()); | ||
pipe.timer = setTimeout(function () { | ||
pipe.timer = setTimeout(() => { | ||
sendData(pipe); | ||
@@ -33,0 +33,0 @@ }, pipe.interval); |
@@ -8,3 +8,3 @@ var camelCase = require('./camel-case'); | ||
if (arg) { | ||
arg.replace(/^--(.*)$/, function (match, body) { | ||
arg.replace(/^--(.*)$/, (match, body) => { | ||
key = camelCase(body); | ||
@@ -19,3 +19,3 @@ }); | ||
} else { | ||
value.forEach(function (arg) { | ||
value.forEach((arg) => { | ||
args[/\//.test(arg) ? arg : camelCase(arg)] = true; | ||
@@ -27,3 +27,3 @@ }); | ||
}; | ||
(global.argv || process.argv).forEach(function (arg) { | ||
(global.argv || process.argv).forEach((arg) => { | ||
var newKey = getKey(arg); | ||
@@ -30,0 +30,0 @@ if (newKey) { |
@@ -13,5 +13,5 @@ /** | ||
module.exports = function (x) { | ||
return x.replace(/([^a-zA-Z0-9])([a-zA-Z0-9])/g, function (match, p, q) { | ||
return x.replace(/([^a-zA-Z0-9])([a-zA-Z0-9])/g, (match, p, q) => { | ||
return q.toUpperCase(); | ||
}); | ||
}; |
@@ -31,3 +31,3 @@ var util = require('util'); | ||
return function (...args) { | ||
return toArray(args).reduce(function (previous, item, index) { | ||
return toArray(args).reduce((previous, item, index) => { | ||
switch (typeof item) { | ||
@@ -72,3 +72,3 @@ case 'string': | ||
'white' | ||
].forEach(function (color, index) { | ||
].forEach((color, index) => { | ||
var upper = color.toUpperCase(); | ||
@@ -105,3 +105,3 @@ var fore = emphasis[upper] = e(30 + index); | ||
off: 27 | ||
}].forEach(function (item) { | ||
}].forEach((item) => { | ||
var name = item.name; | ||
@@ -108,0 +108,0 @@ var upper = name.toUpperCase(); |
@@ -12,5 +12,5 @@ var LOGLEVEL_DEBUG = 0; | ||
*/ | ||
function getLevel() { | ||
var getLevel = function () { | ||
return parseInt(process.env.logLevel, 10); | ||
} | ||
}; | ||
@@ -22,5 +22,5 @@ /** | ||
*/ | ||
function setLevel(level) { | ||
var setLevel = function (level) { | ||
process.env.logLevel = level; | ||
} | ||
}; | ||
@@ -37,6 +37,6 @@ class Logger { | ||
log.LOGLEVEL_SILENT = LOGLEVEL_SILENT; | ||
log.print = prefix ? function (...args) { | ||
log.print = prefix ? (...args) => { | ||
args.unshift(prefix); | ||
console.log.apply(console, args); | ||
} : function (...args) { | ||
} : (...args) => { | ||
console.log.apply(console, args); | ||
@@ -43,0 +43,0 @@ }; |
{ | ||
"name": "blogs_modules", | ||
"version": "0.0.1", | ||
"description": "utility functions for blogs", | ||
"author": "Kei Ito", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/blogsjs/blogs_modules.git" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"async": "*" | ||
} | ||
"name": "blogs_modules", | ||
"version": "0.0.2", | ||
"description": "utility functions for blogs", | ||
"author": "Kei Ito", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/blogsjs/blogs_modules.git" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"async": "*" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*" | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
# blogs_modules | ||
# blogs_modules [![Build Status](https://travis-ci.org/blogsjs/blogs_modules.svg?branch=master)](https://travis-ci.org/blogsjs/blogs_modules) |
var fs = require('fs'); | ||
var path = require('path'); | ||
var assert = require('assert'); | ||
var constants = require('../constants'); | ||
var modules = require('../'); | ||
var modules = require('..'); | ||
var camelCase = require('../lib/camel-case'); | ||
@@ -9,5 +10,5 @@ var removeExt = require('../lib/remove-ext'); | ||
describe('modules', function () { | ||
constants.targets.forEach(function (name) { | ||
var files = fs.readdirSync(__dirname, '..', name); | ||
files.forEach(function (name) { | ||
constants.targets.forEach((name) => { | ||
var files = fs.readdirSync(path.join(__dirname, '..', name)); | ||
files.forEach((name) => { | ||
name = camelCase(removeExt(name)); | ||
@@ -14,0 +15,0 @@ if (name === 'index') { |
40187
50
1589
1
15