Skip to content

Commit

Permalink
Renames number
Browse files Browse the repository at this point in the history
  • Loading branch information
KS1019 committed Mar 17, 2024
1 parent 7ff3b97 commit 6713bbf
Showing 1 changed file with 21 additions and 21 deletions.
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

0 comments on commit 6713bbf

Please sign in to comment.