From 5f9dd684d675d64440bd7a4abf4583c276ca0810 Mon Sep 17 00:00:00 2001 From: ptrcnull Date: Sat, 27 Aug 2022 13:51:10 +0200 Subject: [PATCH] node-print: upgrade to 2 --- node-print/APKBUILD | 11 +++++++++-- node-print/index.js | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/node-print/APKBUILD b/node-print/APKBUILD index 73966ca..b8589b0 100644 --- a/node-print/APKBUILD +++ b/node-print/APKBUILD @@ -1,7 +1,7 @@ # Contributor: Patrycja Rosa # Maintainer: Patrycja Rosa pkgname=node-print -pkgver=1 +pkgver=2 pkgrel=0 pkgdesc="another terrible javascript engine wrapper" url="https://git.ddd.rip/ptrcnull/ptrcports" @@ -12,8 +12,15 @@ source="np index.js" builddir="$srcdir" check() { + local out out="$(echo test | node -r . -p "stdin().substring(2).replace('t', 'rc').replace('s', 'pt')")" [ "$out" == "ptrc" ] + + out="$(echo '{"test":"property"}' | node -r . -p "stdin().test")" + [ "$out" == "property" ] + + out="$(echo '["item"]' | node -r . -p "stdin()[0]")" + [ "$out" == "item" ] } package() { @@ -23,5 +30,5 @@ package() { sha512sums=" b3dfdeb49637be33d2e2718c5abcf35a87dd55023918c99341273c3b38bd6685189d1f786451a742c47c5f3bc3b58555decb58e2a3a018c9b9ee92043f8fac03 np -979cf7427821309c3f0a5e00d2ebac44d88582f949ddb71959a81a5ca8f4aca15f54a376c8217a94f7ab5aca229dddc59bcebb657ee0c319a5ace330750a8ddd index.js +b02f090ed4366db10373ca468eedadf1b0ef6543f61fae4e40d2b38a1e1abef3fda68831577a5608b20ca48184cac679609d8389da4830ea0dd98971dcdebed6 index.js " diff --git a/node-print/index.js b/node-print/index.js index 6da210f..d932faa 100644 --- a/node-print/index.js +++ b/node-print/index.js @@ -1,7 +1,7 @@ global.stdin = () => { const fs = require('fs') const out = fs.readFileSync(0).toString() - if (out.at(0) === '{') { + if (out.at(0) === '{' || out.at(0) === '[') { return JSON.parse(out) } else { return out