mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Add functions for each Value
case (#9736)
# Description This PR ensures functions exist to extract and create each and every `Value` case. It also renames `Value::boolean` to `Value::bool` to match `Value::test_bool`, `Value::as_bool`, and `Value::Bool`. Similarly, `Value::as_integer` was renamed to `Value::as_int` to be consistent with `Value::int`, `Value::test_int`, and `Value::Int`. These two renames can be undone if necessary. # User-Facing Changes No user facing changes, but two public functions were renamed which may affect downstream dependents.
This commit is contained in:
@ -82,7 +82,7 @@ fn convert_gjson_value_to_nu_value(v: &gjValue, span: &Span) -> Value {
|
||||
Value::List { vals, span: *span }
|
||||
}
|
||||
gjson::Kind::Null => Value::nothing(*span),
|
||||
gjson::Kind::False => Value::boolean(false, *span),
|
||||
gjson::Kind::False => Value::bool(false, *span),
|
||||
gjson::Kind::Number => {
|
||||
let str_value = v.str();
|
||||
if str_value.contains('.') {
|
||||
@ -92,7 +92,7 @@ fn convert_gjson_value_to_nu_value(v: &gjValue, span: &Span) -> Value {
|
||||
}
|
||||
}
|
||||
gjson::Kind::String => Value::string(v.str(), *span),
|
||||
gjson::Kind::True => Value::boolean(true, *span),
|
||||
gjson::Kind::True => Value::bool(true, *span),
|
||||
gjson::Kind::Object => {
|
||||
let mut cols = vec![];
|
||||
let mut vals = vec![];
|
||||
|
@ -66,7 +66,7 @@ pub fn execute_xpath_query(
|
||||
}
|
||||
sxd_xpath::Value::Boolean(b) => {
|
||||
cols.push(key.to_string());
|
||||
vals.push(Value::boolean(b, call.head));
|
||||
vals.push(Value::bool(b, call.head));
|
||||
}
|
||||
sxd_xpath::Value::Number(n) => {
|
||||
cols.push(key.to_string());
|
||||
|
Reference in New Issue
Block a user