1.0.1 • Published 6 years ago
array-first-last v1.0.1
ARRAY-FIRST-LAST
The library to extend Array first and last element
**
Installation
**
Install npm:
npm i -S array-first-last
In html:
<body>
<script src="node_modules/array-first-last/lib.js"></script>
</body>
In typescript:
// in angular include in main.js, angular.json or index.html
import 'array-first-last/index';
Definitions types node_modules/array-first-last/index.d.ts
In Node.js:
require('array-first-last');
FIRST OR LAST
first and last support getter and setter
const array = [10, 20, 30, 35];
console.log(array.last); // => 35
console.log(array.first); // => 10
array.last = 100;
console.log(array.last); // => 100
array.first = 15;
console.log(array.first); // => 15
console.log(array); // [15, 20, 30, 100]