Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Sep 19, 2023
1 parent 0c154ae commit eac4870
Show file tree
Hide file tree
Showing 46 changed files with 9,204 additions and 2,792 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,8 @@ indent_size = 2
[*.gypi]
indent_style = space
indent_size = 2

# Set properties for citation files:
[*.{cff,cff.txt}]
indent_style = space
indent_size = 2
30 changes: 30 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
cff-version: 1.2.0
title: stdlib
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software

authors:
- name: The Stdlib Authors
url: https://github.com/stdlib-js/stdlib/graphs/contributors

repository-code: https://github.com/stdlib-js/stdlib
url: https://stdlib.io

abstract: |
Standard library for JavaScript and Node.js.
keywords:
- JavaScript
- Node.js
- TypeScript
- standard library
- scientific computing
- numerical computing
- statistical computing

license: Apache-2.0 AND BSL-1.0

date-released: 2016
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ limitations under the License.
-->


<details>
<summary>
About stdlib...
</summary>
<p>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.</p>
<p>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.</p>
<p>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.</p>
<p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
</details>

# ndarray

[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
Expand Down
6 changes: 3 additions & 3 deletions array/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/// <reference types="@stdlib/types"/>

import { ArrayLike } from '@stdlib/types/array';
import { DataType, ndarray, Mode, Order, Shape } from '@stdlib/types/ndarray';
import { DataType, typedndarray, Mode, Order, Shape } from '@stdlib/types/ndarray';

/**
* Interface defining function options.
Expand Down Expand Up @@ -164,7 +164,7 @@ interface ExtendedOptions extends Options {
* var v = arr.get( 0 );
* // returns [ 1, 2 ]
*/
declare function array( options: OptionsWithShape | OptionsWithBuffer ): ndarray; // tslint:disable-line:max-line-length
declare function array<T = unknown>( options: OptionsWithShape | OptionsWithBuffer ): typedndarray<T>; // tslint:disable-line:no-unnecessary-generics

/**
* Returns a multidimensional array.
Expand Down Expand Up @@ -220,7 +220,7 @@ declare function array( options: OptionsWithShape | OptionsWithBuffer ): ndarray
* var v = arr.get( 0, 0 );
* // returns 1.0
*/
declare function array( buffer: ArrayLike<any>, options?: ExtendedOptions ): ndarray; // tslint:disable-line:max-line-length
declare function array<T = unknown>( buffer: ArrayLike<any>, options?: ExtendedOptions ): typedndarray<T>; // tslint:disable-line:no-unnecessary-generics


// EXPORTS //
Expand Down
20 changes: 16 additions & 4 deletions array/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import array = require( './index' );

// The function returns an ndarray...
{
array( [ [ 1, 2 ], [ 3, 4 ] ] ); // $ExpectType ndarray
array( new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ), { 'shape': [ 2, 2 ] } ); // $ExpectType ndarray
array( { 'shape': [ 2, 2 ] } ); // $ExpectType ndarray
array( { 'buffer': [ [ 1, 2 ], [ 3, 4 ] ] } ); // $ExpectType ndarray
array<number>( [ [ 1, 2 ], [ 3, 4 ] ] ); // $ExpectType typedndarray<number>
array<number>( new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ), { 'shape': [ 2, 2 ] } ); // $ExpectType typedndarray<number>
array<number>( { 'shape': [ 2, 2 ] } ); // $ExpectType typedndarray<number>
array<number>( { 'buffer': [ [ 1, 2 ], [ 3, 4 ] ] } ); // $ExpectType typedndarray<number>
}

// The compiler throws an error if the function is provided a first argument which is not an array, buffer, or options object...
Expand All @@ -41,6 +41,7 @@ import array = require( './index' );
// The compiler throws an error if the function is provided a second argument which is not an options object...
{
const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );

array( buffer, 'abc' ); // $ExpectError
array( buffer, true ); // $ExpectError
array( buffer, false ); // $ExpectError
Expand All @@ -52,6 +53,7 @@ import array = require( './index' );
// The compiler throws an error if the function is provided a `dtype` option which is not a recognized data type...
{
const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );

