From 0505bf5f424cb5ba607c06cd821c1593fd7a2bef Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 17 Dec 2012 13:54:45 +0100 Subject: [PATCH] jshn: introduce json_is_a() convenience function to check field types without using a temporary variable --- sh/jshn.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sh/jshn.sh b/sh/jshn.sh index 0b0c754..39d5331 100644 --- a/sh/jshn.sh +++ b/sh/jshn.sh @@ -244,3 +244,10 @@ json_select() { ;; esac } + +json_is_a() { + local type + + json_get_type type "$1" + [ "$type" = "$2" ] +} -- 2.25.1