1 |
|
2 |
|
3 |
|
4 |
|
5 | 'use strict';
|
6 |
|
7 | var stream = require('stream');
|
8 |
|
9 | var maybeStream = process[process.env.RESOLVE_URL_LOADER_TEST_HARNESS];
|
10 |
|
11 | function logToTestHarness(options) {
|
12 | if (!!maybeStream && (typeof maybeStream === 'object') && (maybeStream instanceof stream.Writable)) {
|
13 | Object.keys(options).map(eachOptionKey);
|
14 | maybeStream = null;
|
15 | }
|
16 |
|
17 | function eachOptionKey(key) {
|
18 | var value = options[key];
|
19 | var text = (typeof value === 'undefined') ?
|
20 | String(value) :
|
21 | (JSON.stringify(value.valueOf()) || '-unstringifyable-');
|
22 | maybeStream.write(key + ': ' + text + '\n');
|
23 | }
|
24 | }
|
25 |
|
26 | module.exports = logToTestHarness;
|