Gathering detailed insights and metrics for @stdlib/array-nans-like
Gathering detailed insights and metrics for @stdlib/array-nans-like
Gathering detailed insights and metrics for @stdlib/array-nans-like
Gathering detailed insights and metrics for @stdlib/array-nans-like
Create an array filled with NaNs and having the same length and data type as a provided array.
npm install @stdlib/array-nans-like
Typescript
Module System
Min. Node Version
Node Version
NPM Version
66.3
Supply Chain
78.6
Quality
80.4
Maintenance
100
Vulnerability
99.6
License
JavaScript (100%)
Total Downloads
661
Last Day
1
Last Week
5
Last Month
17
Last Year
148
Apache-2.0 License
1 Stars
25 Commits
3 Watchers
5 Branches
14 Contributors
Updated on Jun 25, 2025
Minified
Minified + Gzipped
Latest Version
0.2.1
Package Id
@stdlib/array-nans-like@0.2.1
Unpacked Size
39.38 kB
Size
9.37 kB
File Count
11
NPM Version
8.19.4
Node Version
16.20.2
Published on
Feb 25, 2024
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
25%
5
Compared to previous week
Last Month
-19%
17
Compared to previous month
Last Year
-66%
148
Compared to previous year
We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.
The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.
When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.
To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
Create an array filled with NaNs and having the same length and data type as a provided array.
1npm install @stdlib/array-nans-like
1var nansLike = require( '@stdlib/array-nans-like' );
Creates an array filled with NaNs and having the same length and data type as a provided array x
.
1var x = [ 1, 2, 3, 4, 5 ]; 2 3var arr = nansLike( x ); 4// returns [ NaN, NaN, NaN, NaN, NaN ]
The function supports the following data types:
float64
: double-precision floating-point numbers (IEEE 754)float32
: single-precision floating-point numbers (IEEE 754)complex128
: double-precision complex floating-point numberscomplex64
: single-precision complex floating-point numbersgeneric
: generic JavaScript valuesBy default, the output array data type is inferred from the provided array x
. To return an array having a different data type, provide a dtype
argument.
1var x = [ 0, 0 ]; 2 3var arr = nansLike( x, 'float32' ); 4// returns <Float32Array>[ NaN, NaN ]
NaN
and an imaginary component equal to NaN
.1var dtypes = require( '@stdlib/array-typed-float-dtypes' ); 2var zeros = require( '@stdlib/array-zeros' ); 3var nansLike = require( '@stdlib/array-nans-like' ); 4 5// Create a zero-filled array: 6var x = zeros( 4, 'complex128' ); 7 8// Get a list of array data types: 9var dt = dtypes(); 10 11// Generate filled arrays... 12var y; 13var i; 14for ( i = 0; i < dt.length; i++ ) { 15 y = nansLike( x, dt[ i ] ); 16 console.log( y ); 17}
@stdlib/array-full-like
: create a filled array having the same length and data type as a provided array.@stdlib/array-nans
: create an array filled with NaNs and having a specified length.@stdlib/array-ones-like
: create an array filled with ones and having the same length and data type as a provided array.@stdlib/array-zeros-like
: create a zero-filled array having the same length and data type as a provided array.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.
See LICENSE.
Copyright © 2016-2024. The Stdlib Authors.
No vulnerabilities found.
No security vulnerabilities found.