File tree Expand file tree Collapse file tree 6 files changed +156
-0
lines changed
lib/node_modules/@stdlib/array Expand file tree Collapse file tree 6 files changed +156
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * @license Apache-2.0
3+ *
4+ * Copyright (c) 2021 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: 2.0
20+
21+ /**
22+ * Returns an array constructor.
23+ *
24+ * @param dtype - data type
25+ * @returns constructor or null
26+ *
27+ * @example
28+ * var ctor = ctors( 'float64' );
29+ * // returns <Function>
30+ *
31+ * @example
32+ * var ctor = ctors( 'float' );
33+ * // returns null
34+ */
35+ declare function ctors ( dtype : string ) : Function | null ;
36+
37+
38+ // EXPORTS //
39+
40+ export = ctors ;
Original file line number Diff line number Diff line change 1+ /*
2+ * @license Apache-2.0
3+ *
4+ * Copyright (c) 2021 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 ctors = require( './index' ) ;
20+
21+ // TESTS //
22+
23+ // The function returns a function or null..
24+ {
25+ ctors ( 'float64' ) ; // $ExpectType Function | null
26+ ctors ( 'float' ) ; // $ExpectType Function | null
27+ }
28+
29+ // The compiler throws an error if the function is provided an unsupported number of arguments...
30+ {
31+ ctors ( ) ; // $ExpectError
32+ ctors ( 'int32' , 3 ) ; // $ExpectError
33+ }
Original file line number Diff line number Diff line change 2121 "lib" : " ./lib" ,
2222 "test" : " ./test"
2323 },
24+ "types" : " ./docs/types" ,
2425 "scripts" : {},
2526 "homepage" : " https://github.com/stdlib-js/stdlib" ,
2627 "repository" : {
Original file line number Diff line number Diff line change 1+ /*
2+ * @license Apache-2.0
3+ *
4+ * Copyright (c) 2021 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: 2.0
20+
21+ /// <reference types="@stdlib/types"/>
22+
23+ import { TypedArray } from '@stdlib/types/array' ;
24+
25+ /**
26+ * Returns the data type of an array.
27+ *
28+ * ## Notes
29+ *
30+ * - If provided an argument having an unknown or unsupported type, the function returns `null`.
31+ *
32+ * @param value - input value
33+ * @returns data type
34+ *
35+ * @example
36+ * var dt = dtype( [ 1, 2, 3 ] );
37+ * // returns 'generic'
38+ *
39+ * var dt = dtype( 'beep' );
40+ * // returns null
41+ */
42+ declare function dtype ( value : TypedArray | Array < any > ) : string | null ;
43+
44+
45+ // EXPORTS //
46+
47+ export = dtype ;
Original file line number Diff line number Diff line change 1+ /*
2+ * @license Apache-2.0
3+ *
4+ * Copyright (c) 2021 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 dtype = require( './index' ) ;
20+
21+ // TESTS //
22+
23+ // The function returns a string or null..
24+ {
25+ const x = new Float64Array ( 10 ) ;
26+
27+ dtype ( x ) ; // $ExpectType string | null
28+ }
29+
30+ // The compiler throws an error if the function is provided an unsupported number of arguments...
31+ {
32+ dtype ( ) ; // $ExpectError
33+ dtype ( [ 1 , 2 , 3 ] , 3 ) ; // $ExpectError
34+ }
Original file line number Diff line number Diff line change 2121 "lib" : " ./lib" ,
2222 "test" : " ./test"
2323 },
24+ "types" : " ./docs/types" ,
2425 "scripts" : {},
2526 "homepage" : " https://github.com/stdlib-js/stdlib" ,
2627 "repository" : {
You can’t perform that action at this time.
0 commit comments