logging-helpers
Advanced tools
Comparing version 0.3.0 to 0.4.0
63
index.js
@@ -7,16 +7,27 @@ 'use strict'; | ||
* ```js | ||
* // Handlebars | ||
* {{log "this is a message!"}} | ||
* | ||
* // Lo-Dash | ||
* <%= log("this is a message!") %> | ||
* <%= log("%j", foo) %> | ||
* | ||
* // Handlebars | ||
* {{log "this is a message!"}} | ||
* ``` | ||
*/ | ||
exports.log = function () { | ||
exports.log = function log_() { | ||
console.log.apply(console, arguments); | ||
}; | ||
exports.info = function () { | ||
/** | ||
* ```js | ||
* // Lo-Dash | ||
* <%= info("this is a message!") %> | ||
* <%= info("%j", foo) %> | ||
* | ||
* // Handlebars | ||
* {{info "this is a message!"}} | ||
* ``` | ||
*/ | ||
exports.info = function info_() { | ||
arguments[0] = chalk.cyan(arguments[0]); | ||
@@ -26,3 +37,14 @@ console.log.apply(console, arguments); | ||
exports.bold = function () { | ||
/** | ||
* ```js | ||
* // Lo-Dash | ||
* <%= bold("this is a message!") %> | ||
* <%= bold("%j", foo) %> | ||
* | ||
* // Handlebars | ||
* {{bold "this is a message!"}} | ||
* ``` | ||
*/ | ||
exports.bold = function bold_() { | ||
arguments[0] = chalk.bold(arguments[0]); | ||
@@ -32,3 +54,3 @@ console.log.apply(console, arguments); | ||
exports.warn = function () { | ||
exports.warn = function warn_() { | ||
arguments[0] = chalk.yellow(arguments[0]); | ||
@@ -38,3 +60,3 @@ console.warn.apply(console, arguments); | ||
exports.error = function () { | ||
exports.error = function error_() { | ||
arguments[0] = chalk.red(arguments[0]); | ||
@@ -44,9 +66,19 @@ console.error.apply(console, arguments); | ||
exports.debug = function(val) { | ||
/** | ||
* Outputs a debug statement with the current context, | ||
* and/or `val` | ||
*/ | ||
exports.debug = function debug_(val) { | ||
var args = [].slice.call(arguments); | ||
console.log(); | ||
console.log('================================='); | ||
console.log('context: ', this); | ||
console.log('context: %j', this); | ||
console.log(); | ||
if (!isUndefined(val)) { | ||
console.log('value: ', val); | ||
console.log.apply(console, ['value: %j'].concat(val)); | ||
} | ||
console.log('================================='); | ||
console.log(); | ||
return; | ||
@@ -59,10 +91,7 @@ }; | ||
* passed on the context. | ||
* | ||
*/ | ||
exports._inspect = function(context, options) { | ||
exports._inspect = function inspect_(context, options) { | ||
context = JSON.stringify(context, null, 2); | ||
var ext = options | ||
&& options.hash | ||
&& options.hash.ext || 'html'; | ||
var ext = options && options.hash && options.hash.ext || 'html'; | ||
return switchOutput(ext, context); | ||
@@ -74,4 +103,2 @@ }; | ||
* extension passed. | ||
* | ||
* @api private | ||
*/ | ||
@@ -78,0 +105,0 @@ |
{ | ||
"name": "logging-helpers", | ||
"description": "Basic template helpers for printing messages out to the console. Useful for debugging context in templates. Should work with any template engine.", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"homepage": "https://github.com/helpers/logging-helpers", | ||
@@ -19,4 +19,7 @@ "author": { | ||
"type": "MIT", | ||
"url": "https://github.com/helpers/logging-helpers/blob/master/LICENSE-MIT" | ||
"url": "https://github.com/helpers/logging-helpers/blob/master/LICENSE" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"main": "index.js", | ||
@@ -27,8 +30,11 @@ "engines": { | ||
"scripts": { | ||
"test": "mocha -R spec" | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"chalk": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"handlebars": "^2.0.0", | ||
"mocha": "*", | ||
"should": "*" | ||
"handlebars": "^3.0.0", | ||
"mocha": "^2.2.1", | ||
"should": "^5.2.0" | ||
}, | ||
@@ -55,6 +61,3 @@ "keywords": [ | ||
"verb" | ||
], | ||
"dependencies": { | ||
"chalk": "^0.5.1" | ||
} | ||
} | ||
] | ||
} |
@@ -1,6 +0,5 @@ | ||
# logging-helpers [![NPM version](https://badge.fury.io/js/logging-helpers.svg)](http://badge.fury.io/js/logging-helpers) | ||
# logging-helpers [![NPM version](https://badge.fury.io/js/logging-helpers.svg)](http://badge.fury.io/js/logging-helpers) [![Build Status](https://travis-ci.org/helpers/logging-helpers.svg)](https://travis-ci.org/helpers/logging-helpers) | ||
> Basic template helpers for printing messages out to the console. Useful for debugging context in templates. Should work with any template engine. | ||
## Install with [npm](npmjs.org) | ||
@@ -12,2 +11,5 @@ | ||
## Related helper projects | ||
* [handlebars-helpers](https://github.com/assemble/handlebars-helpers): 120+ Handlebars helpers in ~20 categories, for Assemble, YUI, Ghost or any Handlebars project. Includes helpers like {{i18}}, {{markdown}}, {{relative}}, {{extend}}, {{moment}}, and so on. | ||
* [template-helpers](https://github.com/jonschlinkert/template-helpers): Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or any engine that supports helper functions. | ||
@@ -82,5 +84,3 @@ ## Usage examples | ||
## Run tests | ||
## Running tests | ||
Install dev dependencies. | ||
@@ -99,4 +99,4 @@ | ||
+ [github/helpers](https://github.com/helpers) | ||
+ [twitter/helpers](http://twitter.com/helpers) | ||
+ [github/jonschlinkert](https://github.com/jonschlinkert) | ||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
@@ -109,2 +109,2 @@ ## License | ||
_This file was generated by [verb](https://github.com/assemble/verb) on January 20, 2015._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 20, 2015._ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7887
4
104
106
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
- Removedansi-regex@0.2.1(transitive)
- Removedansi-styles@1.1.0(transitive)
- Removedchalk@0.5.1(transitive)
- Removedhas-ansi@0.1.0(transitive)
- Removedstrip-ansi@0.3.0(transitive)
- Removedsupports-color@0.2.0(transitive)
Updatedchalk@^1.0.0