Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renames number #28

Merged
merged 1 commit into from
Mar 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions Sources/Scripting/Script+Comparable.swift
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
/// Scripting methods whose values are comparable
extension Script where T: Comparable {

/// This method return true when the piped value is more than `number` and false otherwise.
/// - Parameter number: `Comparable` value
/// - Returns: Bool value by comparing the piped value and the parameter `number`
public func more(than number: T) -> Script<Bool> {
switch input {
case .success(let input):
return .init(success: input > number)
/// This method return true when the piped value is more than `rhs` and false otherwise.
/// - Parameter rhs: `Comparable` value
/// - Returns: Bool value by comparing the piped value and the parameter `rhs`
public func more(than rhs: T) -> Script<Bool> {
switch lhs {
case .success(let lhs):
return .init(success: lhs > rhs)
case .failure(let error):
return .init(failure: error)
}
}

/// This method return true when the piped value is less than `number` and false otherwise.
/// - Parameter number: `Comparable` value
/// - Returns: Bool value by comparing the piped value and the parameter `number`
public func less(than number: T) -> Script<Bool> {
switch input {
case .success(let input):
return .init(success: input < number)
/// This method return true when the piped value is less than `rhs` and false otherwise.
/// - Parameter rhs: `Comparable` value
/// - Returns: Bool value by comparing the piped value and the parameter `rhs`
public func less(than rhs: T) -> Script<Bool> {
switch lhs {
case .success(let lhs):
return .init(success: lhs < rhs)
case .failure(let error):
return .init(failure: error)
}
}

/// This method return true when the piped value is equal to `number` and false otherwise.
/// - Parameter number: `Comparable` value
/// - Returns: Bool value by comparing the piped value and the parameter `number`
public func equal(to number: T) -> Script<Bool> {
switch input {
case .success(let input):
return .init(success: input == number)
/// This method return true when the piped value is equal to `rhs` and false otherwise.
/// - Parameter rhs: `Comparable` value
/// - Returns: Bool value by comparing the piped value and the parameter `rhs`
public func equal(to rhs: T) -> Script<Bool> {
switch lhs {
case .success(let lhs):
return .init(success: lhs == rhs)
case .failure(let error):
return .init(failure: error)
}
Expand Down
Loading