Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

comb

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

comb - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

docs-md/define.md

9

History.md

@@ -0,1 +1,10 @@

#0.1.4/2012-08-20
* added new short cut for configuring loggers
* Added changed logger.addAppender to accept a string and options to use Appender.createAppender method.
* comb.argsToArray now takes a slice argument to remove arguments.
* Added a resolve function to comb.Promise to handle node style callback resolution.
* Added a "promise" method to comb.Promise to allow for the return of an object that will not allow calling function to resolve the promise.
* Cleaned up promise using code to return the "promise" wrapper.
#0.1.3/2012-08-16

@@ -2,0 +11,0 @@ * new array methods

4

lib/base/array.js

@@ -200,4 +200,4 @@ var obj = require("./object"), misc = require("./misc"), string = require("./string"), isString = string.isString, number = require("./number.js");

* @example
* comb.array.max([{a : 1}, {a : 2}, {a : -2}], "a"); //{a : -2}
* comb.array.max([{a : 1}, {a : 2}, {a : -2}], function(a,b){
* comb.array.min([{a : 1}, {a : 2}, {a : -2}], "a"); //{a : -2}
* comb.array.min([{a : 1}, {a : 2}, {a : -2}], function(a,b){
* return a.a - b.a

@@ -204,0 +204,0 @@ * }); //{a : -2}

@@ -157,9 +157,9 @@ var string = require("./string").string;

*
* comb.date.getDaysInMonth(new Date(2006, 1, 1)) => 28
* comb.date.getDaysInMonth(new Date(2004, 1, 1)) => 29
* comb.date.getDaysInMonth(new Date(2006, 2, 1)) => 31
* comb.date.getDaysInMonth(new Date(2006, 3, 1)) => 30
* comb.date.getDaysInMonth(new Date(2006, 4, 1)) => 31
* comb.date.getDaysInMonth(new Date(2006, 5, 1)) => 30
* comb.date.getDaysInMonth(new Date(2006, 6, 1)) => 31
* comb.date.getDaysInMonth(new Date(2006, 1, 1)); //28
* comb.date.getDaysInMonth(new Date(2004, 1, 1)); //29
* comb.date.getDaysInMonth(new Date(2006, 2, 1)); //31
* comb.date.getDaysInMonth(new Date(2006, 3, 1)); //30
* comb.date.getDaysInMonth(new Date(2006, 4, 1)); //31
* comb.date.getDaysInMonth(new Date(2006, 5, 1)); //30
* comb.date.getDaysInMonth(new Date(2006, 6, 1)); //31
* @param {Date} dateObject the date containing the month

@@ -184,9 +184,9 @@ * @return {Number} the number of days in the month

*
* comb.date.isLeapYear(new Date(1600, 0, 1)) => true
* comb.date.isLeapYear(new Date(2004, 0, 1)) => true
* comb.date.isLeapYear(new Date(2000, 0, 1)) => true
* comb.date.isLeapYear(new Date(2006, 0, 1)) => false
* comb.date.isLeapYear(new Date(1900, 0, 1)) => false
* comb.date.isLeapYear(new Date(1800, 0, 1)) => false
* comb.date.isLeapYear(new Date(1700, 0, 1)) => false
* comb.date.isLeapYear(new Date(1600, 0, 1)); //true
* comb.date.isLeapYear(new Date(2004, 0, 1)); //true
* comb.date.isLeapYear(new Date(2000, 0, 1)); //true
* comb.date.isLeapYear(new Date(2006, 0, 1)); //false
* comb.date.isLeapYear(new Date(1900, 0, 1)); //false
* comb.date.isLeapYear(new Date(1800, 0, 1)); //false
* comb.date.isLeapYear(new Date(1700, 0, 1)); //false
*

@@ -210,6 +210,6 @@ * @param {Date} dateObject

* var monday = new Date(2006, 8, 25);
* comb.date.isWeekend(thursday)) => false
* comb.date.isWeekend(saturday) => true
* comb.date.isWeekend(sunday) => true
* comb.date.isWeekend(monday)) => false
* comb.date.isWeekend(thursday)); //false
* comb.date.isWeekend(saturday); //true
* comb.date.isWeekend(sunday); //true
* comb.date.isWeekend(monday)); //false
*

@@ -235,6 +235,6 @@ * @param {Date} dateObject the date to test

* dt.strLocale = 'Sun 17 Sep 2006 10:25:51 PM CDT';
* comb.date.getTimezoneName(dt) => 'CDT'
* comb.date.getTimezoneName(dt); //'CDT'
* dt.str = 'Sun Sep 17 2006 22:57:18 GMT-0500 (CDT)';
* dt.strLocale = 'Sun Sep 17 22:57:18 2006';
* comb.date.getTimezoneName(dt) => 'CDT'
* comb.date.getTimezoneName(dt); //'CDT'
* @param dateObject the date to get the timezone from

@@ -262,3 +262,3 @@ *

* d1.setHours(0);
* comb.date.compare(d1, d1) => 0
* comb.date.compare(d1, d1); // 0
*

@@ -270,4 +270,4 @@ * var d1 = new Date();

* d2.setHours(12);
* comb.date.compare(d1, d2, "date") => 1
* comb.date.compare(d1, d2, "datetime") => 1
* comb.date.compare(d1, d2, "date"); // 1
* comb.date.compare(d1, d2, "datetime"); // 1
*

@@ -279,4 +279,4 @@ * var d1 = new Date();

* d2.setHours(12);
* comb.date.compare(d2, d1, "date"), -1);
* comb.date.compare(d1, d2, "time"), -1);
* comb.date.compare(d2, d1, "date"); // -1
* comb.date.compare(d1, d2, "time"); //-1
*

@@ -314,38 +314,38 @@ * @param {Date|String} date1 the date to comapare

* var dtA = new Date(2005, 11, 27);
* comb.date.add(dtA, "year", 1) => new Date(2006, 11, 27);
* comb.date.add(dtA, "years", 1) => new Date(2006, 11, 27);
* comb.date.add(dtA, "year", 1); //new Date(2006, 11, 27);
* comb.date.add(dtA, "years", 1); //new Date(2006, 11, 27);
*
* dtA = new Date(2000, 0, 1);
* comb.date.add(dtA, "quarter", 1) => new Date(2000, 3, 1);
* comb.date.add(dtA, "quarters", 1) => new Date(2000, 3, 1);
* comb.date.add(dtA, "quarter", 1); //new Date(2000, 3, 1);
* comb.date.add(dtA, "quarters", 1); //new Date(2000, 3, 1);
*
* dtA = new Date(2000, 0, 1);
* comb.date.add(dtA, "month", 1) => new Date(2000, 1, 1);
* comb.date.add(dtA, "months", 1) => new Date(2000, 1, 1);
* comb.date.add(dtA, "month", 1); //new Date(2000, 1, 1);
* comb.date.add(dtA, "months", 1); //new Date(2000, 1, 1);
*
* dtA = new Date(2000, 0, 31);
* comb.date.add(dtA, "month", 1) => new Date(2000, 1, 29);
* comb.date.add(dtA, "months", 1) => new Date(2000, 1, 29);
* comb.date.add(dtA, "month", 1); //new Date(2000, 1, 29);
* comb.date.add(dtA, "months", 1); //new Date(2000, 1, 29);
*
* dtA = new Date(2000, 0, 1);
* comb.date.add(dtA, "week", 1) => new Date(2000, 0, 8);
* comb.date.add(dtA, "weeks", 1) => new Date(2000, 0, 8);
* comb.date.add(dtA, "week", 1); //new Date(2000, 0, 8);
* comb.date.add(dtA, "weeks", 1); //new Date(2000, 0, 8);
*
* dtA = new Date(2000, 0, 1);
* comb.date.add(dtA, "day", 1) => new Date(2000, 0, 2);
* comb.date.add(dtA, "day", 1); //new Date(2000, 0, 2);
*
* dtA = new Date(2000, 0, 1);
* comb.date.add(dtA, "weekday", 1) => new Date(2000, 0, 3);
* comb.date.add(dtA, "weekday", 1); //new Date(2000, 0, 3);
*
* dtA = new Date(2000, 0, 1, 11);
* comb.date.add(dtA, "hour", 1) => new Date(2000, 0, 1, 12);
* comb.date.add(dtA, "hour", 1); //new Date(2000, 0, 1, 12);
*
* dtA = new Date(2000, 11, 31, 23, 59);
* comb.date.add(dtA, "minute", 1) => new Date(2001, 0, 1, 0, 0);
* comb.date.add(dtA, "minute", 1); //new Date(2001, 0, 1, 0, 0);
*
* dtA = new Date(2000, 11, 31, 23, 59, 59);
* comb.date.add(dtA, "second", 1) => new Date(2001, 0, 1, 0, 0, 0);
* comb.date.add(dtA, "second", 1); //new Date(2001, 0, 1, 0, 0, 0);
*
* dtA = new Date(2000, 11, 31, 23, 59, 59, 999);
* comb.date.add(dtA, "millisecond", 1) => new Date(2001, 0, 1, 0, 0, 0, 0);
* comb.date.add(dtA, "millisecond", 1); //new Date(2001, 0, 1, 0, 0, 0, 0);
*

