@stdlib/array-base-copy 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +6 -3
- package/SECURITY.md +5 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +3 -3
- package/docs/types/index.d.ts +2 -2
- package/lib/main.js +3 -13
- package/package.json +5 -28
- package/CITATION.cff +0 -30
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2024 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -169,7 +169,7 @@ See [LICENSE][stdlib-license].
|
|
|
169
169
|
|
|
170
170
|
## Copyright
|
|
171
171
|
|
|
172
|
-
Copyright © 2016-
|
|
172
|
+
Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
173
173
|
|
|
174
174
|
</section>
|
|
175
175
|
|
|
@@ -182,8 +182,8 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
182
182
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-base-copy.svg
|
|
183
183
|
[npm-url]: https://npmjs.org/package/@stdlib/array-base-copy
|
|
184
184
|
|
|
185
|
-
[test-image]: https://github.com/stdlib-js/array-base-copy/actions/workflows/test.yml/badge.svg?branch=v0.1
|
|
186
|
-
[test-url]: https://github.com/stdlib-js/array-base-copy/actions/workflows/test.yml?query=branch:v0.1
|
|
185
|
+
[test-image]: https://github.com/stdlib-js/array-base-copy/actions/workflows/test.yml/badge.svg?branch=v0.2.1
|
|
186
|
+
[test-url]: https://github.com/stdlib-js/array-base-copy/actions/workflows/test.yml?query=branch:v0.2.1
|
|
187
187
|
|
|
188
188
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-base-copy/main.svg
|
|
189
189
|
[coverage-url]: https://codecov.io/github/stdlib-js/array-base-copy?branch=main
|
|
@@ -206,8 +206,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
206
206
|
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
207
207
|
|
|
208
208
|
[deno-url]: https://github.com/stdlib-js/array-base-copy/tree/deno
|
|
209
|
+
[deno-readme]: https://github.com/stdlib-js/array-base-copy/blob/deno/README.md
|
|
209
210
|
[umd-url]: https://github.com/stdlib-js/array-base-copy/tree/umd
|
|
211
|
+
[umd-readme]: https://github.com/stdlib-js/array-base-copy/blob/umd/README.md
|
|
210
212
|
[esm-url]: https://github.com/stdlib-js/array-base-copy/tree/esm
|
|
213
|
+
[esm-readme]: https://github.com/stdlib-js/array-base-copy/blob/esm/README.md
|
|
211
214
|
[branches-url]: https://github.com/stdlib-js/array-base-copy/blob/main/branches.md
|
|
212
215
|
|
|
213
216
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/array-base-copy/main/LICENSE
|
package/SECURITY.md
ADDED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
var
|
|
3
|
-
});var
|
|
1
|
+
"use strict";var o=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var i=o(function(l,a){
|
|
2
|
+
var v=require('@stdlib/array-base-resolve-getter/dist');function n(e){var r,s,u,t;for(u=v(e),s=e.length,r=[],t=0;t<s;t++)r.push(u(e,t));return r}a.exports=n
|
|
3
|
+
});var c=i();module.exports=c;
|
|
4
4
|
/** @license Apache-2.0 */
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../lib/main.js", "../lib/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar
|
|
5
|
-
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,
|
|
6
|
-
"names": ["require_main", "__commonJSMin", "exports", "module", "
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar resolveGetter = require( '@stdlib/array-base-resolve-getter' );\n\n\n// MAIN //\n\n/**\n* Copies the elements of an array-like object to a new \"generic\" array.\n*\n* @param {Collection} x - input array\n* @returns {Array} output array\n*\n* @example\n* var out = copy( [ 1, 2, 3 ] );\n* // returns [ 1, 2, 3 ]\n*/\nfunction copy( x ) {\n\tvar out;\n\tvar len;\n\tvar get;\n\tvar i;\n\n\t// Resolve an accessor for retrieving input array elements:\n\tget = resolveGetter( x );\n\n\t// Get the number of elements to copy:\n\tlen = x.length;\n\n\t// Loop over the elements...\n\tout = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\tout.push( get( x, i ) ); // ensure \"fast\" elements\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nmodule.exports = copy;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Copy the elements of an array-like object to a new \"generic\" array.\n*\n* @module @stdlib/array-base-copy\n*\n* @example\n* var copy = require( '@stdlib/array-base-copy' );\n*\n* var out = copy( [ 1, 2, 3 ] );\n* // returns [ 1, 2, 3 ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,mCAAoC,EAejE,SAASC,EAAMC,EAAI,CAClB,IAAIC,EACAC,EACAC,EACAC,EAUJ,IAPAD,EAAML,EAAeE,CAAE,EAGvBE,EAAMF,EAAE,OAGRC,EAAM,CAAC,EACDG,EAAI,EAAGA,EAAIF,EAAKE,IACrBH,EAAI,KAAME,EAAKH,EAAGI,CAAE,CAAE,EAEvB,OAAOH,CACR,CAKAJ,EAAO,QAAUE,IC1BjB,IAAIM,EAAO,IAKX,OAAO,QAAUA",
|
|
6
|
+
"names": ["require_main", "__commonJSMin", "exports", "module", "resolveGetter", "copy", "x", "out", "len", "get", "i", "main"]
|
|
7
7
|
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
/// <reference types="@stdlib/types"/>
|
|
22
22
|
|
|
23
|
-
import { Collection } from '@stdlib/types/array';
|
|
23
|
+
import { Collection, AccessorArrayLike } from '@stdlib/types/array';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Copies the elements of an array-like object to a new "generic" array.
|
|
@@ -34,7 +34,7 @@ import { Collection } from '@stdlib/types/array';
|
|
|
34
34
|
* var out = copy( x );
|
|
35
35
|
* // returns [ 1, 2, 3 ]
|
|
36
36
|
*/
|
|
37
|
-
declare function copy<T = unknown>( x: Collection<T> ): Array<T>;
|
|
37
|
+
declare function copy<T = unknown>( x: Collection<T> | AccessorArrayLike<T> ): Array<T>;
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
// EXPORTS //
|
package/lib/main.js
CHANGED
|
@@ -20,10 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
// MODULES //
|
|
22
22
|
|
|
23
|
-
var
|
|
24
|
-
var accessorGetter = require( '@stdlib/array-base-accessor-getter' );
|
|
25
|
-
var getter = require( '@stdlib/array-base-getter' );
|
|
26
|
-
var dtype = require( '@stdlib/array-dtype' );
|
|
23
|
+
var resolveGetter = require( '@stdlib/array-base-resolve-getter' );
|
|
27
24
|
|
|
28
25
|
|
|
29
26
|
// MAIN //
|
|
@@ -42,18 +39,11 @@ function copy( x ) {
|
|
|
42
39
|
var out;
|
|
43
40
|
var len;
|
|
44
41
|
var get;
|
|
45
|
-
var dt;
|
|
46
42
|
var i;
|
|
47
43
|
|
|
48
|
-
// Resolve the input array data type:
|
|
49
|
-
dt = dtype( x );
|
|
50
|
-
|
|
51
44
|
// Resolve an accessor for retrieving input array elements:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} else {
|
|
55
|
-
get = getter( dt );
|
|
56
|
-
}
|
|
45
|
+
get = resolveGetter( x );
|
|
46
|
+
|
|
57
47
|
// Get the number of elements to copy:
|
|
58
48
|
len = x.length;
|
|
59
49
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/array-base-copy",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Copy the elements of an array-like object to a new generic array.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -15,19 +15,12 @@
|
|
|
15
15
|
],
|
|
16
16
|
"main": "./lib",
|
|
17
17
|
"directories": {
|
|
18
|
-
"benchmark": "./benchmark",
|
|
19
18
|
"doc": "./docs",
|
|
20
|
-
"example": "./examples",
|
|
21
19
|
"lib": "./lib",
|
|
22
|
-
"
|
|
20
|
+
"dist": "./dist"
|
|
23
21
|
},
|
|
24
22
|
"types": "./docs/types",
|
|
25
|
-
"scripts": {
|
|
26
|
-
"test": "make test",
|
|
27
|
-
"test-cov": "make test-cov",
|
|
28
|
-
"examples": "make examples",
|
|
29
|
-
"benchmark": "make benchmark"
|
|
30
|
-
},
|
|
23
|
+
"scripts": {},
|
|
31
24
|
"homepage": "https://stdlib.io",
|
|
32
25
|
"repository": {
|
|
33
26
|
"type": "git",
|
|
@@ -37,25 +30,9 @@
|
|
|
37
30
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
31
|
},
|
|
39
32
|
"dependencies": {
|
|
40
|
-
"@stdlib/array-base-
|
|
41
|
-
"@stdlib/array-base-assert-is-accessor-array": "^0.1.0",
|
|
42
|
-
"@stdlib/array-base-getter": "^0.1.0",
|
|
43
|
-
"@stdlib/array-dtype": "^0.1.0",
|
|
44
|
-
"@stdlib/types": "^0.1.0"
|
|
45
|
-
},
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"@stdlib/array-base-ones": "^0.1.0",
|
|
48
|
-
"@stdlib/array-complex64": "^0.1.0",
|
|
49
|
-
"@stdlib/assert-is-array": "^0.1.0",
|
|
50
|
-
"@stdlib/assert-is-complex64": "^0.1.0",
|
|
51
|
-
"@stdlib/bench": "^0.1.0",
|
|
52
|
-
"@stdlib/complex-imagf": "^0.1.0",
|
|
53
|
-
"@stdlib/complex-realf": "^0.1.0",
|
|
54
|
-
"@stdlib/math-base-special-pow": "^0.1.0",
|
|
55
|
-
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
56
|
-
"istanbul": "^0.4.1",
|
|
57
|
-
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
|
|
33
|
+
"@stdlib/array-base-resolve-getter": "^0.2.0"
|
|
58
34
|
},
|
|
35
|
+
"devDependencies": {},
|
|
59
36
|
"engines": {
|
|
60
37
|
"node": ">=0.10.0",
|
|
61
38
|
"npm": ">2.7.0"
|
package/CITATION.cff
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|