Archived
1
0
This repository has been archived on 2023-05-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
home-page/node_modules/resolve-url-loader/lib/log-to-test-harness.js
Sean Edmunds 0584430b5c First commit
2021-12-13 17:00:40 -06:00

27 lines
743 B
JavaScript

/*
* 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;