Gathering detailed insights and metrics for @stdlib/array-typed
Gathering detailed insights and metrics for @stdlib/array-typed
Gathering detailed insights and metrics for @stdlib/array-typed
Gathering detailed insights and metrics for @stdlib/array-typed
npm install @stdlib/array-typed
Typescript
Module System
Min. Node Version
Node Version
NPM Version
66.8
Supply Chain
79
Quality
81.5
Maintenance
100
Vulnerability
87.6
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
1 Stars
61 Commits
3 Watchers
5 Branches
13 Contributors
Updated on Apr 07, 2025
Minified
Minified + Gzipped
Latest Version
0.3.0
Package Id
@stdlib/array-typed@0.3.0
Unpacked Size
48.62 kB
Size
10.74 kB
File Count
11
NPM Version
8.19.4
Node Version
16.20.2
Published on
Jul 29, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
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 a typed array.
1npm install @stdlib/array-typed
1var typedarray = require( '@stdlib/array-typed' );
Creates a typed array having a specified data type.
1var arr = typedarray(); 2// returns <Float64Array>
By default, the output typed array data type is float64
. To specify an alternative data type, provide a dtype
argument.
1var arr = typedarray( 'int32' ); 2// returns <Int32Array>
Returns a typed array having a specified length
.
1var arr1 = typedarray( 5 ); 2// returns <Float64Array>[ 0.0, 0.0, 0.0, 0.0, 0.0 ] 3 4var arr2 = typedarray( 5, 'uint8' ); 5// returns <Uint8Array>[ 0, 0, 0, 0, 0 ]
Creates a typed array from another typed array.
1var arr1 = typedarray( [ 5.0, -3.0, 2.0 ] ); 2// returns <Float64Array>[ 5.0, -3.0, 2.0 ] 3 4var arr2 = typedarray( arr1 ); 5// returns <Float64Array>[ 5.0, -3.0, 2.0 ] 6 7var arr3 = typedarray( arr1, 'int32' ); 8// returns <Int32Array>[ 5, -3, 2 ]
Creates a typed array from an array-like object or iterable.
1var arr1 = typedarray( [ 0.5, 0.5, 0.5 ] ); 2// returns <Float64Array>[ 0.5, 0.5, 0.5 ] 3 4var arr2 = typedarray( [ 0.5, 0.5, 0.5 ], 'float32' ); 5// returns <Float32Array>[ 0.5, 0.5, 0.5 ]
If dtype
is complex number data type and an array-like object contains interleaved real and imaginary components, the array-like object must have a length which is a multiple of two.
Returns a typed array view of an ArrayBuffer
.
1var ArrayBuffer = require( '@stdlib/array-buffer' ); 2var buf = new ArrayBuffer( 32 ); 3 4var arr1 = typedarray( buf ); 5// returns <Float64Array>[ 0.0, 0.0, 0.0, 0.0 ] 6 7var arr2 = typedarray( buf, 'float32' ); 8// returns <Float32Array>[ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] 9 10var arr3 = typedarray( buf, 16 ); 11// returns <Float64Array>[ 0.0, 0.0 ] 12 13var arr4 = typedarray( buf, 16, 'float32' ); 14// returns <Float32Array>[ 0.0, 0.0, 0.0, 0.0 ] 15 16var arr5 = typedarray( buf, 16, 1 ); 17// returns <Float64Array>[ 0.0 ] 18 19var arr6 = typedarray( buf, 10, 4, 'int16' ); 20// returns <Int16Array>[ 0, 0, 0, 0 ]
dtype
is unspecified or the specified data type is not a complex number data type, the returned array contains interleaved real and imaginary components.1var randu = require( '@stdlib/random-base-randu' ); 2var typedarray = require( '@stdlib/array-typed' ); 3 4var arr = typedarray( 100, 'float64' ); 5 6var i; 7for ( i = 0; i < arr.length; i++ ) { 8 arr[ i ] = randu() * 100.0; 9} 10console.log( arr );
@stdlib/array-complex128
: Complex128Array.@stdlib/array-complex64
: Complex64Array.@stdlib/array-float64
: Float64Array.@stdlib/array-float32
: Float32Array.@stdlib/array-int32
: Int32Array.@stdlib/array-uint32
: Uint32Array.@stdlib/array-int16
: Int16Array.@stdlib/array-uint16
: Uint16Array.@stdlib/array-int8
: Int8Array.@stdlib/array-uint8
: Uint8Array.@stdlib/array-uint8c
: Uint8ClampedArray.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.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
project is not fuzzed
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no SAST tool detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More