pub fn concat(value: Value, mut args: HashMap<String, Value>) -> Result<Value> {
    let mut arr = try_get_value!("concat", "value", Vec<Value>, value);

    let value = match args.remove("with") {
        Some(val) => val,
        None => bail!("The `concat` filter has to have a `with` argument"),
    };

    if value.is_array() {
        match value {
            Value::Array(vals) => {
                for val in vals {
                    arr.push(val);
                }
            }
            _ => unreachable!("Got something other than an array??"),
        }
    } else {
        arr.push(value);
    }

    Ok(to_value(arr).unwrap())
}
/// Concat the array with another one if the `with` parameter is an array or
/// just append it otherwise
Concat the array with another one if the `with` parameter is an array or
just append it otherwise
Concat the array with another one if the ` with ` parameter is an array or just append it otherwise
pub fn concat(value: Value, mut args: HashMap<String, Value>) -> Result<Value> {
    let mut arr = try_get_value!("concat", "value", Vec<Value>, value);
    let value = match args.remove("with") {
        Some(val) => val,
        None => bail!("The `concat` filter has to have a `with` argument"),
    };
    if value.is_array() {
        match value {
            Value::Array(vals) => {
                for val in vals {
                    arr.push(val);
                }
            }
            _ => unreachable!("Got something other than an array??"),
        }
    } else {
        arr.push(value);
    }
    Ok(to_value(arr).unwrap())
}
pub fn concat ( value : Value , mut args : HashMap < String , Value > ) -> Result < Value > { let mut arr = try_get_value ! ( " " " " Vec Value value ) ; let value = match args . remove ( " " ) { Some ( val ) => val , None => bail ! ( " " ) , } ; if value . is_array ( ) { match value { Value :: Array ( vals ) => { for val in vals { arr . push ( val ) ; } } _ => unreachable ! ( " " ) , } } else { arr . push ( value ) ; } Ok ( to_value ( arr ) . unwrap ( ) ) }
Concat the array with another one if the `with` parameter is an array or
just append it otherwise
Concat the array with another one if the ` with ` parameter is an array or just append it otherwise
value
Value
args
HashMap<String, Value>
value
Value
args
HashMap<String, Value>