@stdlib/console-log-each 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +12 -10
- package/dist/index.js +18 -4
- package/dist/index.js.map +2 -2
- package/docs/types/index.d.ts +14 -2
- package/lib/index.js +12 -0
- package/lib/main.js +22 -1
- package/package.json +18 -8
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ limitations under the License.
|
|
|
33
33
|
|
|
34
34
|
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
35
35
|
|
|
36
|
-
> Insert array element values into a format string and print the result.
|
|
36
|
+
> Insert array element values into a [format string][@stdlib/string/format] and print the result.
|
|
37
37
|
|
|
38
38
|
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
|
|
39
39
|
|
|
@@ -65,7 +65,7 @@ var logEach = require( '@stdlib/console-log-each' );
|
|
|
65
65
|
|
|
66
66
|
#### logEach( str\[, ...args] )
|
|
67
67
|
|
|
68
|
-
Inserts array element values into a format string and prints the result.
|
|
68
|
+
Inserts array element values into a [format string][@stdlib/string/format] and prints the result.
|
|
69
69
|
|
|
70
70
|
```javascript
|
|
71
71
|
var x = [ 1, 2, 3 ];
|
|
@@ -79,10 +79,10 @@ If an interpolated argument is not an array-like object, the argument is broadca
|
|
|
79
79
|
|
|
80
80
|
```javascript
|
|
81
81
|
var x = [ 1, 2, 3 ];
|
|
82
|
-
var y =
|
|
82
|
+
var y = 0.5;
|
|
83
83
|
|
|
84
|
-
logEach( '%
|
|
85
|
-
// e.g., => '1
|
|
84
|
+
logEach( '%0.1f > %0.1f', x, y );
|
|
85
|
+
// e.g., => '1.0 > 0.5\n2.0 > 0.5\n3.0 > 0.5\n'
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
</section>
|
|
@@ -171,7 +171,7 @@ See [LICENSE][stdlib-license].
|
|
|
171
171
|
|
|
172
172
|
## Copyright
|
|
173
173
|
|
|
174
|
-
Copyright © 2016-
|
|
174
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
175
175
|
|
|
176
176
|
</section>
|
|
177
177
|
|
|
@@ -184,8 +184,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
184
184
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/console-log-each.svg
|
|
185
185
|
[npm-url]: https://npmjs.org/package/@stdlib/console-log-each
|
|
186
186
|
|
|
187
|
-
[test-image]: https://github.com/stdlib-js/console-log-each/actions/workflows/test.yml/badge.svg?branch=v0.2.
|
|
188
|
-
[test-url]: https://github.com/stdlib-js/console-log-each/actions/workflows/test.yml?query=branch:v0.2.
|
|
187
|
+
[test-image]: https://github.com/stdlib-js/console-log-each/actions/workflows/test.yml/badge.svg?branch=v0.2.3
|
|
188
|
+
[test-url]: https://github.com/stdlib-js/console-log-each/actions/workflows/test.yml?query=branch:v0.2.3
|
|
189
189
|
|
|
190
190
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/console-log-each/main.svg
|
|
191
191
|
[coverage-url]: https://codecov.io/github/stdlib-js/console-log-each?branch=main
|
|
@@ -197,8 +197,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
197
197
|
|
|
198
198
|
-->
|
|
199
199
|
|
|
200
|
-
[chat-image]: https://img.shields.io/
|
|
201
|
-
[chat-url]: https://
|
|
200
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
201
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
202
202
|
|
|
203
203
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
204
204
|
|
|
@@ -221,6 +221,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
221
221
|
|
|
222
222
|
[@stdlib/array/complex64]: https://www.npmjs.com/package/@stdlib/array-complex64
|
|
223
223
|
|
|
224
|
+
[@stdlib/string/format]: https://www.npmjs.com/package/@stdlib/string-format
|
|
225
|
+
|
|
224
226
|
</section>
|
|
225
227
|
|
|
226
228
|
<!-- /.links -->
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
"use strict";var d=function(i,s){return function(){return s||i((s={exports:{}}).exports,s),s.exports}};var c=d(function(y,m){
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";var d=function(i,s){return function(){return s||i((s={exports:{}}).exports,s),s.exports}};var c=d(function(y,m){"use strict";var q=require("@stdlib/assert-is-string").isPrimitive,p=require("@stdlib/assert-is-collection"),g=require("@stdlib/array-base-resolve-getter"),f=require("@stdlib/string-format"),w=require("@stdlib/console-log");function E(i){var s,l,t,o,u,n,v,r,h,e,a;if(!q(i))throw new TypeError(f("invalid argument. First argument must be a string. Value: `%s`.",i));for(u=arguments.length,t=[],s=[],n=[],e=1;e<u;e++)if(r=arguments[e],p(r)){t.push(g(r)),n.push(r),s.push(1),v=r.length,e+=1;break}else r=[r],t.push(g(r)),n.push(r),s.push(0);for(v===void 0&&(v=1);e<u;e++){if(r=arguments[e],p(r)){if(r.length!==v)throw new RangeError("invalid argument. Provided collections must have the same length.");h=1}else r=[r],h=0;t.push(g(r)),n.push(r),s.push(h)}for(o=[i],l=[],e=1;e<u;e++)o.push(null),l.push(0);for(e=0;e<v;e++){for(a=0;a<u-1;a++)o[a+1]=t[a](n[a],l[a]),l[a]+=s[a];w(f.apply(null,o))}}m.exports=E});var b=c();module.exports=b;
|
|
2
|
+
/**
|
|
3
|
+
* @license Apache-2.0
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2022 The Stdlib Authors.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
5
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../lib/main.js", "../lib/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar resolveGetter = require( '@stdlib/array-base-resolve-getter' );\nvar format = require( '@stdlib/string-format' );\nvar logger = require( '@stdlib/console-log' );\n\n\n// MAIN //\n\n/**\n* Inserts array element values into a format string and prints the result.\n*\n* @param {string} str - format string\n* @param {...(Collection|*)} args - collections or values\n* @throws {TypeError} first argument must be a string\n* @throws {RangeError} provided collections must have the same length\n* @returns {void}\n*/\nfunction logEach( str ) {\n\tvar strides;\n\tvar offsets;\n\tvar getters;\n\tvar values;\n\tvar nargs;\n\tvar args;\n\tvar len;\n\tvar v;\n\tvar s;\n\tvar i;\n\tvar j;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tnargs = arguments.length;\n\tgetters = [];\n\tstrides = [];\n\targs = [];\n\tfor ( i = 1; i < nargs; i++ ) {\n\t\tv = arguments[ i ];\n\t\tif ( isCollection( v ) ) {\n\t\t\tgetters.push( resolveGetter( v ) );\n\t\t\targs.push( v );\n\t\t\tstrides.push( 1 );\n\t\t\tlen = v.length;\n\t\t\ti += 1;\n\t\t\tbreak;\n\t\t} else {\n\t\t\tv = [ v ];\n\t\t\tgetters.push( resolveGetter( v ) );\n\t\t\targs.push( v );\n\t\t\tstrides.push( 0 );\n\t\t}\n\t}\n\tif ( len === void 0 ) {\n\t\tlen = 1;\n\t}\n\tfor ( ; i < nargs; i++ ) {\n\t\tv = arguments[ i ];\n\t\tif ( isCollection( v ) ) {\n\t\t\tif ( v.length !== len ) {\n\t\t\t\tthrow new RangeError( 'invalid argument. Provided collections must have the same length.' );\n\t\t\t}\n\t\t\ts = 1;\n\t\t} else {\n\t\t\tv = [ v ];\n\t\t\ts = 0;\n\t\t}\n\t\tgetters.push( resolveGetter( v ) );\n\t\targs.push( v );\n\t\tstrides.push( s );\n\t}\n\tvalues = [ str ];\n\toffsets = [];\n\tfor ( i = 1; i < nargs; i++ ) {\n\t\tvalues.push( null );\n\t\toffsets.push( 0 );\n\t}\n\tfor ( i = 0; i < len; i++ ) {\n\t\tfor ( j = 0; j < nargs-1; j++ ) {\n\t\t\tvalues[ j+1 ] = getters[ j ]( args[ j ], offsets[ j ] );\n\t\t\toffsets[ j ] += strides[ j ];\n\t\t}\n\t\tlogger( format.apply( null, values ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = logEach;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Insert array element values into a format string and print the result.\n*\n* @module @stdlib/console-log-each\n*\n* @example\n* var logEach = require( '@stdlib/console-log-each' );\n*\n* var x = [ 1, 2, 3 ];\n* var y = [ 4, 5, 6 ];\n*\n* logEach( '%d < %d ', x, y );\n* // e.g., => '1 < 4\\n2 < 5\\n3 < 6\\n'\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
-
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAe,QAAS,8BAA+B,EACvDC,EAAgB,QAAS,mCAAoC,EAC7DC,EAAS,QAAS,uBAAwB,EAC1CC,EAAS,QAAS,qBAAsB,
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar resolveGetter = require( '@stdlib/array-base-resolve-getter' );\nvar format = require( '@stdlib/string-format' );\nvar logger = require( '@stdlib/console-log' );\n\n\n// MAIN //\n\n/**\n* Inserts array element values into a format string and prints the result.\n*\n* @param {string} str - format string\n* @param {...(Collection|*)} [args] - collections or values\n* @throws {TypeError} first argument must be a string\n* @throws {RangeError} provided collections must have the same length\n* @returns {void}\n*\n* @example\n* var x = [ 1, 2, 3 ];\n* var y = [ 4, 5, 6 ];\n*\n* logEach( '%d < %d ', x, y );\n* // e.g., => '1 < 4\\n2 < 5\\n3 < 6\\n'\n*\n* @example\n* var x = [ 0.5, 1.0, 1.5 ];\n* var y = [ 0.25, 0.5, 0.75 ];\n*\n* logEach( '%0.2f > %0.2f', x, y );\n* // e.g., => '0.50 > 0.25\\n1.00 > 0.50\\n1.50 > 0.75\\n'\n*\n* @example\n* var x = [ 'foo', 'bar' ];\n* var y = [ 'beep', 'boop' ];\n*\n* logEach( 'x: %s, y: %s', x, y );\n* // e.g., => 'x: foo, y: beep\\nx: bar, y: boop\\n'\n*/\nfunction logEach( str ) {\n\tvar strides;\n\tvar offsets;\n\tvar getters;\n\tvar values;\n\tvar nargs;\n\tvar args;\n\tvar len;\n\tvar v;\n\tvar s;\n\tvar i;\n\tvar j;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tnargs = arguments.length;\n\tgetters = [];\n\tstrides = [];\n\targs = [];\n\tfor ( i = 1; i < nargs; i++ ) {\n\t\tv = arguments[ i ];\n\t\tif ( isCollection( v ) ) {\n\t\t\tgetters.push( resolveGetter( v ) );\n\t\t\targs.push( v );\n\t\t\tstrides.push( 1 );\n\t\t\tlen = v.length;\n\t\t\ti += 1;\n\t\t\tbreak;\n\t\t} else {\n\t\t\tv = [ v ];\n\t\t\tgetters.push( resolveGetter( v ) );\n\t\t\targs.push( v );\n\t\t\tstrides.push( 0 );\n\t\t}\n\t}\n\tif ( len === void 0 ) {\n\t\tlen = 1;\n\t}\n\tfor ( ; i < nargs; i++ ) {\n\t\tv = arguments[ i ];\n\t\tif ( isCollection( v ) ) {\n\t\t\tif ( v.length !== len ) {\n\t\t\t\tthrow new RangeError( 'invalid argument. Provided collections must have the same length.' );\n\t\t\t}\n\t\t\ts = 1;\n\t\t} else {\n\t\t\tv = [ v ];\n\t\t\ts = 0;\n\t\t}\n\t\tgetters.push( resolveGetter( v ) );\n\t\targs.push( v );\n\t\tstrides.push( s );\n\t}\n\tvalues = [ str ];\n\toffsets = [];\n\tfor ( i = 1; i < nargs; i++ ) {\n\t\tvalues.push( null );\n\t\toffsets.push( 0 );\n\t}\n\tfor ( i = 0; i < len; i++ ) {\n\t\tfor ( j = 0; j < nargs-1; j++ ) {\n\t\t\tvalues[ j+1 ] = getters[ j ]( args[ j ], offsets[ j ] );\n\t\t\toffsets[ j ] += strides[ j ];\n\t\t}\n\t\tlogger( format.apply( null, values ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = logEach;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Insert array element values into a format string and print the result.\n*\n* @module @stdlib/console-log-each\n*\n* @example\n* var logEach = require( '@stdlib/console-log-each' );\n*\n* var x = [ 1, 2, 3 ];\n* var y = [ 4, 5, 6 ];\n*\n* logEach( '%d < %d ', x, y );\n* // e.g., => '1 < 4\\n2 < 5\\n3 < 6\\n'\n*\n* var x = [ 0.5, 1.0, 1.5 ];\n* var y = [ 0.25, 0.5, 0.75 ];\n*\n* logEach( '%0.2f > %0.2f', x, y );\n* // e.g., => '0.50 > 0.25\\n1.00 > 0.50\\n1.50 > 0.75\\n'\n*\n* var x = [ 'foo', 'bar' ];\n* var y = [ 'beep', 'boop' ];\n*\n* logEach( 'x: %s, y: %s', x, y );\n* // e.g., => 'x: foo, y: beep\\nx: bar, y: boop\\n'\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAe,QAAS,8BAA+B,EACvDC,EAAgB,QAAS,mCAAoC,EAC7DC,EAAS,QAAS,uBAAwB,EAC1CC,EAAS,QAAS,qBAAsB,EAmC5C,SAASC,EAASC,EAAM,CACvB,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACJ,GAAK,CAACjB,EAAUM,CAAI,EACnB,MAAM,IAAI,UAAWH,EAAQ,kEAAmEG,CAAI,CAAE,EAMvG,IAJAK,EAAQ,UAAU,OAClBF,EAAU,CAAC,EACXF,EAAU,CAAC,EACXK,EAAO,CAAC,EACFI,EAAI,EAAGA,EAAIL,EAAOK,IAEvB,GADAF,EAAI,UAAWE,CAAE,EACZf,EAAca,CAAE,EAAI,CACxBL,EAAQ,KAAMP,EAAeY,CAAE,CAAE,EACjCF,EAAK,KAAME,CAAE,EACbP,EAAQ,KAAM,CAAE,EAChBM,EAAMC,EAAE,OACRE,GAAK,EACL,KACD,MACCF,EAAI,CAAEA,CAAE,EACRL,EAAQ,KAAMP,EAAeY,CAAE,CAAE,EACjCF,EAAK,KAAME,CAAE,EACbP,EAAQ,KAAM,CAAE,EAMlB,IAHKM,IAAQ,SACZA,EAAM,GAECG,EAAIL,EAAOK,IAAM,CAExB,GADAF,EAAI,UAAWE,CAAE,EACZf,EAAca,CAAE,EAAI,CACxB,GAAKA,EAAE,SAAWD,EACjB,MAAM,IAAI,WAAY,mEAAoE,EAE3FE,EAAI,CACL,MACCD,EAAI,CAAEA,CAAE,EACRC,EAAI,EAELN,EAAQ,KAAMP,EAAeY,CAAE,CAAE,EACjCF,EAAK,KAAME,CAAE,EACbP,EAAQ,KAAMQ,CAAE,CACjB,CAGA,IAFAL,EAAS,CAAEJ,CAAI,EACfE,EAAU,CAAC,EACLQ,EAAI,EAAGA,EAAIL,EAAOK,IACvBN,EAAO,KAAM,IAAK,EAClBF,EAAQ,KAAM,CAAE,EAEjB,IAAMQ,EAAI,EAAGA,EAAIH,EAAKG,IAAM,CAC3B,IAAMC,EAAI,EAAGA,EAAIN,EAAM,EAAGM,IACzBP,EAAQO,EAAE,CAAE,EAAIR,EAASQ,CAAE,EAAGL,EAAMK,CAAE,EAAGT,EAASS,CAAE,CAAE,EACtDT,EAASS,CAAE,GAAKV,EAASU,CAAE,EAE5Bb,EAAQD,EAAO,MAAO,KAAMO,CAAO,CAAE,CACtC,CACD,CAKAX,EAAO,QAAUM,ICnFjB,IAAIa,EAAO,IAKX,OAAO,QAAUA",
|
|
6
6
|
"names": ["require_main", "__commonJSMin", "exports", "module", "isString", "isCollection", "resolveGetter", "format", "logger", "logEach", "str", "strides", "offsets", "getters", "values", "nargs", "args", "len", "v", "s", "i", "j", "main"]
|
|
7
7
|
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -30,13 +30,25 @@
|
|
|
30
30
|
* @throws provided collections must have the same length
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
|
-
* var logEach = require( '@stdlib/console-log-each' );
|
|
34
|
-
*
|
|
35
33
|
* var x = [ 1, 2, 3 ];
|
|
36
34
|
* var y = [ 4, 5, 6 ];
|
|
37
35
|
*
|
|
38
36
|
* logEach( '%d < %d ', x, y );
|
|
39
37
|
* // e.g., => '1 < 4\n2 < 5\n3 < 6\n'
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* var x = [ 0.5, 1.0, 1.5 ];
|
|
41
|
+
* var y = [ 0.25, 0.5, 0.75 ];
|
|
42
|
+
*
|
|
43
|
+
* logEach( '%0.2f > %0.2f', x, y );
|
|
44
|
+
* // e.g., => '0.50 > 0.25\n1.00 > 0.50\n1.50 > 0.75\n'
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* var x = [ 'foo', 'bar' ];
|
|
48
|
+
* var y = [ 'beep', 'boop' ];
|
|
49
|
+
*
|
|
50
|
+
* logEach( 'x: %s, y: %s', x, y );
|
|
51
|
+
* // e.g., => 'x: foo, y: beep\nx: bar, y: boop\n'
|
|
40
52
|
*/
|
|
41
53
|
declare function logEach( str: string, ...args: any ): void;
|
|
42
54
|
|
package/lib/index.js
CHANGED
|
@@ -31,6 +31,18 @@
|
|
|
31
31
|
*
|
|
32
32
|
* logEach( '%d < %d ', x, y );
|
|
33
33
|
* // e.g., => '1 < 4\n2 < 5\n3 < 6\n'
|
|
34
|
+
*
|
|
35
|
+
* var x = [ 0.5, 1.0, 1.5 ];
|
|
36
|
+
* var y = [ 0.25, 0.5, 0.75 ];
|
|
37
|
+
*
|
|
38
|
+
* logEach( '%0.2f > %0.2f', x, y );
|
|
39
|
+
* // e.g., => '0.50 > 0.25\n1.00 > 0.50\n1.50 > 0.75\n'
|
|
40
|
+
*
|
|
41
|
+
* var x = [ 'foo', 'bar' ];
|
|
42
|
+
* var y = [ 'beep', 'boop' ];
|
|
43
|
+
*
|
|
44
|
+
* logEach( 'x: %s, y: %s', x, y );
|
|
45
|
+
* // e.g., => 'x: foo, y: beep\nx: bar, y: boop\n'
|
|
34
46
|
*/
|
|
35
47
|
|
|
36
48
|
// MODULES //
|
package/lib/main.js
CHANGED
|
@@ -33,10 +33,31 @@ var logger = require( '@stdlib/console-log' );
|
|
|
33
33
|
* Inserts array element values into a format string and prints the result.
|
|
34
34
|
*
|
|
35
35
|
* @param {string} str - format string
|
|
36
|
-
* @param {...(Collection|*)} args - collections or values
|
|
36
|
+
* @param {...(Collection|*)} [args] - collections or values
|
|
37
37
|
* @throws {TypeError} first argument must be a string
|
|
38
38
|
* @throws {RangeError} provided collections must have the same length
|
|
39
39
|
* @returns {void}
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* var x = [ 1, 2, 3 ];
|
|
43
|
+
* var y = [ 4, 5, 6 ];
|
|
44
|
+
*
|
|
45
|
+
* logEach( '%d < %d ', x, y );
|
|
46
|
+
* // e.g., => '1 < 4\n2 < 5\n3 < 6\n'
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* var x = [ 0.5, 1.0, 1.5 ];
|
|
50
|
+
* var y = [ 0.25, 0.5, 0.75 ];
|
|
51
|
+
*
|
|
52
|
+
* logEach( '%0.2f > %0.2f', x, y );
|
|
53
|
+
* // e.g., => '0.50 > 0.25\n1.00 > 0.50\n1.50 > 0.75\n'
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* var x = [ 'foo', 'bar' ];
|
|
57
|
+
* var y = [ 'beep', 'boop' ];
|
|
58
|
+
*
|
|
59
|
+
* logEach( 'x: %s, y: %s', x, y );
|
|
60
|
+
* // e.g., => 'x: foo, y: beep\nx: bar, y: boop\n'
|
|
40
61
|
*/
|
|
41
62
|
function logEach( str ) {
|
|
42
63
|
var strides;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/console-log-each",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Insert array element values into a format string and print the result.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@stdlib/array-base-resolve-getter": "^0.2.
|
|
34
|
-
"@stdlib/assert-is-collection": "^0.2.
|
|
35
|
-
"@stdlib/assert-is-string": "^0.2.
|
|
36
|
-
"@stdlib/console-log": "^0.2.
|
|
37
|
-
"@stdlib/string-format": "^0.2.
|
|
38
|
-
"@stdlib/error-tools-fmtprodmsg": "^0.2.
|
|
33
|
+
"@stdlib/array-base-resolve-getter": "^0.2.2",
|
|
34
|
+
"@stdlib/assert-is-collection": "^0.2.2",
|
|
35
|
+
"@stdlib/assert-is-string": "^0.2.2",
|
|
36
|
+
"@stdlib/console-log": "^0.2.2",
|
|
37
|
+
"@stdlib/string-format": "^0.2.2",
|
|
38
|
+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {},
|
|
41
41
|
"engines": {
|
|
@@ -54,7 +54,17 @@
|
|
|
54
54
|
"windows"
|
|
55
55
|
],
|
|
56
56
|
"keywords": [
|
|
57
|
-
"stdlib"
|
|
57
|
+
"stdlib",
|
|
58
|
+
"console",
|
|
59
|
+
"log",
|
|
60
|
+
"debug",
|
|
61
|
+
"logger",
|
|
62
|
+
"print",
|
|
63
|
+
"stdout",
|
|
64
|
+
"array",
|
|
65
|
+
"each",
|
|
66
|
+
"element",
|
|
67
|
+
"format"
|
|
58
68
|
],
|
|
59
69
|
"funding": {
|
|
60
70
|
"type": "opencollective",
|