Example #1
0
        public static JToken Array(IntrinsicFunction function, JToken input, JObject context,
                                   IntrinsicFunctionRegistry registry)
        {
            Ensure.IsNotNull <ArgumentNullException>(function);
            Ensure.IsNotNull <ArgumentNullException>(registry);

            var result = new JArray();

            foreach (var p in function.Parameters)
            {
                result.Add(p switch
                {
                    NullIntrinsicParam _ => null,
                    StringIntrinsicParam s => s.Value,
                    NumberIntrinsicParam n => n.Number,
                    PathIntrinsicParam pa => GetPathValue(pa, input, context),
                    IntrinsicFunction func => registry.CallFunction(func, input, context),
                    _ => throw new InvalidIntrinsicFunctionException("Invalid Parameter type")
                });
 public InputOutputProcessor(IntrinsicFunctionRegistry registry)
 {
     _registry = registry;
 }