node-print: upgrade to 13

adds set difference
This commit is contained in:
ptrcnull 2023-05-19 19:59:00 +02:00
parent f4e4e5450a
commit be0aef322f
Signed by: ptrcnull
GPG key ID: 411F7B30801DD9CA
3 changed files with 19 additions and 1 deletions

View file

@ -1,7 +1,7 @@
# Contributor: Patrycja Rosa <alpine@ptrcnull.me> # Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me> # Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=node-print pkgname=node-print
pkgver=12 pkgver=13
pkgrel=0 pkgrel=0
pkgdesc="another terrible javascript engine wrapper" pkgdesc="another terrible javascript engine wrapper"
url="https://git.ddd.rip/ptrcnull/ptrcports" url="https://git.ddd.rip/ptrcnull/ptrcports"

View file

@ -148,6 +148,11 @@ Set.prototype.intersection = function(other) {
return new Set([...this].filter(el => other.has(el))) return new Set([...this].filter(el => other.has(el)))
} }
Set.prototype.difference = function(other) {
if (!other || !(other instanceof Set)) throw new TypeError('other must be a Set')
return new Set([...this].filter(el => !other.has(el)))
}
Set.prototype.at = function(index) { Set.prototype.at = function(index) {
return [...this].at(index) return [...this].at(index)
} }

View file

@ -196,6 +196,19 @@ test('Set.prototype.intersection', t => {
) )
}) })
test('Set.prototype.difference', t => {
const left = new Set([1, 2, 3])
const right = new Set([2, 4])
assert.deepEqual(
new Set([1, 3]),
left.difference(right)
)
assert.deepEqual(
new Set([4]),
right.difference(left)
)
})
test('Set.prototype.at - single element', t => { test('Set.prototype.at - single element', t => {
assert.equal( assert.equal(
2, 2,