@@ -454,36 +454,36 @@ * @param {Date} date

* dtB = new Date(2006, 11, 27);
* comb.date.difference(dtA, dtB, "year") => 1
* comb.date.difference(dtA, dtB, "year"); //1
*
* dtA = new Date(2000, 1, 29);
* dtB = new Date(2001, 2, 1);
* comb.date.difference(dtA, dtB, "quarter") => 4
* comb.date.difference(dtA, dtB, "month") => 13
* comb.date.difference(dtA, dtB, "quarter"); //4
* comb.date.difference(dtA, dtB, "month"); //13
*
* dtA = new Date(2000, 1, 1);
* dtB = new Date(2000, 1, 8);
* comb.date.difference(dtA, dtB, "week") => 1
* comb.date.difference(dtA, dtB, "week"); //1
*
* dtA = new Date(2000, 1, 29);
* dtB = new Date(2000, 2, 1);
* comb.date.difference(dtA, dtB, "day") => 1
* comb.date.difference(dtA, dtB, "day"); //1
*
* dtA = new Date(2006, 7, 3);
* dtB = new Date(2006, 7, 11);
* comb.date.difference(dtA, dtB, "weekday") => 6
* comb.date.difference(dtA, dtB, "weekday"); //6
*
* dtA = new Date(2000, 11, 31, 23);
* dtB = new Date(2001, 0, 1, 0);
* comb.date.difference(dtA, dtB, "hour") => 1
* comb.date.difference(dtA, dtB, "hour"); //1
*
* dtA = new Date(2000, 11, 31, 23, 59);
* dtB = new Date(2001, 0, 1, 0, 0);
* comb.date.difference(dtA, dtB, "minute") => 1
* comb.date.difference(dtA, dtB, "minute"); //1
*
* dtA = new Date(2000, 11, 31, 23, 59, 59);
* dtB = new Date(2001, 0, 1, 0, 0, 0);
* comb.date.difference(dtA, dtB, "second") => 1
* comb.date.difference(dtA, dtB, "second"); //1
*
* dtA = new Date(2000, 11, 31, 23, 59, 59, 999);
* dtB = new Date(2001, 0, 1, 0, 0, 0, 0);
* comb.date.difference(dtA, dtB, "millisecond") => 1
* comb.date.difference(dtA, dtB, "millisecond"); //1
*

@@ -636,8 +636,8 @@ *

* var aug_11_2006 = new Date(2006, 7, 11, 0);
* comb.date.parse("08/11/06", "MM/dd/yy") => aug_11_2006
* comb.date.parse("11Aug2006", 'ddMMMyyyy') => aug_11_2006
* comb.date.parse("Aug2006", 'MMMyyyy') => new Date(2006, 7, 1)
* comb.date.parse("Aug 11, 2006", "MMM dd, yyyy") => aug_11_2006
* comb.date.parse("August 11, 2006", "MMMM dd, yyyy") => aug_11_2006
* comb.date.parse("Friday, August 11, 2006", "EEEE, MMMM dd, yyyy") => aug_11_2006
* comb.date.parse("08/11/06", "MM/dd/yy"); //aug_11_2006
* comb.date.parse("11Aug2006", 'ddMMMyyyy'); //aug_11_2006
* comb.date.parse("Aug2006", 'MMMyyyy'); //new Date(2006, 7, 1)
* comb.date.parse("Aug 11, 2006", "MMM dd, yyyy"); //aug_11_2006
* comb.date.parse("August 11, 2006", "MMMM dd, yyyy"); //aug_11_2006
* comb.date.parse("Friday, August 11, 2006", "EEEE, MMMM dd, yyyy"); //aug_11_2006
*

@@ -809,11 +809,11 @@ * @param {String} dateStr The string to parse

* var date = new Date(2006, 7, 11, 0, 55, 12, 345);
* comb.date.format(date, "EEEE, MMMM dd, yyyy") => "Friday, August 11, 2006"
* comb.date.format(date, "M/dd/yy") => "8/11/06"
* comb.date.format(date, "E") => "6"
* comb.date.format(date, "h:m a") => "12:55 AM"
* comb.date.format(date, 'h:m:s') => "12:55:12"
* comb.date.format(date, 'h:m:s.SS') => "12:55:12.35"
* comb.date.format(date, 'k:m:s.SS') => "24:55:12.35"
* comb.date.format(date, 'H:m:s.SS') => "0:55:12.35"
* comb.date.format(date, "ddMMyyyy") => "11082006"
* comb.date.format(date, "EEEE, MMMM dd, yyyy"); //"Friday, August 11, 2006"
* comb.date.format(date, "M/dd/yy"); //"8/11/06"
* comb.date.format(date, "E"); //"6"
* comb.date.format(date, "h:m a"); //"12:55 AM"
* comb.date.format(date, 'h:m:s'); //"12:55:12"
* comb.date.format(date, 'h:m:s.SS'); //"12:55:12.35"
* comb.date.format(date, 'k:m:s.SS'); //"24:55:12.35"
* comb.date.format(date, 'H:m:s.SS'); //"0:55:12.35"
* comb.date.format(date, "ddMMyyyy"); //"11082006"
*

@@ -820,0 +820,0 @@ * @param date the date to format

@@ -1,2 +0,3 @@

var comb = exports;
var comb = exports,
arraySlice = Array.prototype.slice;

@@ -6,10 +7,27 @@ /**

* Converts an arguments object to an array
*
* @example
*
* function test(){
* return comb.argsToArray(arguments);
* }
*
* function testSlice(){
* return comb.argsToArray(arguments, 3);
* }
*
* console.log(test(1,2,3)); //[1,2,3]
* console.log(test(1,2,3,4,5,6)); //[4,5,6]
*
* @function
* @param {Arguments} args the arguments object to convert
* @param {Number} [slice=0] the number of arguments to slice.
* @memberOf comb
* @static
* @returns {Array} array version of the arguments object
*/
var argsToArray = comb.argsToArray = function (args) {
return Array.prototype.slice.call(args);
};
function argsToArray(args, slice) {
slice = slice || 0;
return arraySlice.call(args, slice);
}

@@ -22,7 +40,9 @@ /**

* @returns {Boolean} true if it is a boolean false otherwise
* @memberOf comb
* @static
*/
comb.isBoolean = function (obj) {
function isBoolean(obj) {
var undef, type = typeof obj;
return obj != undef && type == "boolean" || type == "Boolean";
};
}

