macro_rules! intersection {
    () => { ... };
    ($a:expr $(,)*) => { ... };
    ($a:expr, $b:expr $(,)*) => { ... };
    ($a:expr, $b:expr, $($rest:tt)*) => { ... };
}
Expand description

Based on intersection()

Examples:

#[macro_use] extern crate serde_json_lodash;
use serde_json::json;
assert_eq!(
  intersection!(json!([2, 1]), json!([2, 3])),
  json!([2])
);

More examples:

assert_eq!(intersection!(), json!([]));
assert_eq!(intersection!(json!(null)), json!([]));
assert_eq!(intersection!(json!(false)), json!([]));
assert_eq!(intersection!(json!(0)), json!([]));
assert_eq!(intersection!(json!("")), json!([]));
assert_eq!(intersection!(json!("ab")), json!([]));
assert_eq!(intersection!(json!([])), json!([]));
assert_eq!(intersection!(json!({})), json!([]));
assert_eq!(intersection!(json!([null,false,0,"","ab",[],{}])), json!([null,false,0,"","ab",[],{}]));
assert_eq!(intersection!(json!([null,false,0,"","ab",[],{}]), json!([])), json!([]));
assert_eq!(intersection!(json!([null,false,0,"","ab",[],{}]), json!([null,false,0,"","ab",[],{}])), json!([null,false,0,"","ab"]));
assert_eq!(intersection!(json!([null, false, 1]), json!([null,false,0]), json!([false, 2, null])), json!([null,false]));