Files
bower/lib/util/read-json.js
Chris Aniszczyk c220329337 Initial Release
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-09-06 17:11:42 -07:00

24 lines
740 B
JavaScript

// ==========================================
// BOWER: read-json.js - with logging fun
// ==========================================
// Copyright 2012 Twitter, Inc
// Licensed under The MIT License
// http://opensource.org/licenses/MIT
// ==========================================
var readJSON = require('read-package-json');
var template = require('./template');
var read = module.exports = function (path, cb, obj) {
readJSON.log = {
info: function () {},
verbose: function () {},
warn: function (what, name, shizzle) {
if (read.showWarnings) {
template('warn', { name: name.replace(/@/, '#'), shizzle: shizzle })
.on('data', obj.emit.bind(obj, 'data'));
}
}
}
readJSON(path, cb);
}