@@ -34,7 +54,9 @@ /**

* @returns {Boolean} true if it is undefined false otherwise
* @memberOf comb
* @static
*/
comb.isUndefined = function (obj) {
function isUndefined(obj) {
var undef;
return obj !== null && obj === undef;
};
}

@@ -48,5 +70,7 @@

* @return {Boolean} true if it is defined false otherwise
* @memberOf comb
* @static
*/
comb.isDefined = function (obj) {
return !comb.isUndefined(obj);
function isDefined(obj) {
return !isUndefined(obj);
}

@@ -59,5 +83,7 @@

* @returns {Boolean} true if it is undefined or null false otherwise
* @memberOf comb
* @static
*/
comb.isUndefinedOrNull = function (obj) {
return comb.isUndefined(obj) || comb.isNull(obj);
function isUndefinedOrNull(obj) {
return isUndefined(obj) || isNull(obj);
}

@@ -71,7 +97,9 @@

* @returns {Boolean} true if it is null false otherwise
* @memberOf comb
* @static
*/
comb.isNull = function (obj) {
function isNull(obj) {
var undef;
return obj !== undef && obj == null;
};
}

@@ -84,9 +112,11 @@ /**

* @returns {Boolean} true if it is an Arguments Object false otherwise
* @memberOf comb
* @static
*/
comb.isArguments = function (object) {
return !comb.isUndefinedOrNull(object) && Object.prototype.toString.call(object) == '[object Arguments]';
};
function isArguments(object) {
return !isUndefinedOrNull(object) && Object.prototype.toString.call(object) == '[object Arguments]';
}
var isInstance = function (obj, clazz) {
function isInstance(obj, clazz) {
if (typeof clazz == "function") {

@@ -97,3 +127,3 @@ return obj instanceof clazz;

}
};
}

@@ -107,8 +137,10 @@ /**

* @returns {Boolean} true if it is an instance of the clazz false otherwise
* @memberOf comb
* @static
*/
comb.isInstanceOf = function (obj, clazz) {
return argsToArray(arguments).slice(1).some(function (c) {
function isInstanceOf(obj, clazz) {
return argsToArray(arguments, 1).some(function (c) {
return isInstance(obj, c);
});
};
}

@@ -119,3 +151,4 @@ (function () {

var setup = false;
var setupListener = function () {
function setupListener() {
if (!setup) {

@@ -136,3 +169,3 @@ var orig = process.emit;

}
};
}

@@ -144,10 +177,23 @@ /**

* @param {Funciton} cb funciton to call when process is exiting
* @memberOf comb
* @static
*/
comb.listenForExit = function (cb) {
function listenForExit(cb) {
setupListener();
listeners.push(cb);
};
}
comb.listenForExit = listenForExit;
})();
comb.argsToArray = argsToArray;
comb.isBoolean = isBoolean;
comb.isUndefined = isUndefined;
comb.isDefined = isDefined;
comb.isUndefinedOrNull = isUndefinedOrNull;
comb.isNull = isNull;
comb.isArguments = isArguments;
comb.isInstanceOf = isInstanceOf;

@@ -24,6 +24,16 @@ var comb = exports;

comb.number = {
/**@lends comb.number*/
/**
* Rounds a number to the specified places.
*
* @example
*
* comb.number.round(10.000009, 2); //10
* comb.number.round(10.000009, 5); //10.00001
* comb.number.round(10.0009, 3); //10.001
* comb.number.round(10.0009, 2); //10
* comb.number.round(10.0009, 3); //10.001
*
* @param {Number} num the number to round.

@@ -42,3 +52,11 @@ * @param {Number} places the number of places to round to.

*
* @example
*
* comb.number.roundCeil(10.000001, 2); //10.01
* comb.number.roundCeil(10.000002, 5); //10.00001
* comb.number.roundCeil(10.0003, 3); //10.001
* comb.number.roundCeil(10.0004, 2); //10.01
* comb.number.roundCeil(10.0005, 3); //10.001
* comb.number.roundCeil(10.0002, 2); //10.01
*
* @param {Number} num the number to round.

@@ -45,0 +63,0 @@ * @param {Number} places the number of places to round to.

var comb = exports;
comb.isRexExp = function(obj){
/**
* Tests if something is a regular expression.
*
* @example
*
* comb.isRegExp(/hello/); //true
* comb.isRegExp("hello"); //false
*
* @param obj the thing to test.
* @return {Boolean}
* @static
* @memberOf comb
*
*/
function isRegExp(obj) {
var undef;
return obj !== undef && obj != null && (obj instanceof RegExp);
};
}
comb.isRexExp = isRegExp;
comb.isRegExp = isRegExp;
/**

@@ -23,4 +40,4 @@ * @namespace Regeular expression utilities

*/
escapeString : function(str, except) {
return str.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, function(ch) {
escapeString:function (str, except) {
return str.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, function (ch) {
if (except && except.indexOf(ch) != -1) {

@@ -27,0 +44,0 @@ return ch;

var comb = exports, date, misc = require("./misc");
comb.isString = function(obj) {
/**
* Tests if something is a string.
*
* @example
*
* comb.isString("true") //true
* comb.isString(true) //false
*
* @param obj the thing to test
* @return {Boolean} returns true if the argument is a string.
* @static
* @memberOf comb
*/
function isString(obj) {
var undef;
return obj != undef && (typeof obj == "string" || obj instanceof String);
};
}
comb.isString = isString;
var FORMAT_REGEX = /%((?:-?\+?.?\d*)?|(?:\[[^\[|\]]*\]))?([sjdDZ])/g;

@@ -13,3 +28,3 @@ var INTERP_REGEX = /{(?:\[([^\[|\]]*)\])?(\w+)}/g;

var formatString = function(string, format) {
var formatString = function (string, format) {
var match = format.match(STR_FORMAT), ret = string, cString = comb.string;

@@ -30,3 +45,3 @@ if (match) {

var formatNumber = function(number, format) {
var formatNumber = function (number, format) {
if (typeof number == "number") {

@@ -56,4 +71,4 @@ var cString = comb.string, ret = "" + number;

var formatObject = function(object, format) {
var ret, match = format.match(OBJECT_FORMAT), spacing = 0;
var formatObject = function (object, format) {
var ret, match = format.match(OBJECT_FORMAT), spacing = 0;
if (match) {

@@ -65,3 +80,3 @@ spacing = parseInt(match[0]);

ret = JSON.stringify(object, null, spacing);
} catch(e) {
} catch (e) {
throw new Error("comb.string.format : Unable to parse json from ", object);

@@ -75,30 +90,30 @@ }

//styles
bold : 1,
bright : 1,
italic : 3,
underline : 4,
blink : 5,
inverse : 7,
crossedOut : 9,
bold:1,
bright:1,
italic:3,
underline:4,
blink:5,
inverse:7,
crossedOut:9,
red : 31,
green : 32,
yellow : 33,
blue : 34,
magenta : 35,
cyan : 36,
white : 37,
red:31,
green:32,
yellow:33,
blue:34,
magenta:35,
cyan:36,
white:37,
redBackground : 41,
greenBackground : 42,
yellowBackground : 43,
blueBackground : 44,
magentaBackground : 45,
cyanBackground : 46,
whiteBackground : 47,
redBackground:41,
greenBackground:42,
yellowBackground:43,
blueBackground:44,
magentaBackground:45,
cyanBackground:46,
whiteBackground:47,
encircled : 52,
overlined : 53,
grey : 90,
black : 90
encircled:52,
overlined:53,
grey:90,
black:90
};

@@ -113,7 +128,7 @@

*/
SMILEY : "☺",
SMILEY:"☺",
/**
* ☻
*/
SOLID_SMILEY : "☻",
SOLID_SMILEY:"☻",

@@ -127,107 +142,107 @@ /**

*/
DIAMOND : "♦",
DIAMOND:"♦",
/**
* ♣
*/
CLOVE : "♣",
CLOVE:"♣",
/**
* ♠
*/
SPADE : "♠",
SPADE:"♠",
/**
* •
*/
DOT: "•",
DOT:"•",
/**
* ◘
*/
SQUARE_CIRCLE: "◘",
SQUARE_CIRCLE:"◘",
/**
* ○
*/
CIRCLE: "○",
CIRCLE:"○",
/**
* ◙
*/
FILLED_SQUARE_CIRCLE: "◙",
FILLED_SQUARE_CIRCLE:"◙",
/**
* ♂
*/
MALE : "♂",
MALE:"♂",
/**
* ♀
*/
FEMALE : "♀",
FEMALE:"♀",
/**
* ♪
*/
EIGHT_NOTE: "♪",
EIGHT_NOTE:"♪",
/**
* ♫
*/
DOUBLE_EIGHT_NOTE: "♫",
DOUBLE_EIGHT_NOTE:"♫",
/**
* ☼
*/
SUN : "☼",
SUN:"☼",
/**
* ►
*/
PLAY : "►",
PLAY:"►",
/**
* ◄
*/
REWIND : "◄",
REWIND:"◄",
/**
* ↕
*/
UP_DOWN : "↕",
UP_DOWN:"↕",
/**
* ¶
*/
PILCROW : "¶",
PILCROW:"¶",
/**
* §
*/
SECTION : "§",
SECTION:"§",
/**
* ▬
*/
THICK_MINUS : "▬",
THICK_MINUS:"▬",
/**
* ↨
*/
SMALL_UP_DOWN : "↨",
SMALL_UP_DOWN:"↨",
/**
* ↑
*/
UP_ARROW : "↑",
UP_ARROW:"↑",
/**
* ↓
*/
DOWN_ARROW: "↓",
DOWN_ARROW:"↓",
/**
* →
*/
RIGHT_ARROW : "→",
RIGHT_ARROW:"→",
/**
* ←
*/
LEFT_ARROW: "←",
LEFT_ARROW:"←",
/**
* ∟
*/
RIGHT_ANGLE: "∟",
RIGHT_ANGLE:"∟",
/**
* ↔
*/
LEFT_RIGHT_ARROW: "↔",
LEFT_RIGHT_ARROW:"↔",
/**
* ▲
*/
TRIANGLE: "▲",
TRIANGLE:"▲",
/**
* ▼
*/
DOWN_TRIANGLE: "▼",
DOWN_TRIANGLE:"▼",

@@ -237,111 +252,111 @@ /**

*/
HOUSE : "⌂",
HOUSE:"⌂",
/**
* Ç
*/
C_CEDILLA: "Ç",
C_CEDILLA:"Ç",
/**
* ü
*/
U_UMLAUT: "ü",
U_UMLAUT:"ü",
/**
* é
*/
E_ACCENT: "é",
E_ACCENT:"é",
/**
* â
*/
A_LOWER_CIRCUMFLEX: "â",
A_LOWER_CIRCUMFLEX:"â",
/**
* ä
*/
A_LOWER_UMLAUT: "ä",
A_LOWER_UMLAUT:"ä",
/**
* à
*/
A_LOWER_GRAVE_ACCENT: "à",
A_LOWER_GRAVE_ACCENT:"à",
/**
* å
*/
A_LOWER_CIRCLE_OVER: "å",
A_LOWER_CIRCLE_OVER:"å",
/**
* ç
*/
C_LOWER_CIRCUMFLEX: "ç",
C_LOWER_CIRCUMFLEX:"ç",
/**
* ê
*/
E_LOWER_CIRCUMFLEX: "ê",
E_LOWER_CIRCUMFLEX:"ê",
/**
* ë
*/
E_LOWER_UMLAUT: "ë",
E_LOWER_UMLAUT:"ë",
/**
* è
*/
E_LOWER_GRAVE_ACCENT: "è",
E_LOWER_GRAVE_ACCENT:"è",
/**
* ï
*/
I_LOWER_UMLAUT: "ï",
I_LOWER_UMLAUT:"ï",
/**
* î
*/
I_LOWER_CIRCUMFLEX: "î",
I_LOWER_CIRCUMFLEX:"î",
/**
* ì
*/
I_LOWER_GRAVE_ACCENT: "ì",
I_LOWER_GRAVE_ACCENT:"ì",
/**
* Ä
*/
A_UPPER_UMLAUT: "Ä",
A_UPPER_UMLAUT:"Ä",
/**
* Å
*/
A_UPPER_CIRCLE: "Å",
A_UPPER_CIRCLE:"Å",
/**
* É
*/
E_UPPER_ACCENT: "É",
E_UPPER_ACCENT:"É",
/**
* æ
*/
A_E_LOWER: "æ",
A_E_LOWER:"æ",
/**
* Æ
*/
A_E_UPPER: "Æ",
A_E_UPPER:"Æ",
/**
* ô
*/
O_LOWER_CIRCUMFLEX: "ô",
O_LOWER_CIRCUMFLEX:"ô",
/**
* ö
*/
O_LOWER_UMLAUT: "ö",
O_LOWER_UMLAUT:"ö",
/**
* ò
*/
O_LOWER_GRAVE_ACCENT: "ò",
O_LOWER_GRAVE_ACCENT:"ò",
/**
* û
*/
U_LOWER_CIRCUMFLEX: "û",
U_LOWER_CIRCUMFLEX:"û",
/**
* ù
*/
U_LOWER_GRAVE_ACCENT: "ù",
U_LOWER_GRAVE_ACCENT:"ù",
/**
* ÿ
*/
Y_LOWER_UMLAUT: "ÿ",
Y_LOWER_UMLAUT:"ÿ",
/**
* Ö
*/
O_UPPER_UMLAUT: "Ö",
O_UPPER_UMLAUT:"Ö",
/**
* Ü
*/
U_UPPER_UMLAUT: "Ü",
U_UPPER_UMLAUT:"Ü",

@@ -351,15 +366,15 @@ /**

*/
CENTS: "¢",
CENTS:"¢",
/**
* £
*/
POUND: "£",
POUND:"£",
/**
* ¥
*/
YEN: "¥",
YEN:"¥",
/**
* ¤
*/
CURRENCY : "¤",
CURRENCY:"¤",

@@ -369,87 +384,87 @@ /**

*/
PTS: "₧",
PTS:"₧",
/**
* ƒ
*/
FUNCTION: "ƒ",
FUNCTION:"ƒ",
/**
* á
*/
A_LOWER_ACCENT: "á",
A_LOWER_ACCENT:"á",
/**
* í
*/
I_LOWER_ACCENT: "í",
I_LOWER_ACCENT:"í",
/**
* ó
*/
O_LOWER_ACCENT: "ó",
O_LOWER_ACCENT:"ó",
/**
* ú
*/
U_LOWER_ACCENT: "ú",
U_LOWER_ACCENT:"ú",
/**
* ñ
*/
N_LOWER_TILDE: "ñ",
N_LOWER_TILDE:"ñ",
/**
* Ñ
*/
N_UPPER_TILDE: "Ñ",
N_UPPER_TILDE:"Ñ",
/**
* ª
*/
A_SUPER: "ª",
A_SUPER:"ª",
/**
* º
*/
O_SUPER: "º",
O_SUPER:"º",
/**
* ¿
*/
UPSIDEDOWN_QUESTION: "¿",
UPSIDEDOWN_QUESTION:"¿",
/**
* ⌐
*/
SIDEWAYS_L : "⌐",
SIDEWAYS_L:"⌐",
/**
* ¬
*/
NEGATION: "¬",
NEGATION:"¬",
/**
* ½
*/
ONE_HALF : "½",
ONE_HALF:"½",
/**
* ¼
*/
ONE_FOURTH: "¼",
ONE_FOURTH:"¼",
/**
* ¡
*/
UPSIDEDOWN_EXCLAMATION: "¡",
UPSIDEDOWN_EXCLAMATION:"¡",
/**
* «
*/
DOUBLE_LEFT: "«",
DOUBLE_LEFT:"«",
/**
* »
*/
DOUBLE_RIGHT: "»",
DOUBLE_RIGHT:"»",
/**
* ░
*/
LIGHT_SHADED_BOX: "░",
LIGHT_SHADED_BOX:"░",
/**
* ▒
*/
MEDIUM_SHADED_BOX: "▒",
MEDIUM_SHADED_BOX:"▒",
/**
* ▓
*/
DARK_SHADED_BOX: "▓",
DARK_SHADED_BOX:"▓",
/**
* │
*/
VERTICAL_LINE: "│",
VERTICAL_LINE:"│",

@@ -459,39 +474,39 @@ /**

*/
MAZE__SINGLE_RIGHT_T: "┤",
MAZE__SINGLE_RIGHT_T:"┤",
/**
* ┐
*/
MAZE_SINGLE_RIGHT_TOP: "┐",
MAZE_SINGLE_RIGHT_TOP:"┐",
/**
* ┘
*/
MAZE_SINGLE_RIGHT_BOTTOM_SMALL: "┘",
MAZE_SINGLE_RIGHT_BOTTOM_SMALL:"┘",
/**
* ┌
*/
MAZE_SINGLE_LEFT_TOP_SMALL: "┌",
MAZE_SINGLE_LEFT_TOP_SMALL:"┌",
/**
* └
*/
MAZE_SINGLE_LEFT_BOTTOM_SMALL: "└",
MAZE_SINGLE_LEFT_BOTTOM_SMALL:"└",
/**
* ├
*/
MAZE_SINGLE_LEFT_T: "├",
MAZE_SINGLE_LEFT_T:"├",
/**
* ┴
*/
MAZE_SINGLE_BOTTOM_T: "┴",
MAZE_SINGLE_BOTTOM_T:"┴",
/**
* ┬
*/
MAZE_SINGLE_TOP_T: "┬",
MAZE_SINGLE_TOP_T:"┬",
/**
* ┼
*/
MAZE_SINGLE_CENTER: "┼",
MAZE_SINGLE_CENTER:"┼",
/**
* ─
*/
MAZE_SINGLE_HORIZONTAL_LINE: "─",
MAZE_SINGLE_HORIZONTAL_LINE:"─",

@@ -501,23 +516,23 @@ /**

*/
MAZE_SINGLE_RIGHT_DOUBLECENTER_T: "╡",
MAZE_SINGLE_RIGHT_DOUBLECENTER_T:"╡",
/**
* ╛
*/
MAZE_SINGLE_RIGHT_DOUBLE_BL: "╛",
MAZE_SINGLE_RIGHT_DOUBLE_BL:"╛",
/**
* ╢
*/
MAZE_SINGLE_RIGHT_DOUBLE_T: "╢",
MAZE_SINGLE_RIGHT_DOUBLE_T:"╢",
/**
* ╖
*/
MAZE_SINGLE_RIGHT_DOUBLEBOTTOM_TOP: "╖",
MAZE_SINGLE_RIGHT_DOUBLEBOTTOM_TOP:"╖",
/**
* ╕
*/
MAZE_SINGLE_RIGHT_DOUBLELEFT_TOP: "╕",
MAZE_SINGLE_RIGHT_DOUBLELEFT_TOP:"╕",
/**
* ╞
*/
MAZE_SINGLE_LEFT_DOUBLE_T: "╞",
MAZE_SINGLE_LEFT_DOUBLE_T:"╞",

@@ -527,51 +542,51 @@ /**

*/
MAZE_SINGLE_BOTTOM_DOUBLE_T: "╧",
MAZE_SINGLE_BOTTOM_DOUBLE_T:"╧",
/**
* ╤
*/
MAZE_SINGLE_TOP_DOUBLE_T: "╤",
MAZE_SINGLE_TOP_DOUBLE_T:"╤",
/**
* ╥
*/
MAZE_SINGLE_TOP_DOUBLECENTER_T: "╥",
MAZE_SINGLE_TOP_DOUBLECENTER_T:"╥",
/**
* ╨
*/
MAZE_SINGLE_BOTTOM_DOUBLECENTER_T: "╨",
MAZE_SINGLE_BOTTOM_DOUBLECENTER_T:"╨",
/**
* ╘
*/
MAZE_SINGLE_LEFT_DOUBLERIGHT_BOTTOM: "╘",
MAZE_SINGLE_LEFT_DOUBLERIGHT_BOTTOM:"╘",
/**
* ╒
*/
MAZE_SINGLE_LEFT_DOUBLERIGHT_TOP: "╒",
MAZE_SINGLE_LEFT_DOUBLERIGHT_TOP:"╒",
/**
* ╓
*/
MAZE_SINGLE_LEFT_DOUBLEBOTTOM_TOP: "╓",
MAZE_SINGLE_LEFT_DOUBLEBOTTOM_TOP:"╓",
/**
* ╙
*/
MAZE_SINGLE_LEFT_DOUBLETOP_BOTTOM: "╙",
MAZE_SINGLE_LEFT_DOUBLETOP_BOTTOM:"╙",
/**
* Γ
*/
MAZE_SINGLE_LEFT_TOP: "Γ",
MAZE_SINGLE_LEFT_TOP:"Γ",
/**
* ╜
*/
MAZE_SINGLE_RIGHT_BOTTOM: "╜",
MAZE_SINGLE_RIGHT_BOTTOM:"╜",
/**
* ╟
*/
MAZE_SINGLE_LEFT_CENTER: "╟",
MAZE_SINGLE_LEFT_CENTER:"╟",
/**
* ╫
*/
MAZE_SINGLE_DOUBLECENTER_CENTER: "╫",
MAZE_SINGLE_DOUBLECENTER_CENTER:"╫",
/**
* ╪
*/
MAZE_SINGLE_DOUBLECROSS_CENTER: "╪",
MAZE_SINGLE_DOUBLECROSS_CENTER:"╪",

@@ -582,43 +597,43 @@

*/
MAZE_DOUBLE_LEFT_CENTER: "╣",
MAZE_DOUBLE_LEFT_CENTER:"╣",
/**
* ║
*/
MAZE_DOUBLE_VERTICAL: "║",
MAZE_DOUBLE_VERTICAL:"║",
/**
* ╗
*/
MAZE_DOUBLE_RIGHT_TOP: "╗",
MAZE_DOUBLE_RIGHT_TOP:"╗",
/**
* ╝
*/
MAZE_DOUBLE_RIGHT_BOTTOM: "╝",
MAZE_DOUBLE_RIGHT_BOTTOM:"╝",
/**
* ╚
*/
MAZE_DOUBLE_LEFT_BOTTOM: "╚",
MAZE_DOUBLE_LEFT_BOTTOM:"╚",
/**
* ╔
*/
MAZE_DOUBLE_LEFT_TOP: "╔",
MAZE_DOUBLE_LEFT_TOP:"╔",
/**
* ╩
*/
MAZE_DOUBLE_BOTTOM_T: "╩",
MAZE_DOUBLE_BOTTOM_T:"╩",
/**
* ╦
*/
MAZE_DOUBLE_TOP_T : "╦",
MAZE_DOUBLE_TOP_T:"╦",
/**
* ╠
*/
MAZE_DOUBLE_LEFT_T: "╠",
MAZE_DOUBLE_LEFT_T:"╠",
/**
* ═
*/
MAZE_DOUBLE_HORIZONTAL: "═",
MAZE_DOUBLE_HORIZONTAL:"═",
/**
* ╬
*/
MAZE_DOUBLE_CROSS: "╬",
MAZE_DOUBLE_CROSS:"╬",

@@ -628,19 +643,19 @@ /**

*/
SOLID_RECTANGLE: "█",
SOLID_RECTANGLE:"█",
/**
* ▌
*/
THICK_LEFT_VERTICAL: "▌",
THICK_LEFT_VERTICAL:"▌",
/**
* ▐
*/
THICK_RIGHT_VERTICAL: "▐",
THICK_RIGHT_VERTICAL:"▐",
/**
* ▄
*/
SOLID_SMALL_RECTANGLE_BOTTOM: "▄",
SOLID_SMALL_RECTANGLE_BOTTOM:"▄",
/**
* ▀
*/
SOLID_SMALL_RECTANGLE_TOP: "▀",
SOLID_SMALL_RECTANGLE_TOP:"▀",

@@ -650,3 +665,3 @@ /**

*/
PHI_UPPER: "Φ",
PHI_UPPER:"Φ",

@@ -656,59 +671,59 @@ /**

*/
INFINITY: "∞",
INFINITY:"∞",
/**
* ∩
*/
INTERSECTION: "∩",
INTERSECTION:"∩",
/**
* ≡
*/
DEFINITION: "≡",
DEFINITION:"≡",
/**
* ±
*/
PLUS_MINUS: "±",
PLUS_MINUS:"±",
/**
* ≥
*/
GT_EQ: "≥",
GT_EQ:"≥",
/**
* ≤
*/
LT_EQ: "≤",
LT_EQ:"≤",
/**
* ⌠
*/
THEREFORE: "⌠",
THEREFORE:"⌠",
/**
* ∵
*/
SINCE : "∵",
SINCE:"∵",
/**
* ∄
*/
DOESNOT_EXIST : "∄",
DOESNOT_EXIST:"∄",
/**
* ∃
*/
EXISTS : "∃",
EXISTS:"∃",
/**
* ∀
*/
FOR_ALL :"∀",
FOR_ALL:"∀",
/**
* ⊕
*/
EXCLUSIVE_OR : "⊕",
EXCLUSIVE_OR:"⊕",
/**
* ⌡
*/
BECAUSE: "⌡",
BECAUSE:"⌡",
/**
* ÷
*/
DIVIDE: "÷",
DIVIDE:"÷",
/**
* ≈
*/
APPROX: "≈",
APPROX:"≈",

@@ -718,51 +733,51 @@ /**

*/
DEGREE: "°",
DEGREE:"°",
/**
* ∙
*/
BOLD_DOT: "∙",
BOLD_DOT:"∙",
/**
* ·
*/
DOT_SMALL: "·",
DOT_SMALL:"·",
/**
* √
*/
CHECK: "√",
CHECK:"√",
/**
* ✗
*/
ITALIC_X : "✗",
ITALIC_X:"✗",
/**
* ⁿ
*/
SUPER_N: "ⁿ",
SUPER_N:"ⁿ",
/**
* ²
*/
SQUARED: "²",
SQUARED:"²",
/**
* ³
*/
CUBED : "³",
CUBED:"³",
/**
* ■
*/
SOLID_BOX: "■",
SOLID_BOX:"■",
/**
* ‰
*/
PERMILE : "‰",
PERMILE:"‰",
/**
* ®
*/
REGISTERED_TM : "®",
REGISTERED_TM:"®",
/**
* ©
*/
COPYRIGHT : "©",
COPYRIGHT:"©",
/**
* ™
*/
TRADEMARK : "™",
TRADEMARK:"™",

@@ -772,107 +787,107 @@ /**

*/
BETA: "β",
BETA:"β",
/**
* γ
*/
GAMMA: "γ",
GAMMA:"γ",
/**
* ζ
*/
ZETA: "ζ",
ZETA:"ζ",
/**
* η
*/
ETA: "η",
ETA:"η",
/**
* ι
*/
IOTA: "ι",
IOTA:"ι",
/**
* κ
*/
KAPPA: "κ",
KAPPA:"κ",
/**
* λ
*/
LAMBDA: "λ",
LAMBDA:"λ",
/**
* ν
*/
NU: "ν",
NU:"ν",
/**
* ξ
*/
XI: "ξ",
XI:"ξ",
/**
* ο
*/
OMICRON: "ο",
OMICRON:"ο",
/**
* ρ
*/
RHO: "ρ",
RHO:"ρ",
/**
* υ
*/
UPSILON: "υ",
UPSILON:"υ",
/**
* φ
*/
CHI_LOWER: "φ",
CHI_LOWER:"φ",
/**
* χ
*/
CHI_UPPER: "χ",
CHI_UPPER:"χ",
/**
* ψ
*/
PSI : "ψ",
PSI:"ψ",
/**
* α
*/
ALPHA: "α",
ALPHA:"α",
/**
* ß
*/
ESZETT: "ß",
ESZETT:"ß",
/**
* π
*/
PI: "π",
PI:"π",
/**
* Σ
*/
SIGMA_UPPER: "Σ",
SIGMA_UPPER:"Σ",
/**
* σ
*/
SIGMA_LOWER: "σ",
SIGMA_LOWER:"σ",
/**
* µ
*/
MU: "µ",
MU:"µ",
/**
* τ
*/
TAU: "τ",
TAU:"τ",
/**
* Θ
*/
THETA: "Θ",
THETA:"Θ",
/**
* Ω
*/
OMEGA: "Ω",
OMEGA:"Ω",
/**
* δ
*/
DELTA: "δ",
DELTA:"δ",
/**
* φ
*/
PHI_LOWER: "φ",
PHI_LOWER:"φ",
/**
* ε
*/
EPSILON: "ε"
EPSILON:"ε"

@@ -901,3 +916,3 @@

*/
pad : function(string, length, ch, end) {
pad:function (string, length, ch, end) {
string = "" + string; //check for numbers

@@ -935,3 +950,3 @@ ch = ch || " ";

*/
truncate : function(string, length, end) {
truncate:function (string, length, end) {
var ret = string;

@@ -1020,3 +1035,3 @@ if (comb.isString(ret)) {

*/
format : function(str, obj) {
format:function (str, obj) {
!date && (date = require("./date"));

@@ -1026,3 +1041,3 @@ if (obj instanceof Array) {

//find the matches
return str.replace(FORMAT_REGEX, function(m, format, type) {
return str.replace(FORMAT_REGEX, function (m, format, type) {
var replacer, ret;

@@ -1039,3 +1054,3 @@ if (i < len) {

ret = replacer;
}else if(m == "%Z"){
} else if (m == "%Z") {
ret = replacer.toUTCString();

@@ -1045,3 +1060,3 @@ } else if (m == "%j") {

ret = JSON.stringify(replacer);
} catch(e) {
} catch (e) {
throw new Error("comb.string.format : Unable to parse json from ", replacer);

@@ -1072,3 +1087,3 @@ }

} else if (typeof obj == "object") {
return str.replace(INTERP_REGEX, function(m, format, value) {
return str.replace(INTERP_REGEX, function (m, format, value) {
value = obj[value];

@@ -1110,3 +1125,3 @@ if (!misc.isUndefined(value)) {

*/
toArray : function(testStr, delim) {
toArray:function (testStr, delim) {
var ret = [];

@@ -1129,3 +1144,3 @@ if (testStr) {

*/
multiply : function(str, times) {
multiply:function (str, times) {
var ret = [];

@@ -1179,11 +1194,11 @@ if (times) {

*/
style : function(str, options) {
style:function (str, options) {
var ret = str;
if (options) {
if (ret instanceof Array) {
ret = ret.map(function(s) {
ret = ret.map(function (s) {
return comb.string.style(s, options);
})
} else if (options instanceof Array) {
options.forEach(function(option) {
options.forEach(function (option) {
ret = comb.string.style(ret, option);

@@ -1199,2 +1214,1 @@ });

@@ -8,2 +8,8 @@ var base = require("./base");

*
* @includeDoc [OO] ../docs-md/define.md
* @includeDoc [Promises] ../docs-md/promise.md
* @includeDoc [Logging] ../docs-md/logging.md
* @includeDoc [Utilities] ../docs-md/utilities.md
*
*
* @header

@@ -231,1 +237,3 @@ *

@@ -71,3 +71,3 @@ var define = require("../../define.js").define,

ws.destroySoon();
return ret;
return ret.promise();
},

@@ -74,0 +74,0 @@

@@ -128,3 +128,3 @@ var define = require("../../define.js").define,

}
return ret;
return ret.promise();
},

@@ -195,3 +195,3 @@

}));
return ret;
return ret.promise();
},

@@ -198,0 +198,0 @@

@@ -39,3 +39,3 @@ var define = require("../define.js").define, base = require("../base"), fs = require('fs'), Appender = require("./appenders/appender.js");

if (type) {
logger.addAppender(Appender.createAppender(type, appenderProps));
logger.addAppender(type, appenderProps);
}

@@ -214,2 +214,2 @@ }

}
});
});
var define = require("../define.js"),
base = require("../base"),
isString = base.isString,
merge = base.merge,
isUndefinedOrNull = base.isUndefinedOrNull,
isHash = base.isHash,
isInstanceOf = base.isInstanceOf,
argsToArray = base.argsToArray,
format = base.string.format,
Level = require("./level"),
appenders = require("./appenders"),
Appender = appenders.Appender,
configurators = require("./config");

@@ -140,3 +148,3 @@ var rootTree;

* @namespace logging package*/
comb.logging = base.merge({
comb.logging = merge({
Level:Level

@@ -189,28 +197,21 @@ }, configurators);

*
* var logging = comb.logging,
* Logger = logging.Logger,
* appenders = logging.appenders,
* Level = logging.Level;
* var logger = comb.logger;
*
* //configure you logging environement
* logger.configure();
*
* var bc = logging.BasicConfigurator();
* //add console appender to all loggers
* bc.configure();
* //add a file appender to all loggers
* bc.configure(new appenders.FileAppender({file : "/var/log/myLog.log"}));
* logger.configure(logger.appender("FileAppender", {file : "/var/log/myLog.log"});
*
* //Retreiving a logger.
* var combLogger = Logger.getLogger("comb");
* var combCollectionLogger = Logger.getLogger("comb.collections");
* var treeLogger = Logger.getLogger("comb.collections.Tree");
* var combLogger = logger("comb");
* var combCollectionLogger = logger("comb.collections");
* var treeLogger = logger("comb.collections.Tree")
* //add a JSON appender to tree logger just for fun!
* .addAppender("JSONAppender", {file : "/var/log/myTreeLogger.json"})
*
* //set my treeLogger to DEBUG Level
* treeLogger.level = Level.DEBUG;
* //add a JSON appender to tree logger just for fun!
* treeLogger.addAppender(new appenders.JSONAppender({file : "/var/log/myTreeLogger.json"}));
* treeLogger.level = "DEBUG";
*
* //NOW USE THEM
*
*
* @name Logger

@@ -261,3 +262,3 @@ * @memberOf comb.logging

info:function (message) {
return this.log(Level.INFO, message);
return this.log.apply(this, [Level.INFO].concat(argsToArray(arguments)));
},

@@ -273,3 +274,3 @@

debug:function (message) {
return this.log(Level.DEBUG, message);
return this.log.apply(this, [Level.DEBUG].concat(argsToArray(arguments)));
},

@@ -285,3 +286,3 @@

error:function (message) {
return this.log(Level.ERROR, message);
return this.log.apply(this, [Level.ERROR].concat(argsToArray(arguments)));
},

@@ -297,3 +298,3 @@

warn:function (message) {
return this.log(Level.WARN, message);
return this.log.apply(this, [Level.WARN].concat(argsToArray(arguments)));
},

@@ -309,3 +310,3 @@

trace:function (message) {
return this.log(Level.TRACE, message);
return this.log.apply(this, [Level.TRACE].concat(argsToArray(arguments)));
},

@@ -321,3 +322,3 @@

fatal:function (message) {
return this.log(Level.FATAL, message);
return this.log.apply(this, [Level.FATAL].concat(argsToArray(arguments)));
},

@@ -334,2 +335,7 @@

log:function (level, message) {
var args = argsToArray(arguments, 1);
level = Level.toLevel(level);
if (args.length > 1) {
message = format.apply(null, args);
}
if (level.isGreaterOrEqualToo(this.level)) {

@@ -342,3 +348,3 @@ if (Level.TRACE.equals(level)) {

message = err.stack;
} else if (Level.ERROR.equals(level) && base.isInstanceOf(message, Error)) {
} else if (Level.ERROR.equals(level) && isInstanceOf(message, Error)) {
message = message.stack;

@@ -363,15 +369,33 @@ }

* Add an appender to this logger. If this is additive then the appender is added to all subloggers.
* @param {comb.logging.Appender} appender the appender to add.
*
* @example
* comb.logger("my.logger")
* .addAppender("ConsoleAppender")
* .addAppender("FileAppender", {file:'/var/log/my.log'})
* .addAppender("RollingFileAppender", {file:'/var/log/myRolling.log'})
* .addAppender("JSONAppender", {file:'/var/log/myJson.log'});
*
* @param {comb.logging.Appender|String} If the appender is an {@link comb.logging.appenders.Appender} then it is added.
* If the appender is a string then {@link comb.logging.appenders.Appender.createAppender} will be called to create it.
*
* @param {Object} [opts = null] If the first argument is a string then the opts will be used as constructor arguments for
* creating the appender.
*
* @return {comb.logging.Logger} for chaining.
*/
addAppender:function (appender) {
if (!base.isUndefinedOrNull(appender)) {
var name = appender.name;
if (!(name in this.__appenders)) {
this.__appenders[name] = appender;
if (!appender.level) {
appender.level = this.level;
addAppender:function (appender, opts) {
var args = argsToArray(arguments);
if (isString(appender)) {
this.addAppender(Appender.createAppender(appender, opts));
} else {
if (!isUndefinedOrNull(appender)) {
var name = appender.name;
if (!(name in this.__appenders)) {
this.__appenders[name] = appender;
if (!appender.level) {
appender.level = this.level;
}
this._tree.addAppender(appender);
}
this._tree.addAppender(appender);
}

@@ -590,8 +614,61 @@ }

* @memberOf comb
* @namespace
*/
exports.logger = Logger.getLogger.bind(Logger);
/**
* @function
* @description Shortcut to configure loggers.
*
* @example
*
* //same as new comb.logging.BasicConfigurator().configure();
* comb.logger.configure();
*
* //new comb.logging.PropertyConfigurator().configure("/location/to/logger/configuration.json");
* comb.logger.configure("/location/to/logger/configuration.json");
*
* @memberOf comb.logger
*/
exports.logger.configure = function configure() {
var args = argsToArray(arguments), configurator;
if (!args.length) {
configurator = new configurators.BasicConfigurator();
} else {
var first = args[0];
if (isHash(first) || isString(first)) {
configurator = new configurators.PropertyConfigurator();
} else {
configurator = new configurators.BasicConfigurator();
}
}
configurator.configure.apply(configurator, args);
return this;
};
/**
* @function
* @description Factory method for creating appenders. See {@link comb.logging.appenders.Appender.createAppender} for
* arguments.
*
* @example
*
* var appender = comb.logger.appender("ConsoleAppender");
* comb.logger("my.logger").addAppender(appender);
*
* @memberOf comb.logger
*
*/
exports.logger.appender = Appender.createAppender.bind(Appender);
var rootLogger = new Logger("");
rootTree = rootLogger._tree;
/**
* The root for all loggers.
* @memberOf comb.logger
* @type comb.logging.Logger
*/
exports.logger.rootLogger = rootLogger;

@@ -93,3 +93,3 @@ var func = require("../base/functions"),

}
return promise;
return promise.promise();
},

@@ -96,0 +96,0 @@

var hitch = require("./base/functions").hitch,
define = require("./define").define, base = require("./base");
define = require("./define").define,
base = require("./base"),
argsToArray = base.argsToArray,
isUndefinedOrNull = base.isUndefinedOrNull,
isFunction = base.isFunction,
isInstanceOf = base.isInstanceOf;
var Promise = define(null, {

@@ -141,3 +147,3 @@ instance:{

callback:function (args) {
args = base.argsToArray(arguments);
args = argsToArray(arguments);
if (this.__fired) {

@@ -148,3 +154,3 @@ throw new Error("Already fired!");

this.__resolve();
return this;
return this.promise();
},

@@ -162,4 +168,29 @@

}
this.__error = base.argsToArray(arguments);
this.__error = argsToArray(arguments);
this.__resolve();
return this.promise();
},
/**
* Resolved a promise using the node style callback.
*
* @example
*
* var promise = new Promise();
* fs.readFile("file.txt", "utf8", promise.resolve.bind(promise));
* promise.then(function(file){
* console.log(file);
* });
*
* @param {Error} [err=null] If specified then the promise will error out
* @param {...} [args] if err is null then the aruments will be used to resolve the promise.
*
* @return {comb.Promise} for chaining.
*/
resolve:function (err, args) {
if (err) {
this.errback(err);
} else {
this.callback.apply(this, argsToArray(arguments, 1));
}
return this;

@@ -213,3 +244,3 @@ },

this.addCallback(function () {
cb.apply(this, [null].concat(base.argsToArray(arguments)));
cb.apply(this, [null].concat(argsToArray(arguments)));
});

@@ -222,5 +253,23 @@ }

* Call to chaining of promises
* @param callback method to call that returns a promise to call after this one completes.
* @param errback method to call if this promise errors.
*
* @example
*
* var p = new Promise();
*
* p
* .chain(function(previousPromiseResults){
* return previousPromiseResults + " world";
* }, errorHandler)
* .chain(function(previousPromiseResults){
* return when(dbCall());
* }).classic(function(err, results){
* //all promises are done
* });
*
* p.callback("Hello");
*
* @param callback method to call this one completes. If you return a promise the execution will delay until the returned promise has resolved.
* @param [errback=null] method to call if this promise errors. If errback is not specified then the returned promises
* errback method will be used.
*
* @return {comb.Promise} A new that wraps the promise for chaining

@@ -231,6 +280,9 @@ */

this.addCallback(function (results) {
callback.call(this, results).then(promise);
when(callback.call(this, results)).then(promise);
});
this.addErrback(errback);
return promise;
// If no errback passed, then invoke our promise's errback to pass
// on to next link in the chain.
this.addErrback(errback || promise);
return promise.promise();
},

@@ -247,7 +299,44 @@

chainBoth:function (callback) {
var p = this.chain(callback);
var promise = new Promise();
this.addCallback(function (results) {
when(callback.call(this, results)).then(promise);
});
this.addErrback(function (results) {
callback.call(this, results).then(p);
when(callback.call(this, results)).then(promise);
});
return p;
return promise.promise();
},
/**
* Creates an object to that contains methods to listen to resolution but not the "callback" or "errback" methods.
*
* @example
*
* var asyncMethod = function(){
* var ret = new comb.Promise();
* process.nextTick(ret.callback.bind(ret, "hello"));
* return ret.promise();
* }
*
* asyncMethod().callback() //throws error
*
* @return {Object} an object containing "chain", "chainBoth", "promise", "addCallback", "addErrback", "then", "both".
*/
promise:function () {
var ret = {
chain:this.chain.bind(this),
chainBoth:this.chainBoth.bind(this),
promise:function () {
return ret;
}
};
["addCallback", "addErrback", "then", "both", "classic"].forEach(function (action) {
ret[action] = function () {
this[action].apply(this, arguments);
return ret;
}.bind(this);
}, this);
return ret;
}

@@ -330,3 +419,3 @@

promise.addCallback(hitch(this, function () {
var args = Array.prototype.slice.call(arguments);
var args = argsToArray(arguments);
args.unshift(i);

@@ -336,3 +425,3 @@ this.callback.apply(this, args);

promise.addErrback(hitch(this, function () {
var args = Array.prototype.slice.call(arguments);
var args = argsToArray(arguments);
args.unshift(i);

@@ -398,3 +487,3 @@ this.errback.apply(this, args);

}
var args = base.argsToArray(arguments);
var args = argsToArray(arguments);
if (this.normalizeResults) {

@@ -409,3 +498,3 @@ args = args.slice(1);

}
return this;
return this.promise();
},

@@ -418,3 +507,3 @@

}
var args = base.argsToArray(arguments);
var args = argsToArray(arguments);
if (this.normalizeResults) {

@@ -429,3 +518,3 @@ args = args.slice(1);

}
return this;
return this.promise();
}

@@ -439,4 +528,2 @@

base.merge(exports, {

@@ -452,4 +539,4 @@ /**

isPromiseLike:function (obj) {
return !base.isUndefinedOrNull(obj) && (base.isInstanceOf(obj, Promise) || (base.isFunction(obj.then)
&& base.isFunction(obj.addCallback) && base.isFunction(obj.addErrback)));
return !isUndefinedOrNull(obj) && (isInstanceOf(obj, Promise) || (isFunction(obj.then)
&& isFunction(obj.addCallback) && isFunction(obj.addErrback)));
},

@@ -471,3 +558,3 @@

when:function (args, cb, eb) {
var args = base.argsToArray(arguments), p;
var args = argsToArray(arguments), p;
eb = base.isFunction(args[args.length - 1]) ? args.pop() : null;

@@ -495,3 +582,3 @@ cb = base.isFunction(args[args.length - 1]) ? args.pop() : null;

}
return p;
return p.promise();

@@ -524,14 +611,6 @@ },

var ret = new Promise();
var args = base.argsToArray(arguments);
args.push(function (err, res) {
var args = base.argsToArray(arguments);
if (err) {
ret.errback(err);
} else {
args.shift();
ret.callback.apply(ret, args);
}
});
var args = argsToArray(arguments);
args.push(ret.resolve.bind(ret));
fn.apply(scope || this, args);
return ret;
return ret.promise();
}

@@ -550,3 +629,3 @@ },

* setTimeout(comb.hitchIgnore(ret, "callback", item), timeout);
* return ret;
* return ret.promise();
* };

@@ -579,3 +658,3 @@ *

ret.then(callback, errback);
return ret;
return ret.promise();
}

@@ -590,3 +669,3 @@

//store results
var args = base.argsToArray(arguments).slice(5);
var args = argsToArray(arguments, 5);
results.push(args.length == 1 ? args[0] : args);

@@ -598,3 +677,3 @@ process.nextTick(base.partial(callNext, list, index + 1, results, isErrored, ret));

//store results
var args = base.argsToArray(arguments).slice(4);
var args = argsToArray(arguments, 4);
ret.errback.apply(ret, args);

@@ -619,1 +698,5 @@ };

{
"name": "comb",
"description": "A framework for node",
"version": "0.1.3",
"version": "0.1.4",
"keywords" : ["OO", "Object Oriented", "Collections", "Tree", "HashTable", "Pool", "Logging", "Promise", "Promises", "Proxy"],

@@ -6,0 +6,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc