Added numbers game.

This commit is contained in:
Niels Simenon
2023-04-10 05:54:27 +02:00
parent 8c34fe5013
commit 4fbd366bb9
7 changed files with 2120 additions and 16 deletions

View File

@@ -3,8 +3,9 @@
const config = require('config');
const style = require('./style');
function getLeaders(points, user, ping = true, limit = Infinity) {
function getLeaders(points, user, { ping = true, limit = 20, skip = [] } = {}) {
return Object.entries(points)
.filter(([userKey]) => !skip.includes(userKey))
.sort(([, scoreA], [, scoreB]) => scoreB - scoreA)
.slice(0, limit)
.map(([userKey, score], index) => {

1866
src/utils/numbers-solver.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,7 @@ function schatCode(text) {
function curate(fn) {
return (text) => {
if (text) {
if (typeof text !== 'undefined' && text !== null) {
return fn(text);
}