Skip to content

Commit

Permalink
Merge branch 'stdlib-js:develop' into docs/improve_README_examples_of…
Browse files Browse the repository at this point in the history
…_ndarray/iter_namespace
  • Loading branch information
performant23 authored Mar 6, 2024
2 parents 9e73fd3 + 6cb4de2 commit e5311a0
Show file tree
Hide file tree
Showing 296 changed files with 15,884 additions and 883 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/update_package_meta_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ jobs:
run: |
node lib/node_modules/@stdlib/_tools/package-json/scripts/update_directories lib/node_modules/@stdlib
# Update gypfile field:
- name: 'Update gypfile field'
run: |
node lib/node_modules/@stdlib/_tools/package-json/scripts/update_gypfile lib/node_modules/@stdlib
# Import GPG key to sign commits:
- name: 'Import GPG key to sign commits'
# Pin action to full length commit SHA
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ AgPriyanshu18 <[email protected]>
Ali Salesi <[email protected]>
Aman Bhansali <[email protected]>
Amit Jimiwal <[email protected]>
Anudeep Sanapala <[email protected]>
Athan Reines <[email protected]>
Brendan Graetz <[email protected]>
Bruno Fenzl <[email protected]>
Expand All @@ -30,6 +31,7 @@ Joris Labie <[email protected]>
Justin Dennison <[email protected]>
Karthik Prakash <[email protected]>
Khaldon <[email protected]>
Lovelin <[email protected]>
Marcus Fantham <[email protected]>
Matt Cochrane <[email protected]>
Mihir Pandit <[email protected]>
Expand All @@ -38,11 +40,13 @@ Momtchil Momtchev <[email protected]>
Naresh Jagadeesan <[email protected]>
Nithin Katta <[email protected]>
Ognjen Jevremović <[email protected]>
Oneday12323 <[email protected]>
Philipp Burckhardt <[email protected]>
Prajwal Kulkarni <[email protected]>
Pranav Goswami <[email protected]>
Praneki <[email protected]>
Pratik <[email protected]>
Priyansh <[email protected]>
Rejoan Sardar <[email protected]>
Ricky Reusser <[email protected]>
Robert Gislason <[email protected]>
Expand All @@ -51,6 +55,7 @@ Rutam <[email protected]>
Ryan Seal <[email protected]>
Sai Srikar Dumpeti <[email protected]>
Seyyed Parsa Neshaei <[email protected]>
Shashank Shekhar Singh <[email protected]>
Shraddheya Shendre <[email protected]>
Shubham <[email protected]>
Snehil Shah <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
// MODULES //

var proc = require( 'process' );
var debug = require( 'debug' )( 'update-package-directories' );
var join = require( 'path' ).join;
var resolve = require( 'path' ).resolve;
var logger = require( 'debug' );
var parseArgs = require( 'minimist' );
var isObject = require( '@stdlib/assert/is-plain-object' );
var cwd = require( '@stdlib/process/cwd' );
Expand All @@ -53,6 +53,7 @@ var standardize = require( '@stdlib/_tools/package-json/standardize' );

// VARIABLES //

