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 7, 2024
1 parent 3f9246c commit 2276787
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 8 deletions.
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,49 @@

> Package changelog.

<section class="release" id="unreleased">

## Unreleased (2024-09-07)

<section class="packages">

### Packages

</section>

<!-- /.packages -->

<section class="contributors">

### Contributors

A total of 2 people contributed to this release. Thank you to the following contributors:

- Philipp Burckhardt
- ProCoderVP

</section>

<!-- /.contributors -->

<section class="commits">

### Commits

<details>

- [`bff7edc`](https://github.com/stdlib-js/stdlib/commit/bff7edc7371b591931b00bbfa3c80233ad839c6f) - **docs:** update examples of `array/base` _(by ProCoderVP, Philipp Burckhardt)_

</details>

</section>

<!-- /.commits -->

</section>

<!-- /.release -->

<section class="release" id="v0.3.1">

## 0.3.1 (2024-08-18)
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ EuniceSim142 <[email protected]>
Frank Kovacs <[email protected]>
Golden Kumar <[email protected]>
Gunj Joshi <[email protected]>
HarshaNP <[email protected]>
Harshita Kalani <[email protected]>
Hridyanshu <[email protected]>
Jaimin Godhani <[email protected]>
Expand Down Expand Up @@ -96,3 +97,4 @@ nishant-s7 <[email protected]>
orimiles5 <[email protected]>
rainn <[email protected]>
rei2hu <[email protected]>
yaswanth <[email protected]>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
[npm-image]: http://img.shields.io/npm/v/@stdlib/array.svg
[npm-url]: https://npmjs.org/package/@stdlib/array

[test-image]: https://github.com/stdlib-js/array/actions/workflows/test.yml/badge.svg?branch=v0.3.1
[test-url]: https://github.com/stdlib-js/array/actions/workflows/test.yml?query=branch:v0.3.1
[test-image]: https://github.com/stdlib-js/array/actions/workflows/test.yml/badge.svg?branch=main
[test-url]: https://github.com/stdlib-js/array/actions/workflows/test.yml?query=branch:main

[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array/main.svg
[coverage-url]: https://codecov.io/github/stdlib-js/array?branch=main
Expand Down
24 changes: 20 additions & 4 deletions base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,31 @@ The namespace exports the following:

## Examples

<!-- TODO: better examples -->

<!-- eslint no-undef: "error" -->

```javascript
var objectKeys = require( '@stdlib/utils/keys' );
var randu = require( '@stdlib/random/base/randu' );
var ns = require( '@stdlib/array/base' );

console.log( objectKeys( ns ) );
// Create a zero-filled array:
var zeros = ns.zeros( 5 );
// returns [ 0, 0, 0, 0, 0 ]

// Create an array filled with a specific value:
var filled = ns.filled( 7, 4 );
// returns [ 7, 7, 7, 7 ]

// Create a linearly spaced array:
var linear = ns.linspace( 0, 1, 5 );
// returns [ 0, 0.25, 0.5, 0.75, 1 ]

// Create a two-dimensional array:
var arr2d = ns.ones2d( [ 2, 3 ] );
// returns [ [ 1, 1, 1 ], [ 1, 1, 1 ] ]

// Map a function over a 2D array:
var squared = ns.map2d( arr2d, [ 2, 3 ], randu );
// e.g., returns [ [ ~0.123, ~0.789, ~0.456 ], [ ~0.321, ~0.654, ~0.987 ] ]
```

</section>
Expand Down
27 changes: 25 additions & 2 deletions base/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,30 @@

'use strict';

var objectKeys = require( '@stdlib/utils/keys' );
var randu = require( '@stdlib/random/base/randu' );
var ns = require( './../lib' );

console.log( objectKeys( ns ) );
// Create a zero-filled array:
var zeros = ns.zeros( 5 );
console.log( zeros );
// => [ 0, 0, 0, 0, 0 ]

// Create an array filled with a specific value:
var filled = ns.filled( 7, 4 );
console.log( filled );
// => [ 7, 7, 7, 7 ]

// Create a linearly spaced array:
var linear = ns.linspace( 0, 1, 5 );
console.log( linear );
// => [ 0, 0.25, 0.5, 0.75, 1 ]

// Create a two-dimensional array:
var arr2d = ns.ones2d( [ 2, 3 ] );
console.log( arr2d );
// => [ [ 1, 1, 1 ], [ 1, 1, 1 ] ]

// Map a function over a 2D array:
var squared = ns.map2d( arr2d, [ 2, 3 ], randu );
console.log( squared );
// e.g., => [ [ ~0.123, ~0.789, ~0.456 ], [ ~0.321, ~0.654, ~0.987 ] ]

0 comments on commit 2276787

Please sign in to comment.