node-print: upgrade to 13
adds set difference
This commit is contained in:
parent
f4e4e5450a
commit
be0aef322f
3 changed files with 19 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
|
||||
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
|
||||
pkgname=node-print
|
||||
pkgver=12
|
||||
pkgver=13
|
||||
pkgrel=0
|
||||
pkgdesc="another terrible javascript engine wrapper"
|
||||
url="https://git.ddd.rip/ptrcnull/ptrcports"
|
||||
|
|
|
@ -148,6 +148,11 @@ Set.prototype.intersection = function(other) {
|
|||
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) {
|
||||
return [...this].at(index)
|
||||
}
|
||||
|
|
|
@ -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 => {
|
||||
assert.equal(
|
||||
2,
|
||||
|
|
Loading…
Reference in a new issue