time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

index.js (1997B)


      1 /**
      2 * @license Apache-2.0
      3 *
      4 * Copyright (c) 2018 The Stdlib Authors.
      5 *
      6 * Licensed under the Apache License, Version 2.0 (the "License");
      7 * you may not use this file except in compliance with the License.
      8 * You may obtain a copy of the License at
      9 *
     10 *    http://www.apache.org/licenses/LICENSE-2.0
     11 *
     12 * Unless required by applicable law or agreed to in writing, software
     13 * distributed under the License is distributed on an "AS IS" BASIS,
     14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15 * See the License for the specific language governing permissions and
     16 * limitations under the License.
     17 */
     18 
     19 'use strict';
     20 
     21 /**
     22 * Create an "empty" readable stream.
     23 *
     24 * @module @stdlib/streams/node/empty
     25 *
     26 * @example
     27 * var inspectStream = require( '@stdlib/streams/node/inspect-sink' );
     28 * var emptyStream = require( '@stdlib/streams/node/empty' );
     29 *
     30 * function log( chunk ) {
     31 *    console.log( chunk.toString() );
     32 * }
     33 *
     34 * var stream = emptyStream();
     35 *
     36 * stream.pipe( inspectStream( log ) );
     37 *
     38 * @example
     39 * var emptyStream = require( '@stdlib/streams/node/empty' );
     40 *
     41 * var opts = {
     42 *     'objectMode': false
     43 * };
     44 *
     45 * var createStream = emptyStream.factory( opts );
     46 *
     47 * // Create 10 identically configured streams...
     48 * var streams = [];
     49 * var i;
     50 * for ( i = 0; i < 10; i++ ) {
     51 *     streams.push( createStream() );
     52 * }
     53 *
     54 * @example
     55 * var inspectStream = require( '@stdlib/streams/node/inspect-sink' );
     56 * var emptyStream = require( '@stdlib/streams/node/empty' );
     57 *
     58 * function log( v ) {
     59 *    console.log( v );
     60 * }
     61 *
     62 * var stream = emptyStream.objectMode();
     63 *
     64 * stream.pipe( inspectStream.objectMode( log ) );
     65 */
     66 
     67 
     68 // MODULES //
     69 
     70 var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
     71 var stream = require( './main.js' );
     72 var objectMode = require( './object_mode.js' );
     73 var factory = require( './factory.js' );
     74 
     75 
     76 // MAIN //
     77 
     78 setReadOnly( stream, 'objectMode', objectMode );
     79 setReadOnly( stream, 'factory', factory );
     80 
     81 
     82 // EXPORTS //
     83 
     84 module.exports = stream;