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:
@ -164,7 +164,7 @@ fn action(
|
||||
head: Span,
|
||||
) -> Value {
|
||||
match input {
|
||||
Value::String { val, .. } => Value::boolean(
|
||||
Value::String { val, .. } => Value::bool(
|
||||
match case_insensitive {
|
||||
true => {
|
||||
if *not_contain {
|
||||
|
@ -94,7 +94,7 @@ fn action(input: &Value, args: &Arguments, head: Span) -> Value {
|
||||
} else {
|
||||
s.ends_with(&args.substring)
|
||||
};
|
||||
Value::boolean(ends_with, head)
|
||||
Value::bool(ends_with, head)
|
||||
}
|
||||
Value::Error { .. } => input.clone(),
|
||||
_ => Value::Error {
|
||||
|
@ -110,7 +110,7 @@ fn action(
|
||||
} else {
|
||||
s.starts_with(substring)
|
||||
};
|
||||
Value::boolean(starts_with, head)
|
||||
Value::bool(starts_with, head)
|
||||
}
|
||||
Value::Error { .. } => input.clone(),
|
||||
_ => Value::Error {
|
||||
|
Reference in New Issue
Block a user