@stdlib/array-base-last 0.0.1 → 0.2.0

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 CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2023 The Stdlib Authors.
1
+ Copyright (c) 2016-2024 The Stdlib Authors.
package/README.md CHANGED
@@ -18,6 +18,17 @@ limitations under the License.
18
18
 
19
19
  -->
20
20
 
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
+
21
32
  # last
22
33
 
23
34
  [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
@@ -152,7 +163,7 @@ See [LICENSE][stdlib-license].
152
163
 
153
164
  ## Copyright
154
165
 
155
- Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
166
+ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
156
167
 
157
168
  </section>
158
169
 
@@ -165,8 +176,8 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
165
176
  [npm-image]: http://img.shields.io/npm/v/@stdlib/array-base-last.svg
166
177
  [npm-url]: https://npmjs.org/package/@stdlib/array-base-last
167
178
 
168
- [test-image]: https://github.com/stdlib-js/array-base-last/actions/workflows/test.yml/badge.svg?branch=v0.0.1
169
- [test-url]: https://github.com/stdlib-js/array-base-last/actions/workflows/test.yml?query=branch:v0.0.1
179
+ [test-image]: https://github.com/stdlib-js/array-base-last/actions/workflows/test.yml/badge.svg?branch=v0.2.0
180
+ [test-url]: https://github.com/stdlib-js/array-base-last/actions/workflows/test.yml?query=branch:v0.2.0
170
181
 
171
182
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-base-last/main.svg
172
183
  [coverage-url]: https://codecov.io/github/stdlib-js/array-base-last?branch=main
@@ -189,8 +200,11 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
189
200
  [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
190
201
 
191
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
192
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
193
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
194
208
  [branches-url]: https://github.com/stdlib-js/array-base-last/blob/main/branches.md
195
209
 
196
210
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/array-base-last/main/LICENSE
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security
2
+
3
+ > Policy for reporting security vulnerabilities.
4
+
5
+ See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import last from '../docs/types/index';
3
+ export = last;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
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
+ /** @license Apache-2.0 */
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 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
+ }
@@ -20,7 +20,7 @@
20
20
 
21
21
  /// <reference types="@stdlib/types"/>
22
22
 
23
- import { Collection } from '@stdlib/types/object';
23
+ import { Collection } from '@stdlib/types/array';
24
24
 
25
25
  /**
26
26
  * Returns the last element of an array-like object.
package/lib/main.js CHANGED
@@ -20,10 +20,7 @@
20
20
 
21
21
  // MODULES //
22
22
 
23
- var isAccessorArray = require( '@stdlib/array-base-assert-is-accessor-array' );
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
- if ( isAccessorArray( arr ) ) {
51
- get = accessorGetter( dt );
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.0.1",
3
+ "version": "0.2.0",
4
4
  "description": "Return the last element of an array-like object.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,24 +37,22 @@
37
37
  "url": "https://github.com/stdlib-js/stdlib/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@stdlib/array-base-accessor-getter": "^0.0.1",
41
- "@stdlib/array-base-assert-is-accessor-array": "^0.0.1",
42
- "@stdlib/array-base-getter": "^0.0.1",
43
- "@stdlib/array-dtype": "^0.0.6",
44
- "@stdlib/types": "^0.0.14"
40
+ "@stdlib/array-base-resolve-getter": "^0.2.0",
41
+ "@stdlib/types": "^0.3.1"
45
42
  },
46
43
  "devDependencies": {
47
- "@stdlib/array-complex64": "^0.0.6",
48
- "@stdlib/array-filled-by": "^0.0.2",
49
- "@stdlib/bench": "^0.0.12",
50
- "@stdlib/complex-imagf": "^0.0.1",
51
- "@stdlib/complex-realf": "^0.0.1",
52
- "@stdlib/math-base-assert-is-nanf": "^0.0.8",
53
- "@stdlib/math-base-special-pow": "^0.0.7",
54
- "@stdlib/random-base-discrete-uniform": "^0.0.6",
44
+ "@stdlib/array-complex64": "^0.1.0",
45
+ "@stdlib/array-filled-by": "^0.1.0",
46
+ "@stdlib/complex-imagf": "^0.2.0",
47
+ "@stdlib/complex-realf": "^0.2.0",
48
+ "@stdlib/math-base-assert-is-nanf": "^0.2.0",
49
+ "@stdlib/math-base-special-pow": "^0.2.0",
50
+ "@stdlib/random-base-discrete-uniform": "^0.1.0",
55
51
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
56
52
  "istanbul": "^0.4.1",
57
- "tap-min": "git+https://github.com/Planeshifter/tap-min.git"
53
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git",
54
+ "@stdlib/bench-harness": "^0.2.0",
55
+ "@stdlib/bench": "^0.3.1"
58
56
  },
59
57
  "engines": {
60
58
  "node": ">=0.10.0",