index() with maps

This commit is contained in:
ConnorSkees 2020-04-03 13:43:34 -04:00
parent 2efab1cebe
commit f2bb6097dc
2 changed files with 6 additions and 5 deletions

View File

@ -221,6 +221,7 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
max_args!(args, 2);
let list = match arg!(args, 0, "list") {
Value::List(v, ..) => v,
Value::Map(m) => m.entries(),
v => vec![v],
};
let value = arg!(args, 1, "value");

View File

@ -288,8 +288,8 @@ test!(
"a {\n color: index(1px solid red, dashed);\n}\n",
""
);
// test!(
// index_found_map,
// "a {\n color: index((width: 10px, height: 20px), (height 20px));\n}\n",
// "a {\n color: 2;\n}\n"
// );
test!(
index_found_map,
"a {\n color: index((width: 10px, height: 20px), (height 20px));\n}\n",
"a {\n color: 2;\n}\n"
);