node-print: upgrade to 7

This commit is contained in:
ptrcnull 2022-12-11 19:42:24 +01:00
parent b406e0872c
commit be9ef525f3
Signed by: ptrcnull
GPG key ID: 411F7B30801DD9CA
2 changed files with 16 additions and 2 deletions

View file

@ -1,7 +1,7 @@
# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=node-print
pkgver=6
pkgver=7
pkgrel=0
pkgdesc="another terrible javascript engine wrapper"
url="https://git.ddd.rip/ptrcnull/ptrcports"
@ -43,5 +43,5 @@ package() {
sha512sums="
b3dfdeb49637be33d2e2718c5abcf35a87dd55023918c99341273c3b38bd6685189d1f786451a742c47c5f3bc3b58555decb58e2a3a018c9b9ee92043f8fac03 np
56d67b0da1149a65902c7d60d9063c0846eac2229cba664879991ded528b14ab87d00ef68e270e5f4e4fd56c68c50502e51932b32eec1965ba6bea44a1061d14 index.js
0a7d7ab80bda095c17613bd104c06284049b95236df33b8f3e9413f6d804c3f1562678e0c77bb7c0dfde4f16deead6f23f81e83ade6189cbc8e67c6163332d82 index.js
"

View file

@ -62,6 +62,10 @@ Array.prototype.sum = function(def = 0) {
return this.reduce((a, b) => a + b, def)
}
Array.prototype.product = function(def = 1) {
return this.reduce((a, b) => a * b, def)
}
Array.prototype.sortNum = function() {
return this.sort((a, b) => a - b)
}
@ -95,3 +99,13 @@ Set.prototype.intersection = function(other) {
if (!other || !(other instanceof Set)) throw new TypeError('other must be a Set')
return new Set([...this].filter(el => other.has(el)))
}
global.matrix = function(x, y, elem) {
return new Array(y).fill().map(() => new Array(x).fill().map((_, i) => {
if (typeof elem === 'function') {
return elem(i)
} else {
return elem
}
}))
}