diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-12-17 16:54:45 +0400 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-12-17 16:54:45 +0400 |
commit | 0505bf5f424cb5ba607c06cd821c1593fd7a2bef (patch) | |
tree | 6072a2d48f974c07471cd5c5386ce64d4662e013 /sh | |
parent | 079549666fb172e74869653dcaf7d26b738d94db (diff) |
jshn: introduce json_is_a() convenience function to check field types without using a temporary variable
Diffstat (limited to 'sh')
-rw-r--r-- | sh/jshn.sh | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -244,3 +244,10 @@ json_select() { ;; esac } + +json_is_a() { + local type + + json_get_type type "$1" + [ "$type" = "$2" ] +} |