damn-utils
Version:
Collection of some damn utilities
22 lines (17 loc) • 481 B
JavaScript
;
const _ = require('lodash');
const expose = require('./expose');
module.exports = function(objects, format) {
if (format == null) {
format = '%s';
}
var results = [];
_.forEach(objects, (object, key) => {
if (_.isFunction(format)) {
results.push(expose(object, format(key)));
} else {
results.push(expose(object, sprintf(format, key)));
}
});
return results;
};