Skip to content

Commit 433d4ba

Browse files
committed
Updating project and bumping minor version for new functions added
1 parent 91f13c4 commit 433d4ba

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

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 = "7.0.0"
3+
s.version = "7.1.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: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Creates an array with all nil values removed.
9898
$.compact([3, nil, 4, 5])
9999
=> [3, 4, 5]
100100

101-
$.compact([nil, nil]) as NSObject[]
101+
$.compact([nil, nil]) as [NSObject]
102102
=> []
103103
```
104104

@@ -268,7 +268,7 @@ result
268268
=> 1
269269
```
270270

271-
### first - `$.first(array: AnyObject[])`
271+
### first - `$.first(array: [AnyObject])`
272272

273273
Gets the first element in the array.
274274

@@ -291,7 +291,7 @@ $.groupBy(["strings", "with", "different", lengths"], callback: {$0.characters.c
291291
=> [7: ["strings", "lengths"], 9: ["different"], 4: ["With"]]
292292
```
293293
294-
### second - `$.second(array: AnyObject[])`
294+
### second - `$.second(array: [AnyObject])`
295295
296296
Gets the second element in the array.
297297
@@ -339,13 +339,13 @@ NSURL(string: "https://apple.com/swift/")?.lastPathComponent
339339
Flattens a nested array of any depth.
340340

341341
```swift
342-
$.flatten([[3], 4, 5]) as Int[]
342+
$.flatten([[3], 4, 5])
343343
=> [3, 4, 5]
344344

345-
$.flatten([[3], "Hello", 5]) as NSObject[]
345+
$.flatten([[3], "Hello", 5]) as [NSObject]
346346
=> [3, "Hello", 5]
347347

348-
$.flatten([[[3], 4], 5]) as Int[]
348+
$.flatten([[[3], 4], 5])
349349
=> [3, 4, 5]
350350
```
351351

@@ -571,7 +571,7 @@ $.reduce([1, 2, 3], initial: 0) { (total, element) in
571571
Returns a sample item from the array
572572

573573
```swift
574-
let arr : Int[] = [2, 1, 2, 3, 4]
574+
let arr = [2, 1, 2, 3, 4]
575575
$.contains(arr, value: $.sample(arr))
576576
=> true
577577
```
@@ -593,6 +593,21 @@ $.sequence((0..20).by(5))
593593
$.sequence("abc")
594594
=> ["a", "b", "c"]
595595
```
596+
597+
### sum - `$.sum`
598+
599+
Returns the sum of elements in the array
600+
601+
```swift
602+
let arr = [1, 2, 3]
603+
$.sum(arr)
604+
=> 6
605+
606+
let floatingNums = [1.5, 2.5, 3.1]
607+
$.sum(floatingNums)
608+
=> 7.1
609+
```
610+
596611
### remove - `$.remove`
597612

598613
Removes an element from array.
@@ -1018,7 +1033,7 @@ let fun = $.bind({ (names: String...) -> String in
10181033
let people = $.join(names, separator: " from ")
10191034
return "Hello \(people)"
10201035
}, "Ankur", "Swift")
1021-
$.times(2, function: fun) as String[]
1036+
$.times(2, function: fun) as [String]
10221037
=> ["Hello Ankur from Swift", "Hello Ankur from Swift"]
10231038
```
10241039

0 commit comments

Comments
 (0)