🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@stdlib/console-log-each

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/console-log-each

Insert array element values into a format string and print the result.

Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
1.2K
105.14%
Maintainers
4
Weekly downloads
 
Created
Source

logEach

NPM version Build Status Coverage Status

Insert array element values into a format string and print the result.

Installation

npm install @stdlib/console-log-each

Usage

var logEach = require( '@stdlib/console-log-each' );

logEach( str[, ...args] )

Inserts array element values into a format string and prints the result.

var x = [ 1, 2, 3 ];
var y = [ 4, 5, 6 ];

logEach( '%d < %d ', x, y );
// e.g., => '1 < 4\n2 < 5\n3 < 6\n'

If an interpolated argument is not a collection, the argument is broadcasted for each iteration.

var x = [ 1, 2, 3 ];
var y = 4;

logEach( '%d < %d', x, y );
// e.g., => '1 < 4\n2 < 4\n3 < 4\n'

Notes

  • If the function is provided collections of unequal lengths, the function throws an error.

Examples

var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory;
var naryFunction = require( '@stdlib/utils-nary-function' );
var filledBy = require( '@stdlib/array-filled-by' );
var map = require( '@stdlib/utils-map' );
var abs = require( '@stdlib/math-base-special-abs' );
var logEach = require( '@stdlib/console-log-each' );

var rand = discreteUniform( -50, 50 );
var x = filledBy( 10, 'float64', rand );

var y = map( x, naryFunction( abs, 1 ) );
logEach( 'abs(%d) = %d', x, y );

Notice

This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.

Community

Chat

License

See LICENSE.

Copyright © 2016-2022. The Stdlib Authors.

Keywords

stdlib

FAQs

Package last updated on 31 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts