One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: gogs | |
| # Required-Start: $remote_fs $syslog | |
| # Required-Stop: $remote_fs $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Git repository manager Gogs | |
| # Description: Starts and stops the self-hosted git repository manager Gogs | |
| ### END INIT INFO |
| function stockAndCount(n, arr) { | |
| let pairs = 0; // pairs number | |
| const colors = arr.reduce((acc, val) => { | |
| acc[val] ? (acc[val] += 1) : (acc[val] = 1); | |
| return acc; | |
| }, {}); // return an object with colors (numbers) as keys and quantity as value | |
| Object.keys(colors).forEach((n) => { // for each key in colors | |
| let _pair = parseInt(colors[n] / 2); // looks for even numbers | |
| if (_pair >= 1) pairs += _pair; // total |