You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
743 B
27 lines
743 B
/*
|
|
* MIT License http://opensource.org/licenses/MIT
|
|
* Author: Ben Holloway @bholloway
|
|
*/
|
|
'use strict';
|
|
|
|
var stream = require('stream');
|
|
|
|
var maybeStream = process[process.env.RESOLVE_URL_LOADER_TEST_HARNESS];
|
|
|
|
function logToTestHarness(options) {
|
|
if (!!maybeStream && (typeof maybeStream === 'object') && (maybeStream instanceof stream.Writable)) {
|
|
Object.keys(options).map(eachOptionKey);
|
|
maybeStream = null; // ensure we log only once
|
|
}
|
|
|
|
function eachOptionKey(key) {
|
|
var value = options[key];
|
|
var text = (typeof value === 'undefined') ?
|
|
String(value) :
|
|
(JSON.stringify(value.valueOf()) || '-unstringifyable-');
|
|
maybeStream.write(key + ': ' + text + '\n');
|
|
}
|
|
}
|
|
|
|
module.exports = logToTestHarness;
|