node-print: upgrade to 3
This commit is contained in:
parent
5f9dd684d6
commit
2fbaa61264
2 changed files with 16 additions and 5 deletions
|
@ -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=2
|
pkgver=3
|
||||||
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"
|
||||||
|
@ -11,16 +11,23 @@ depends="nodejs-current"
|
||||||
source="np index.js"
|
source="np index.js"
|
||||||
builddir="$srcdir"
|
builddir="$srcdir"
|
||||||
|
|
||||||
|
_assert() {
|
||||||
|
[ "$1" == "$2" ] || { echo "'$1' != '$2'"; return 1; }
|
||||||
|
}
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
local out
|
local out
|
||||||
out="$(echo test | node -r . -p "stdin().substring(2).replace('t', 'rc').replace('s', 'pt')")"
|
out="$(echo test | node -r . -p "stdin().substring(2).replace('t', 'rc').replace('s', 'pt')")"
|
||||||
[ "$out" == "ptrc" ]
|
_assert "$out" "ptrc"
|
||||||
|
|
||||||
out="$(echo '{"test":"property"}' | node -r . -p "stdin().test")"
|
out="$(echo '{"test":"property"}' | node -r . -p "stdin().test")"
|
||||||
[ "$out" == "property" ]
|
_assert "$out" "property"
|
||||||
|
|
||||||
out="$(echo '["item"]' | node -r . -p "stdin()[0]")"
|
out="$(echo '["item"]' | node -r . -p "stdin()[0]")"
|
||||||
[ "$out" == "item" ]
|
_assert "$out" "item"
|
||||||
|
|
||||||
|
out="$(echo crtp | node -r . -p "stdin().lines()[0].reverse()")"
|
||||||
|
_assert "$out" "ptrc"
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
|
@ -30,5 +37,5 @@ package() {
|
||||||
|
|
||||||
sha512sums="
|
sha512sums="
|
||||||
b3dfdeb49637be33d2e2718c5abcf35a87dd55023918c99341273c3b38bd6685189d1f786451a742c47c5f3bc3b58555decb58e2a3a018c9b9ee92043f8fac03 np
|
b3dfdeb49637be33d2e2718c5abcf35a87dd55023918c99341273c3b38bd6685189d1f786451a742c47c5f3bc3b58555decb58e2a3a018c9b9ee92043f8fac03 np
|
||||||
b02f090ed4366db10373ca468eedadf1b0ef6543f61fae4e40d2b38a1e1abef3fda68831577a5608b20ca48184cac679609d8389da4830ea0dd98971dcdebed6 index.js
|
7a1622dcfcdea192368329c962a25b42ca919895669f1e646e6958ef770c8c6a90cdeb88acea368fb40d5e956afff4baec0310dc06c78e6aa092947f9fc70fc7 index.js
|
||||||
"
|
"
|
||||||
|
|
|
@ -16,3 +16,7 @@ String.prototype.lines = function() {
|
||||||
let res = this.split("\n")
|
let res = this.split("\n")
|
||||||
return res.at(-1) === '' ? res.slice(0, -1) : res
|
return res.at(-1) === '' ? res.slice(0, -1) : res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String.prototype.reverse = function() {
|
||||||
|
return this.split('').reverse().join('')
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue