unquoted, empty strings are null

This commit is contained in:
ConnorSkees 2020-03-22 18:36:21 -04:00
parent d19c112765
commit 0e0b01f595
2 changed files with 5 additions and 2 deletions

View File

@ -55,7 +55,6 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
Box::new(|args, _| {
max_args!(args, 1);
match arg!(args, 0, "string") {
Value::Ident(i, _) if i.is_empty() => Ok(Value::Null),
i @ Value::Ident(..) => Ok(i.unquote()),
v => Err(format!("$string: {} is not a string.", v).into()),
}

View File

@ -99,7 +99,11 @@ impl Display for Value {
impl Value {
pub fn is_null(&self) -> bool {
self == &Value::Null
match self {
&Value::Null => true,
Value::Ident(i, QuoteKind::None) if i.is_empty() => true,
_ => false
}
}
pub fn is_true(&self) -> SassResult<bool> {