var debug = logger( 'update-package-directories' );
var DIR_KEYS = [
'benchmark',

Expand Down Expand Up @@ -98,7 +99,6 @@ function main( dir ) {
var fpath;
var opts;
var pkgs;
var dir;
var pkg;
var i;
var j;
Expand Down
140 changes: 140 additions & 0 deletions lib/node_modules/@stdlib/_tools/package-json/scripts/update_gypfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
#!/usr/bin/env node

/**
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

/*
* Update package `package.json` files by setting the `gyppfile` field to `true` for packages which contain a `binding.gyp` and/or `include.gypi` file.
*
* * *$1*: root search directory
*
* If not provided a root search directory, the root search directory is the current working directory.
*
* To enable verbose logging, set the `DEBUG` environment variable.
*
* ``` bash
* $ DEBUG=* update_gypfile .
* ```
*/

// MODULES //

var join = require( 'path' ).join;
var resolve = require( 'path' ).resolve;
var proc = require( 'process' );
var logger = require( 'debug' );
var parseArgs = require( 'minimist' );
var isObject = require( '@stdlib/assert/is-plain-object' );
var cwd = require( '@stdlib/process/cwd' );
var exists = require( '@stdlib/fs/exists' ).sync;
var findPkgs = require( '@stdlib/_tools/pkgs/find' ).sync;
var writeFile = require( '@stdlib/fs/write-file' ).sync;
var standardize = require( '@stdlib/_tools/package-json/standardize' );


// VARIABLES //

var GYPFILES = [
'binding.gyp',
'include.gypi'
];
var debug = logger( 'update-gypfile' );
var opts;
var args;
var dir;


// FUNCTIONS //

/**
* Updates package `package.json` files by setting the `gypfile` field if a package contains a `binding.gyp` and/or `include.gypi` file.
*
* @private
* @param {string} dir - root search directory
*/
function main( dir ) {
var fpath;
var opts;
var pkgs;
var pkg;
var i;
var j;

debug( 'Searching for packages in %s.', dir );
opts = {
'dir': dir,
'pattern': '**/package.json'
};
pkgs = findPkgs( opts );
debug( 'Found %d packages.', pkgs.length );

for ( i = 0; i < pkgs.length; i++ ) {
fpath = join( pkgs[ i ], 'package.json' );
debug( 'Loading package file: %s (%d of %d).', fpath, i+1, pkgs.length );

try {
pkg = require( fpath ); // eslint-disable-line stdlib/no-dynamic-require
} catch ( err ) {
debug( 'Encountered an error when loading package file: %s (%d of %d). Error: %s', fpath, i+1, pkgs.length, err.message );
continue;
}
if ( !isObject( pkg ) ) {
debug( 'Unable to load package.json file: %s (%d of %d).', fpath, i+1, pkgs.length );
continue;
}

if ( pkg.gypfile ) {
debug( 'Current gypfile value: %s.', pkg.gypfile );
}
debug( 'Updating gypfile.' );
for ( j = 0; j < GYPFILES.length; j++ ) {
if ( exists( join( pkgs[ i ], GYPFILES[ j ] ) ) ) {
pkg.gypfile = true;
break;
}
}

debug( 'Standardizing package data.' );
pkg = standardize( pkg );

debug( 'Serializing package data.' );
pkg = JSON.stringify( pkg, null, 2 ); // 2-space indentation

debug( 'Writing package data to file.' );
writeFile( fpath, pkg+'\n', {
'encoding': 'utf8'
});
}
debug( 'Finished updating all packages.' );
}


// MAIN //

// Parse command-line arguments:
opts = {};
args = parseArgs( proc.argv.slice( 2 ), opts );

if ( args._[ 0 ] ) {
dir = resolve( cwd(), args._[ 0 ] );
} else {
dir = cwd();
}
main( dir );
141 changes: 141 additions & 0 deletions lib/node_modules/@stdlib/array/base/join/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<!--
@license Apache-2.0
Copyright (c) 2024 The Stdlib Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# join

> Return a string created by joining array elements using a specified separator.
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- Package usage documentation. -->

<section class="usage">

## Usage

```javascript
var join = require( '@stdlib/array/base/join' );
```

#### join( x, separator )

Returns a string created by joining array elements using a specified separator.

```javascript
var x = [ 1, 2, 3, 4, 5, 6 ];

var out = join( x, ',' );
// returns '1,2,3,4,5,6'
```

</section>

<!-- /.usage -->

<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

## Notes

- If provided an array-like object having a `join` method, the function defers execution to that method and assumes that the method API has the following signature:

```text
x.join( separator )
```

- If an array element is either `null` or `undefined`, the function will serialize the element as an empty string.

</section>

<!-- /.notes -->

<!-- Package usage examples. -->

<section class="examples">

## Examples

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

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex64Array = require( '@stdlib/array/complex64' );
var AccessorArray = require( '@stdlib/array/base/accessor' );
var Float64Array = require( '@stdlib/array/float64' );
var join = require( '@stdlib/array/base/join' );

var x = [ 0, 1, 2, 3, 4, 5 ];
var s = join( x, ',' );
// returns '0,1,2,3,4,5'

x = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 ] );
s = join( x, ',' );
// returns '0,1,2,3,4,5'

s = join( x, '-' );
// returns '0-1-2-3-4-5'

s = new AccessorArray( [ 1, 2, 3, 4 ] );
s = join( s, ',' );
// returns '1,2,3,4'

x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
s = join( x, ',' );
// returns '1 + 2i,3 + 4i,5 + 6i'

x = new Complex64Array( [ 1.0, -1.0, 2.0, -2.0 ] );
s = join( x, ',' );
// returns '1 - 1i,2 - 2i'
```

</section>

<!-- /.examples -->

<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

</section>

<!-- /.references -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

</section>

<!-- /.links -->
Loading

0 comments on commit e5311a0

Please sign in to comment.