Skip to content

Commit d4d7203

Browse files
committed
Auto-generated commit
1 parent 228dbef commit d4d7203

File tree

27 files changed

+1165
-5
lines changed

27 files changed

+1165
-5
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,8 @@ indent_size = 2
179179
[*.gypi]
180180
indent_style = space
181181
indent_size = 2
182+
183+
# Set properties for citation files:
184+
[*.{cff,cff.txt}]
185+
indent_style = space
186+
indent_size = 2

CITATION.cff

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
cff-version: 1.2.0
2+
title: stdlib
3+
message: >-
4+
If you use this software, please cite it using the
5+
metadata from this file.
6+
7+
type: software
8+
9+
authors:
10+
- name: The Stdlib Authors
11+
url: https://github.com/stdlib-js/stdlib/graphs/contributors
12+
13+
repository-code: https://github.com/stdlib-js/stdlib
14+
url: https://stdlib.io
15+
16+
abstract: |
17+
Standard library for JavaScript and Node.js.
18+
19+
keywords:
20+
- JavaScript
21+
- Node.js
22+
- TypeScript
23+
- standard library
24+
- scientific computing
25+
- numerical computing
26+
- statistical computing
27+
28+
license: Apache-2.0 AND BSL-1.0
29+
30+
date-released: 2016

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ limitations under the License.
1818
1919
-->
2020

21+
22+
<details>
23+
<summary>
24+
About stdlib...
25+
</summary>
26+
<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>
27+
<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>
28+
<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>
29+
<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>
30+
</details>
31+
2132
# Assert
2233

2334
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

