mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
more lint
This commit is contained in:
1 parent
ac58d3a665
commit
f22c248e4c
4 files changed
+91
-76
No files matched your search
+10
-10
@@ -2,7 +2,7 @@ var writeError = process.binding('stdio').writeError;
|
||||
|
||||
// console object
|
||||
var formatRegExp = /%[sdj]/g;
|
||||
function format (f) {
|
||||
function format(f) {
|
||||
if (typeof f !== 'string') {
|
||||
var objects = [], util = require('util');
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
@@ -14,7 +14,7 @@ function format (f) {
|
||||
|
||||
var i = 1;
|
||||
var args = arguments;
|
||||
var str = String(f).replace(formatRegExp, function (x) {
|
||||
var str = String(f).replace(formatRegExp, function(x) {
|
||||
switch (x) {
|
||||
case '%s': return args[i++];
|
||||
case '%d': return +args[i++];
|
||||
@@ -30,7 +30,7 @@ function format (f) {
|
||||
}
|
||||
|
||||
|
||||
exports.log = function () {
|
||||
exports.log = function() {
|
||||
process.stdout.write(format.apply(this, arguments) + '\n');
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ exports.log = function () {
|
||||
exports.info = exports.log;
|
||||
|
||||
|
||||
exports.warn = function () {
|
||||
exports.warn = function() {
|
||||
writeError(format.apply(this, arguments) + '\n');
|
||||
};
|
||||
|
||||
@@ -46,25 +46,25 @@ exports.warn = function () {
|
||||
exports.error = exports.warn;
|
||||
|
||||
|
||||
exports.dir = function(object){
|
||||
exports.dir = function(object) {
|
||||
var util = require('util');
|
||||
process.stdout.write(util.inspect(object) + '\n');
|
||||
};
|
||||
|
||||
|
||||
var times = {};
|
||||
exports.time = function(label){
|
||||
exports.time = function(label) {
|
||||
times[label] = Date.now();
|
||||
};
|
||||
|
||||
|
||||
exports.timeEnd = function(label){
|
||||
exports.timeEnd = function(label) {
|
||||
var duration = Date.now() - times[label];
|
||||
exports.log('%s: %dms', label, duration);
|
||||
};
|
||||
|
||||
|
||||
exports.trace = function(label){
|
||||
exports.trace = function(label) {
|
||||
// TODO probably can to do this better with V8's debug object once that is
|
||||
// exposed.
|
||||
var err = new Error;
|
||||
@@ -75,8 +75,8 @@ exports.trace = function(label){
|
||||
};
|
||||
|
||||
|
||||
exports.assert = function(expression){
|
||||
if(!expression){
|
||||
exports.assert = function(expression) {
|
||||
if (!expression) {
|
||||
var arr = Array.prototype.slice.call(arguments, 1);
|
||||
process.assert(false, format.apply(this, arr));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user