source: frontend/node_modules/readable-stream/lib/internal/streams/state.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 745 bytes
RevLine 
[9af201e]1'use strict';
2
3var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;
4function highWaterMarkFrom(options, isDuplex, duplexKey) {
5 return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
6}
7function getHighWaterMark(state, options, duplexKey, isDuplex) {
8 var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
9 if (hwm != null) {
10 if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
11 var name = isDuplex ? duplexKey : 'highWaterMark';
12 throw new ERR_INVALID_OPT_VALUE(name, hwm);
13 }
14 return Math.floor(hwm);
15 }
16
17 // Default value
18 return state.objectMode ? 16 : 16 * 1024;
19}
20module.exports = {
21 getHighWaterMark: getHighWaterMark
22};
Note: See TracBrowser for help on using the repository browser.