Skip to content

Commit 8c1bb9a

Browse files
authored
Merge pull request #227 from ankurp/bump-version
Bumping version, fixing and linting docs
2 parents e38c12d + b8610ed commit 8c1bb9a

4 files changed

Lines changed: 34 additions & 28 deletions

File tree

‎.swiftlint.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
disabled_rules:
2-
- valid_docs
32
- type_body_length
43
- file_length
54
- type_name

‎Dollar.podspec‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "Dollar"
3-
s.version = "5.1.0"
3+
s.version = "5.2.0"
44
s.summary = "A functional tool-belt for Swift Language"
55
s.homepage = "https://github.com/ankurp/Dollar"
66
s.license = { :type => "MIT", :file => "LICENSE" }

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ Dollar is a Swift library that provides useful functional programming helper met
2323

2424
## Using [Carthage](https://github.com/Carthage/Carthage)
2525

26-
Add `github "ankurp/Dollar" ~> 5.1.0` to your `Cartfile` and run `carthage update`. If unfamiliar with Carthage then checkout their [Getting Started section](https://github.com/Carthage/Carthage#getting-started) or this [sample app](https://github.com/ankurp/DollarCarthageApp)
26+
Add `github "ankurp/Dollar" ~> 5.2.0` to your `Cartfile` and run `carthage update`. If unfamiliar with Carthage then checkout their [Getting Started section](https://github.com/Carthage/Carthage#getting-started) or this [sample app](https://github.com/ankurp/DollarCarthageApp)
2727

2828
## Using [cocoapods](http://cocoapods.org/) version 0.36.x or greater
2929

3030
Add `pod 'Dollar'` to your `Podfile` and run `pod install`. Add `use_frameworks!` to the end of the `Podfile`. Also checkout this [sample app](https://github.com/ankurp/DollarPodApp). Requires cocoapod version 0.36.x or greater.
3131

3232
## Using [Swift Package Manager](https://github.com/apple/swift-package-manager)
3333

34-
Add the following dependency `.Package(url: "https://github.com/ankurp/Dollar", majorVersion: 5, minor: 0)` to your `Package.swift` file and then run `swift build`. Requires swift version 2.2 or greater that you can install from https://swift.org
34+
Add the following dependency `.Package(url: "https://github.com/ankurp/Dollar", majorVersion: 5, minor: 2)` to your `Package.swift` file and then run `swift build`. Requires swift version 2.2 or greater that you can install from https://swift.org
3535

3636
## Using `git submodule`
3737

‎Sources/Dollar.swift‎

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class $ {
3131

3232
/// Creates a function that executes passed function only after being called n times.
3333
///
34-
/// - parameter n: Number of times after which to call function.
34+
/// - parameter num: Number of times after which to call function.
3535
/// - parameter function: Function to be called that takes params.
3636
/// - returns: Function that can be called n times after which the callback function is called.
3737
public class func after<T, E>(num: Int, function: (T...) -> E) -> ((T...) -> E?) {
@@ -49,7 +49,7 @@ public class $ {
4949

5050
/// Creates a function that executes passed function only after being called n times.
5151
///
52-
/// - parameter n: Number of times after which to call function.
52+
/// - parameter num: Number of times after which to call function.
5353
/// - parameter function: Function to be called that does not take any params.
5454
/// - returns: Function that can be called n times after which the callback function is called.
5555
public class func after<T>(num: Int, function: () -> T) -> (() -> T?) {
@@ -186,7 +186,7 @@ public class $ {
186186
///
187187
/// - parameter array: to cycle through
188188
/// - parameter callback: function to call with the element
189-
public class func cycle<T, U>(array: [T], callback: (T) -> (U)) {
189+
public class func cycle<T, U>(array: [T], callback: T -> U) {
190190
while true {
191191
for elem in array {
192192
callback(elem)
@@ -199,7 +199,7 @@ public class $ {
199199
/// - parameter array: to cycle through
200200
/// - parameter times: Number of times to cycle through the array
201201
/// - parameter callback: function to call with the element
202-
public class func cycle<T, U>(array: [T], _ times: Int, callback: (T) -> (U)) {
202+
public class func cycle<T, U>(array: [T], _ times: Int, callback: T -> U) {
203203
for _ in 0..<times {
204204
for elem in array {
205205
callback(elem)
@@ -351,7 +351,9 @@ public class $ {
351351
/// Fills elements of array with value from start up to, but not including, end.
352352
///
353353
/// - parameter array: to fill
354-
/// - parameter elem: the element to replace
354+
/// - parameter withElem: the element to replace
355+
/// - parameter startIndex: start index
356+
/// - parameter endIndex: end index
355357
/// - returns: array elements chunked
356358
public class func fill<T>(inout array: [T], withElem elem: T, startIndex: Int = 0, endIndex: Int? = .None) -> [T] {
357359
let endIndex = endIndex ?? array.count
@@ -426,8 +428,9 @@ public class $ {
426428
}
427429
/// Splits a collection into sets, grouped by the result of running each value through a callback.
428430
///
429-
/// :param The array to group
430-
/// :param callback Function whose response will be used as a key in the new string
431+
/// - parameter array: The array to group
432+
/// - parameter callback: Function whose response will be used as a key in the new string
433+
/// - returns: grouped collection
431434
public class func groupBy<T, U: Hashable>(array: [T], callback: (T) -> U) -> [U: [T]] {
432435
var grouped = [U: [T]]()
433436
for element in array {
@@ -484,14 +487,16 @@ public class $ {
484487
/// Maps a function that converts elements to a list and then concatenates them.
485488
///
486489
/// - parameter array: The array to map.
490+
/// - parameter function: callback function that should return flattened values
487491
/// - returns: The array with the transformed values concatenated together.
488492
public class func flatMap<T, U>(array: [T], function: (T) -> ([U])) -> [U] {
489493
return array.map(function).reduce([], combine: +)
490494
}
491495

492496
/// Maps a function that converts a type to an Optional over an Optional, and then returns a single-level Optional.
493497
///
494-
/// - parameter array: The array to map.
498+
/// - parameter value: The array to map.
499+
/// - parameter function: callback function that should return mapped values
495500
/// - returns: The array with the transformed values concatenated together.
496501
public class func flatMap<T, U>(value: T?, function: (T) -> (U?)) -> U? {
497502
if let unwrapped = value.map(function) {
@@ -638,17 +643,17 @@ public class $ {
638643

639644
/// Returns true if i is in range
640645
///
641-
/// - parameter i: to check if it is in range
642-
/// - parameter range: to check in
646+
/// - parameter index: to check if it is in range
647+
/// - parameter isIn: to check in
643648
/// - returns: true if it is in range otherwise false
644649
public class func it<T: Comparable>(index: T, isIn range: Range<T>) -> Bool {
645650
return index >= range.startIndex && index < range.endIndex
646651
}
647652

648653
/// Returns true if i is in interval
649654
///
650-
/// - parameter i: to check if it is in interval
651-
/// - parameter interval: to check in
655+
/// - parameter index: to check if it is in interval
656+
/// - parameter isIn: to check in
652657
/// - returns: true if it is in interval otherwise false
653658
public class func it<I: IntervalType>(index: I.Bound, isIn interval: I) -> Bool {
654659
return interval.contains(index)
@@ -1004,6 +1009,7 @@ public class $ {
10041009
/// Removes all provided values from the given array.
10051010
///
10061011
/// - parameter array: The array to source from.
1012+
/// - parameter values: values to remove from the array
10071013
/// - returns: Array with values pulled out.
10081014
public class func pull<T: Equatable>(array: [T], values: T...) -> [T] {
10091015
return self.pull(array, values: values)
@@ -1021,7 +1027,7 @@ public class $ {
10211027
/// Removes all provided values from the given array at the given indices
10221028
///
10231029
/// - parameter array: The array to source from.
1024-
/// - parameter values: The indices to remove from.
1030+
/// - parameter indices: The indices to remove from.
10251031
/// - returns: Array with values pulled out.
10261032
public class func pullAt<T: Equatable>(array: [T], indices: Int...) -> [T] {
10271033
var elemToRemove = [T]()
@@ -1033,6 +1039,7 @@ public class $ {
10331039

10341040
/// Returns random number from 0 upto but not including upperBound
10351041
///
1042+
/// - parameter upperBound: upper bound when generating random number
10361043
/// - returns: Random number
10371044
public class func random(upperBound: Int) -> Int {
10381045
return Int(arc4random_uniform(UInt32(upperBound)))
@@ -1115,7 +1122,7 @@ public class $ {
11151122
/// Removes an element from an array.
11161123
///
11171124
/// - parameter array: The array to source from.
1118-
/// - parameter element: Element that is to be removed
1125+
/// - parameter value: Element that is to be removed
11191126
/// - returns: Array with element removed.
11201127
public class func remove<T: Equatable>(array: [T], value: T) -> [T] {
11211128
return self.remove(array, callback: {$0 == value})
@@ -1190,7 +1197,7 @@ public class $ {
11901197
/// Call a function n times and also passes the index. If a value is returned
11911198
/// in the function then the times method will return an array of those values.
11921199
///
1193-
/// - parameter n: Number of times to call function.
1200+
/// - parameter num: Number of times to call function.
11941201
/// - parameter function: The function to be called every time.
11951202
/// - returns: Values returned from callback function.
11961203
public class func times<T>(num: Int, function: () -> T) -> [T] {
@@ -1202,9 +1209,9 @@ public class $ {
12021209
/// Call a function n times and also passes the index. If a value is returned
12031210
/// in the function then the times method will return an array of those values.
12041211
///
1205-
/// - parameter n: Number of times to call function.
1206-
/// - parameter function: The function to be called every time.
1207-
public class func times(num: Int, function: () -> ()) {
1212+
/// - parameter num: Number of times to call function
1213+
/// - parameter function: The function to be called every time
1214+
public class func times(num: Int, function: Void -> Void) {
12081215
self.times(num) { (index: Int) -> () in
12091216
function()
12101217
}
@@ -1213,7 +1220,7 @@ public class $ {
12131220
/// Call a function n times and also passes the index. If a value is returned
12141221
/// in the function then the times method will return an array of those values.
12151222
///
1216-
/// - parameter n: Number of times to call function.
1223+
/// - parameter num: Number of times to call function.
12171224
/// - parameter function: The function to be called every time that takes index.
12181225
/// - returns: Values returned from callback function.
12191226
public class func times<T>(num: Int, function: (Int) -> T) -> [T] {
@@ -1226,7 +1233,7 @@ public class $ {
12261233

12271234
/// Transposes matrix if able. If unable; parameter matrix is returned.
12281235
///
1229-
/// - parameter A: generic matrix containing any type.
1236+
/// - parameter matrix: Generic matrix containing any type.
12301237
/// - returns: A transposed version of input matrix.
12311238
public class func transpose<T>(matrix: [[T]]) -> [[T]] {
12321239
guard matrix.filter({ return $0.count == matrix[0].count }).count == matrix.count,
@@ -1394,7 +1401,7 @@ public class Chain<C> {
13941401

13951402
/// Initializer of the wrapper object for chaining.
13961403
///
1397-
/// - parameter array: The array to wrap.
1404+
/// - parameter collection: The array to wrap.
13981405
public init(_ collection: [C]) {
13991406
self.result = Wrapper(collection)
14001407
}
@@ -1462,7 +1469,7 @@ public class Chain<C> {
14621469

14631470
/// Get the first object in the wrapper object.
14641471
///
1465-
/// - parameter array: The array to wrap.
1472+
/// - parameter function: The array to wrap.
14661473
/// - returns: The wrapper object.
14671474
public func map(function: (Int, C) -> C) -> Chain {
14681475
return self.queue {
@@ -1476,7 +1483,7 @@ public class Chain<C> {
14761483

14771484
/// Get the first object in the wrapper object.
14781485
///
1479-
/// - parameter array: The array to wrap.
1486+
/// - parameter function: The array to wrap.
14801487
/// - returns: The wrapper object.
14811488
public func each(function: (C) -> ()) -> Chain {
14821489
return self.queue {
@@ -1489,7 +1496,7 @@ public class Chain<C> {
14891496

14901497
/// Get the first object in the wrapper object.
14911498
///
1492-
/// - parameter array: The array to wrap.
1499+
/// - parameter function: The array to wrap.
14931500
/// - returns: The wrapper object.
14941501
public func each(function: (Int, C) -> ()) -> Chain {
14951502
return self.queue {

0 commit comments

Comments
 (0)