is-multi-slice/README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2023 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# isMultiSlice
22+
23+
> Test if a value is a [`MultiSlice`][@stdlib/slice/multi].
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var isMultiSlice = require( '@stdlib/assert/is-multi-slice' );
31+
```
32+
33+
#### isMultiSlice( value )
34+
35+
Tests if a value is a [`MultiSlice`][@stdlib/slice/multi].
36+
37+
```javascript
38+
var MultiSlice = require( '@stdlib/slice/multi' );
39+
40+
var s = new MultiSlice();
41+
42+
var bool = isMultiSlice( s );
43+
// returns true
44+
```
45+
46+
</section>
47+
48+
<!-- /.usage -->
49+
50+
<section class="examples">
51+
52+
## Examples
53+
54+
<!-- eslint no-undef: "error" -->
55+
56+
```javascript
57+
var Slice = require( '@stdlib/slice/ctor' );
58+
var MultiSlice = require( '@stdlib/slice/multi' );
59+
var isMultiSlice = require( '@stdlib/assert/is-multi-slice' );
60+
61+
var out = isMultiSlice( new MultiSlice() );
62+
// returns true
63+
64+
out = isMultiSlice( new Slice( 0, 10, 1 ) );
65+
// returns false
66+
67+
out = isMultiSlice( {} );
68+
// returns false
69+
70+
out = isMultiSlice( null );
71+
// returns false
72+
```
73+
74+
</section>
75+
76+
<!-- /.examples -->
77+
78+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
79+
80+
<section class="related">
81+
82+
</section>
83+
84+
<!-- /.related -->
85+
86+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
87+
88+
<section class="links">
89+
90+
[@stdlib/slice/multi]: https://github.com/stdlib-js/slice-multi
91+
92+
</section>
93+
94+
<!-- /.links -->

is-multi-slice/benchmark/benchmark.js

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2023 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var isBoolean = require( './../../is-boolean' ).isPrimitive;
25+
var MultiSlice = require( '@stdlib/slice/multi' );
26+
var pkg = require( './../package.json' ).name;
27+
var isMultiSlice = require( './../lib' );
28+
29+
30+
// MAIN //
31+
32+
bench( pkg+'::true', function benchmark( b ) {
33+
var values;
34+
var bool;
35+
var i;
36+
37+
values = [
38+
new MultiSlice( 1, 2 ),
39+
new MultiSlice( 3, 4 ),
40+
new MultiSlice( 5, 6 ),
41+
new MultiSlice( 7, 8 )
42+
];
43+
44+
b.tic();
45+
for ( i = 0; i < b.iterations; i++ ) {
46+
bool = isMultiSlice( values[ i%values.length ] );
47+
if ( typeof bool !== 'boolean' ) {
48+
b.fail( 'should return a boolean' );
49+
}
50+
}
51+
b.toc();
52+
if ( !isBoolean( bool ) ) {
53+
b.fail( 'should return a boolean' );
54+
}
55+
b.pass( 'benchmark finished' );
56+
b.end();
57+
});
58+
59+
bench( pkg+'::false', function benchmark( b ) {
60+
var values;
61+
var bool;
62+
var i;
63+
64+
values = [
65+
'5',
66+
5,
67+
NaN,
68+
true,
69+
false,
70+
[],
71+
{}
72+
];
73+
74+
b.tic();
75+
for ( i = 0; i < b.iterations; i++ ) {
76+
bool = isMultiSlice( values[ i%values.length ] );
77+
if ( typeof bool !== 'boolean' ) {
78+
b.fail( 'should return a boolean' );
79+
}
80+
}
81+
b.toc();
82+
if ( !isBoolean( bool ) ) {
83+
b.fail( 'should return a boolean' );
84+
}
85+
b.pass( 'benchmark finished' );
86+
b.end();
87+
});

is-multi-slice/docs/repl.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
{{alias}}( value )
3+
Tests if a value is a MultiSlice object.
4+
5+
Parameters
6+
----------
7+
value: any
8+
Value to test.
9+
10+
Returns
11+
-------
12+
bool: boolean
13+
Boolean indicating whether a value is a MultiSlice object.
14+
15+
Examples
16+
--------
17+
> var bool = {{alias}}( new {{alias:@stdlib/slice/multi}}() )
18+
true
19+
> bool = {{alias}}( 3.14 )
20+
false
21+
> bool = {{alias}}( {} )
22+
false
23+
24+
See Also
25+
--------
26+

is-multi-slice/docs/types/index.d.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2023 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 4.1
20+
21+
/// <reference types="@stdlib/types"/>
22+
23+
import { MultiSlice } from '@stdlib/types/slice';
24+
25+
/**
26+
* Tests if a value is a MultiSlice object.
27+
*
28+
* @param value - value to test
29+
* @returns boolean indicating if a value is a MultiSlice object
30+
*
31+
* @example
32+
* var Slice = require( `@stdlib/slice/ctor` );
33+
* var MultiSlice = require( `@stdlib/slice/multi` );
34+
*
35+
* var s = new MultiSlice( new Slice( 0, 10, 1 ), null, 1 );
36+
*
37+
* var bool = isMultiSlice( s );
38+
* // returns true
39+
*/
40+
declare function isMultiSlice( value: any ): value is MultiSlice;
41+
42+
43+
// EXPORTS //
44+
45+
export = isMultiSlice;

is-multi-slice/docs/types/test.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2023 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import MultiSlice = require( '@stdlib/slice/multi' );
20+
import isMultiSlice = require( './index' );
21+
22+
23+
// TESTS //
24+
25+
// The function returns a boolean...
26+
{
27+
isMultiSlice( new MultiSlice( null ) ); // $ExpectType boolean
28+
isMultiSlice( { 'ndims': 0, 'data': [] } ); // $ExpectType boolean
29+
isMultiSlice( 123 ); // $ExpectType boolean
30+
}
31+
32+
// The compiler throws an error if the function is provided an unsupported number of arguments...
33+
{
34+
isMultiSlice(); // $ExpectError
35+
isMultiSlice( new MultiSlice( null ), 123 ); // $ExpectError
36+
}

0 commit comments

Comments
 (0)