unquoted, empty strings are null
This commit is contained in:
parent
d19c112765
commit
0e0b01f595
@ -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()),
|
||||
}
|
||||
|
@ -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> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user