1{2 local std = self,34 thisFile:: error 'std.thisFile is deprecated, to enable its support in jrsonnet - recompile it with "legacy-this-file" support.\nThis will slow down stdlib caching a bit, though',56 mapWithKey(func, obj)::7 if !std.isFunction(func) then8 error ('std.mapWithKey first param must be function, got ' + std.type(func))9 else if !std.isObject(obj) then10 error ('std.mapWithKey second param must be object, got ' + std.type(obj))11 else12 { [k]: func(k, obj[k]) for k in std.objectFields(obj) },1314 deepJoin(arr)::15 if std.isString(arr) then16 arr17 else if std.isArray(arr) then18 std.join('', [std.deepJoin(x) for x in arr])19 else20 error 'Expected string or array, got %s' % std.type(arr),2122 assertEqual(a, b)::23 if a == b then24 true25 else26 error 'Assertion failed. ' + a + ' != ' + b,2728 mergePatch(target, patch)::29 if std.isObject(patch) then30 local target_object =31 if std.isObject(target) then target else {};3233 local target_fields =34 if std.isObject(target_object) then std.objectFields(target_object) else [];3536 local null_fields = [k for k in std.objectFields(patch) if patch[k] == null];37 local both_fields = std.setUnion(target_fields, std.objectFields(patch));3839 {40 [k]:41 if !std.objectHas(patch, k) then42 target_object[k]43 else if !std.objectHas(target_object, k) then44 std.mergePatch(null, patch[k]) tailstrict45 else46 std.mergePatch(target_object[k], patch[k]) tailstrict47 for k in std.setDiff(both_fields, null_fields)48 }49 else50 patch,5152 resolvePath(f, r)::53 local arr = std.split(f, '/');54 std.join('/', std.makeArray(std.length(arr) - 1, function(i) arr[i]) + [r]),5556 find(value, arr)::57 if !std.isArray(arr) then58 error 'find second parameter should be an array, got ' + std.type(arr)59 else60 std.filter(function(i) arr[i] == value, std.range(0, std.length(arr) - 1)),61}