
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
dstructs-array-constructors
Advanced tools
Returns an array constructor corresponding to an array data type.
Returns an array constructor corresponding to an array data type.
$ npm install dstructs-array-constructors
For use in the browser, use browserify.
var getCtor = require( 'dstructs-array-constructors' );
Returns an array
constructor corresponding to an array
data type.
var ctor = getCtor( 'int8' );
// returns Int8Array
The following array
data types are supported:
Data Type | Constructor |
---|---|
int8 | Int8Array |
uint8 | Uint8Array |
uint8_clamped | Uint8ClampedArray |
int16 | Int16Array |
uint16 | Uint16Array |
int32 | Int32Array |
uint32 | Uint32Array |
float32 | Float32Array |
float64 | Float64Array |
generic | Array |
var getCtor = require( 'dstructs-array-constructors' );
console.log( getCtor( 'int8' ) );
// returns Int8Array
console.log( getCtor( 'uint8' ) );
// returns Uint8Array
console.log( getCtor( 'uint8_clamped' ) );
// returns Uint8ClampedArray
console.log( getCtor( 'int16' ) );
// returns Int16Array
console.log( getCtor( 'uint16' ) );
// returns Uint16Array
console.log( getCtor( 'int32' ) );
// returns Int32Array
console.log( getCtor( 'uint32' ) );
// returns Uint32Array
console.log( getCtor( 'float32' ) );
// returns Float32Array
console.log( getCtor( 'float64' ) );
// returns Float64Array
console.log( getCtor( 'generic' ) );
// returns Array
console.log( getCtor( null ) );
// returns null
console.log( getCtor( 'object' ) );
// returns null
console.log( getCtor( 'array' ) );
// returns null
console.log( getCtor( {} ) );
// returns null
console.log( getCtor( [] ) );
// returns null
To run the example code from the top-level application directory,
$ node ./examples/index.js
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
$ make test-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
$ make view-cov
Copyright © 2015. The Compute.io Authors.
FAQs
Returns an array constructor corresponding to an array data type.
We found that dstructs-array-constructors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.