Socket
Socket
Sign inDemoInstall

hook-std

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.3.0

26

index.js

@@ -9,8 +9,10 @@ 'use strict';

var std = process[type];
var write = std.write;
opts = Object.assign({silent: true}, opts);
std.write = function (str, enc, cb2) {
var cbRet = cb(str, enc);
const std = process[type];
const write = std.write;
std.write = (str, enc, cb2) => {
const cbRet = cb(str, enc);
if (opts.silent) {

@@ -20,7 +22,7 @@ return typeof cbRet === 'boolean' ? cbRet : true;

var ret = Buffer.isBuffer(cbRet) || typeof cbRet === 'string' ? cbRet : str;
const ret = Buffer.isBuffer(cbRet) || typeof cbRet === 'string' ? cbRet : str;
return write.call(std, ret, enc, cb2);
};
return function () {
return () => {
std.write = write;

@@ -30,7 +32,7 @@ };

var x = module.exports = function (opts, cb) {
var unhookStdout = hook('stdout', opts, cb);
var unhookStderr = hook('stderr', opts, cb);
module.exports = (opts, cb) => {
const unhookStdout = hook('stdout', opts, cb);
const unhookStderr = hook('stderr', opts, cb);
return function () {
return () => {
unhookStdout();

@@ -41,3 +43,3 @@ unhookStderr();

x.stdout = hook.bind(null, 'stdout');
x.stderr = hook.bind(null, 'stderr');
module.exports.stdout = hook.bind(null, 'stdout');
module.exports.stderr = hook.bind(null, 'stderr');
{
"name": "hook-std",
"version": "0.2.0",
"version": "0.3.0",
"description": "Hook and modify stdout/stderr",

@@ -13,3 +13,3 @@ "license": "MIT",

"engines": {
"node": ">=0.10.0"
"node": ">=4"
},

@@ -16,0 +16,0 @@ "scripts": {

@@ -53,4 +53,4 @@ # hook-std [![Build Status](https://travis-ci.org/sindresorhus/hook-std.svg?branch=master)](https://travis-ci.org/sindresorhus/hook-std)

Type: `boolean`
Default: `false`
Type: `boolean`<br>
Default: `true`

@@ -61,3 +61,3 @@ Suppress stdout/stderr output.

Type: `function`
Type: `Function`

@@ -69,2 +69,2 @@ Receives stdout/stderr as the first argument. Return a string to modify it. Optionally, when in silent mode, you may return a `boolean` to influence the return value of `.write(...)`.

MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc