@stdlib/array-base-last 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/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
|
@@ -163,7 +163,7 @@ See [LICENSE][stdlib-license].
|
|
|
163
163
|
|
|
164
164
|
## Copyright
|
|
165
165
|
|
|
166
|
-
Copyright © 2016-
|
|
166
|
+
Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
167
167
|
|
|
168
168
|
</section>
|
|
169
169
|
|
|
@@ -176,8 +176,8 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
176
176
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-base-last.svg
|
|
177
177
|
[npm-url]: https://npmjs.org/package/@stdlib/array-base-last
|
|
178
178
|
|
|
179
|
-
[test-image]: https://github.com/stdlib-js/array-base-last/actions/workflows/test.yml/badge.svg?branch=v0.1
|
|
180
|
-
[test-url]: https://github.com/stdlib-js/array-base-last/actions/workflows/test.yml?query=branch:v0.1
|
|
179
|
+
[test-image]: https://github.com/stdlib-js/array-base-last/actions/workflows/test.yml/badge.svg?branch=v0.2.1
|
|
180
|
+
[test-url]: https://github.com/stdlib-js/array-base-last/actions/workflows/test.yml?query=branch:v0.2.1
|
|
181
181
|
|
|
182
182
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-base-last/main.svg
|
|
183
183
|
[coverage-url]: https://codecov.io/github/stdlib-js/array-base-last?branch=main
|
|
@@ -200,8 +200,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
200
200
|
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
201
201
|
|
|
202
202
|
[deno-url]: https://github.com/stdlib-js/array-base-last/tree/deno
|
|
203
|
+
[deno-readme]: https://github.com/stdlib-js/array-base-last/blob/deno/README.md
|
|
203
204
|
[umd-url]: https://github.com/stdlib-js/array-base-last/tree/umd
|
|
205
|
+
[umd-readme]: https://github.com/stdlib-js/array-base-last/blob/umd/README.md
|
|
204
206
|
[esm-url]: https://github.com/stdlib-js/array-base-last/tree/esm
|
|
207
|
+
[esm-readme]: https://github.com/stdlib-js/array-base-last/blob/esm/README.md
|
|
205
208
|
[branches-url]: https://github.com/stdlib-js/array-base-last/blob/main/branches.md
|
|
206
209
|
|
|
207
210
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/array-base-last/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 u=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var s=u(function(c,i){
|
|
2
|
+
var n=require('@stdlib/array-base-resolve-getter/dist');function v(r){var e,t;if(e=n(r),t=r.length-1,!(t<0))return e(r,t)}i.exports=v
|
|
3
|
+
});var a=s();module.exports=a;
|
|
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) 2023 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) 2023 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* Returns the last element of an array-like object.\n*\n* @param {Collection} arr - input array\n* @returns {*} - last element\n*\n* @example\n* var out = last( [ 1, 2, 3 ] );\n* // returns 3\n*/\nfunction last( arr ) {\n\tvar get;\n\tvar idx;\n\n\t// Resolve an accessor for retrieving input array elements:\n\tget = resolveGetter( arr );\n\n\t// Resolve the last index:\n\tidx = arr.length - 1;\n\n\t// Return the last element:\n\tif ( idx < 0 ) {\n\t\treturn;\n\t}\n\treturn get( arr, idx );\n}\n\n\n// EXPORTS //\n\nmodule.exports = last;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Return the last element of an array-like object.\n*\n* @module @stdlib/array-base-last\n*\n* @example\n* var last = require( '@stdlib/array-base-last' );\n*\n* var out = last( [ 1, 2, 3 ] );\n* // returns 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,EAAM,CACpB,IAAIC,EACAC,EASJ,GANAD,EAAMH,EAAeE,CAAI,EAGzBE,EAAMF,EAAI,OAAS,EAGd,EAAAE,EAAM,GAGX,OAAOD,EAAKD,EAAKE,CAAI,CACtB,CAKAL,EAAO,QAAUE,ICvBjB,IAAII,EAAO,IAKX,OAAO,QAAUA",
|
|
6
|
+
"names": ["require_main", "__commonJSMin", "exports", "module", "resolveGetter", "last", "arr", "get", "idx", "main"]
|
|
7
7
|
}
|
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 //
|
|
@@ -41,17 +38,10 @@ var dtype = require( '@stdlib/array-dtype' );
|
|
|
41
38
|
function last( arr ) {
|
|
42
39
|
var get;
|
|
43
40
|
var idx;
|
|
44
|
-
var dt;
|
|
45
|
-
|
|
46
|
-
// Resolve the input array data type:
|
|
47
|
-
dt = dtype( arr );
|
|
48
41
|
|
|
49
42
|
// Resolve an accessor for retrieving input array elements:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
} else {
|
|
53
|
-
get = getter( dt );
|
|
54
|
-
}
|
|
43
|
+
get = resolveGetter( arr );
|
|
44
|
+
|
|
55
45
|
// Resolve the last index:
|
|
56
46
|
idx = arr.length - 1;
|
|
57
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/array-base-last",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Return the last element of an array-like object.",
|
|
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-complex64": "^0.1.0",
|
|
48
|
-
"@stdlib/array-filled-by": "^0.0.2",
|
|
49
|
-
"@stdlib/bench": "^0.1.0",
|
|
50
|
-
"@stdlib/complex-imagf": "^0.1.0",
|
|
51
|
-
"@stdlib/complex-realf": "^0.1.0",
|
|
52
|
-
"@stdlib/math-base-assert-is-nanf": "^0.1.0",
|
|
53
|
-
"@stdlib/math-base-special-pow": "^0.1.0",
|
|
54
|
-
"@stdlib/random-base-discrete-uniform": "^0.0.6",
|
|
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
|