array( buffer, { 'dtype': 'abc' } ); // $ExpectError
array( buffer, { 'dtype': 123 } ); // $ExpectError
array( buffer, { 'dtype': true } ); // $ExpectError
Expand All @@ -74,6 +76,7 @@ import array = require( './index' );
// The compiler throws an error if the function is provided an `order` option which is not a recognized order...
{
const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );

array( buffer, { 'order': 'abc' } ); // $ExpectError
array( buffer, { 'order': 123 } ); // $ExpectError
array( buffer, { 'order': true } ); // $ExpectError
Expand All @@ -96,6 +99,7 @@ import array = require( './index' );
// The compiler throws an error if the function is provided a `shape` option which is not an array-like object containing numbers...
{
const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );

array( buffer, { 'shape': 'abc' } ); // $ExpectError
array( buffer, { 'shape': 123 } ); // $ExpectError
array( buffer, { 'shape': true } ); // $ExpectError
Expand All @@ -116,6 +120,7 @@ import array = require( './index' );
// The compiler throws an error if the function is provided a `mode` option which is not a recognized mode...
{
const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );

array( buffer, { 'mode': 'abc' } ); // $ExpectError
array( buffer, { 'mode': 123 } ); // $ExpectError
array( buffer, { 'mode': true } ); // $ExpectError
Expand All @@ -138,6 +143,7 @@ import array = require( './index' );
// The compiler throws an error if the function is provided an `submode` option which is not an array of strings...
{
const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );

array( buffer, { 'submode': 'abc' } ); // $ExpectError
array( buffer, { 'submode': 123 } ); // $ExpectError
array( buffer, { 'submode': true } ); // $ExpectError
Expand All @@ -158,6 +164,7 @@ import array = require( './index' );
// The compiler throws an error if the function is provided a `copy` option which is not a boolean...
{
const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );

array( buffer, { 'copy': 'abc' } ); // $ExpectError
array( buffer, { 'copy': 123 } ); // $ExpectError
array( buffer, { 'copy': null } ); // $ExpectError
Expand All @@ -176,6 +183,7 @@ import array = require( './index' );
// The compiler throws an error if the function is provided a `flatten` option which is not a boolean...
{
const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );

array( buffer, { 'flatten': 'abc' } ); // $ExpectError
array( buffer, { 'flatten': 123 } ); // $ExpectError
array( buffer, { 'flatten': null } ); // $ExpectError
Expand All @@ -194,6 +202,7 @@ import array = require( './index' );
// The compiler throws an error if the function is provided a `ndmin` option which is not a number...
{
const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );

array( buffer, { 'ndmin': 'abc' } ); // $ExpectError
array( buffer, { 'ndmin': false } ); // $ExpectError
array( buffer, { 'ndmin': true } ); // $ExpectError
Expand All @@ -214,6 +223,7 @@ import array = require( './index' );
// The compiler throws an error if the function is provided a `casting` option which is not a string...
{
const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );

array( buffer, { 'casting': 123 } ); // $ExpectError
array( buffer, { 'casting': false } ); // $ExpectError
array( buffer, { 'casting': true } ); // $ExpectError
Expand All @@ -234,6 +244,7 @@ import array = require( './index' );
// The compiler throws an error if the function is provided a `readonly` option which is not a boolean...
{
const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );

array( buffer, { 'readonly': 'abc' } ); // $ExpectError
array( buffer, { 'readonly': 123 } ); // $ExpectError
array( buffer, { 'readonly': null } ); // $ExpectError
Expand All @@ -252,6 +263,7 @@ import array = require( './index' );
// The compiler throws an error if the function is provided an invalid number of arguments...
{
const buffer = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );

array(); // $ExpectError
array( buffer, {}, {} ); // $ExpectError
}
Loading

0 comments on commit eac4870

Please sign in to comment.