Skip to content

Commit 61a97d1

Browse files
Initial Commit
0 parents  commit 61a97d1

28 files changed

+2788
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.podspec linguist-vendored

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Xcode
2+
3+
xcuserdata/
4+
5+
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
6+
*.xcscmblueprint
7+
*.xccheckout
8+
9+
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
10+
build/
11+
DerivedData/
12+
*.moved-aside
13+
*.pbxuser
14+
!default.pbxuser
15+
*.mode1v3
16+
!default.mode1v3
17+
*.mode2v3
18+
!default.mode2v3
19+
*.perspectivev3
20+
!default.perspectivev3
21+
22+
# macOS
23+
.DS_Store

CBHMapReduceKit.podspec

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Pod::Spec.new do |spec|
2+
3+
spec.name = 'CBHMapReduceKit'
4+
spec.version = '1.0.0'
5+
spec.module_name = 'CBHMapReduceKit'
6+
7+
spec.summary = 'Adds map, filter, and reduce methods to common collection types.'
8+
spec.homepage = 'https://github.com/chris-huxtable/CBHMapReduceKit'
9+
10+
spec.license = { :type => 'ISC', :file => 'LICENSE' }
11+
12+
spec.author = { 'Chris Huxtable' => '[email protected]' }
13+
spec.social_media_url = 'https://twitter.com/@Chris_Huxtable'
14+
15+
spec.osx.deployment_target = '10.11'
16+
17+
spec.source = { :git => 'https://github.com/chris-huxtable/CBHMapReduceKit.git', :tag => "v#{spec.version}" }
18+
19+
spec.requires_arc = true
20+
21+
spec.public_header_files = 'CBHMapReduceKit/*.h'
22+
#spec.private_header_files = 'CBHMapReduceKit/_*.h'
23+
spec.source_files = 'CBHMapReduceKit/*.{h,m}'
24+
25+
end

CBHMapReduceKit.xcodeproj/project.pbxproj

Lines changed: 598 additions & 0 deletions
Large diffs are not rendered by default.

CBHMapReduceKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1120"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "83E09E302396C7A9003B95B9"
18+
BuildableName = "CBHMapReduceKit.framework"
19+
BlueprintName = "CBHMapReduceKit"
20+
ReferencedContainer = "container:CBHMapReduceKit.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES"
30+
codeCoverageEnabled = "YES">
31+
<TestPlans>
32+
<TestPlanReference
33+
reference = "container:CBHMapReduceKitTests/Correctness.xctestplan"
34+
default = "YES">
35+
</TestPlanReference>
36+
<TestPlanReference
37+
reference = "container:CBHMapReduceKitTests/Performance.xctestplan">
38+
</TestPlanReference>
39+
</TestPlans>
40+
<Testables>
41+
<TestableReference
42+
skipped = "NO">
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "83E09E392396C7A9003B95B9"
46+
BuildableName = "CBHMapReduceKitTests.xctest"
47+
BlueprintName = "CBHMapReduceKitTests"
48+
ReferencedContainer = "container:CBHMapReduceKit.xcodeproj">
49+
</BuildableReference>
50+
</TestableReference>
51+
</Testables>
52+
</TestAction>
53+
<LaunchAction
54+
buildConfiguration = "Debug"
55+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57+
launchStyle = "0"
58+
useCustomWorkingDirectory = "NO"
59+
ignoresPersistentStateOnLaunch = "NO"
60+
debugDocumentVersioning = "YES"
61+
debugServiceExtension = "internal"
62+
allowLocationSimulation = "YES">
63+
</LaunchAction>
64+
<ProfileAction
65+
buildConfiguration = "Release"
66+
shouldUseLaunchSchemeArgsEnv = "YES"
67+
savedToolIdentifier = ""
68+
useCustomWorkingDirectory = "NO"
69+
debugDocumentVersioning = "YES">
70+
<MacroExpansion>
71+
<BuildableReference
72+
BuildableIdentifier = "primary"
73+
BlueprintIdentifier = "83E09E302396C7A9003B95B9"
74+
BuildableName = "CBHMapReduceKit.framework"
75+
BlueprintName = "CBHMapReduceKit"
76+
ReferencedContainer = "container:CBHMapReduceKit.xcodeproj">
77+
</BuildableReference>
78+
</MacroExpansion>
79+
</ProfileAction>
80+
<AnalyzeAction
81+
buildConfiguration = "Debug">
82+
</AnalyzeAction>
83+
<ArchiveAction
84+
buildConfiguration = "Release"
85+
revealArchiveInOrganizer = "YES">
86+
</ArchiveAction>
87+
</Scheme>

CBHMapReduceKit/CBHMapReduceKit.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// CBHMapReduceKit.h
2+
// CBHMapReduceKit
3+
//
4+
// Created by Christian Huxtable <[email protected]>, November 2019.
5+
// Copyright (c) 2019 Christian Huxtable. All rights reserved.
6+
//
7+
// Permission to use, copy, modify, and/or distribute this software for any
8+
// purpose with or without fee is hereby granted, provided that the above
9+
// copyright notice and this permission notice appear in all copies.
10+
//
11+
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12+
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13+
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14+
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15+
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16+
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17+
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18+
19+
@import Foundation.NSObjCRuntime;
20+
21+
22+
FOUNDATION_EXPORT double CBHMapReduceKitVersionNumber;
23+
FOUNDATION_EXPORT const unsigned char CBHMapReduceKitVersionString[];
24+
25+
26+
#import <CBHMapReduceKit/NSArray+CBHMapReduceKit.h>
27+
28+
#import <CBHMapReduceKit/NSSet+CBHMapReduceKit.h>
29+
#import <CBHMapReduceKit/NSOrderedSet+CBHMapReduceKit.h>
30+
31+
#import <CBHMapReduceKit/NSDictionary+CBHMapReduceKit.h>
32+
33+
#import <CBHMapReduceKit/NSEnumerator+CBHMapReduceKit.h>

CBHMapReduceKit/Info.plist

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>$(MARKETING_VERSION)</string>
19+
<key>CFBundleVersion</key>
20+
<string>$(CURRENT_PROJECT_VERSION)</string>
21+
<key>NSHumanReadableCopyright</key>
22+
<string>Copyright © 2019 Christian Huxtable. All rights reserved.</string>
23+
</dict>
24+
</plist>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// NSArray+CBHMapReduceKit.h
2+
// CBHMapReduceKit
3+
//
4+
// Created by Christian Huxtable <[email protected]>, November 2019.
5+
// Copyright (c) 2019 Christian Huxtable. All rights reserved.
6+
//
7+
// Permission to use, copy, modify, and/or distribute this software for any
8+
// purpose with or without fee is hereby granted, provided that the above
9+
// copyright notice and this permission notice appear in all copies.
10+
//
11+
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12+
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13+
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14+
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15+
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16+
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17+
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18+
19+
@import Foundation;
20+
21+
22+
NS_ASSUME_NONNULL_BEGIN
23+
24+
@interface NSArray<ObjectType> (CBHMapReduceKit)
25+
26+
#pragma mark - Mapping
27+
28+
- (NSArray<id> *)arrayByMapping:(nullable id (^)(ObjectType object))block;
29+
- (NSMutableArray<id> *)mutableArrayByMapping:(nullable id (^)(ObjectType object))block;
30+
31+
- (NSSet<id> *)setByMapping:(nullable id (^)(ObjectType object))block;
32+
- (NSMutableSet<id> *)mutableSetByMapping:(nullable id (^)(ObjectType object))block;
33+
34+
- (NSOrderedSet<id> *)orderedSetByMapping:(nullable id (^)(ObjectType object))block;
35+
- (NSMutableOrderedSet<id> *)mutableOrderedSetByMapping:(nullable id (^)(ObjectType object))block;
36+
37+
38+
#pragma mark - Filtering
39+
40+
- (NSArray<ObjectType> *)arrayByFiltering:(BOOL (^)(ObjectType object))block;
41+
- (NSMutableArray<ObjectType> *)mutableArrayByFiltering:(BOOL (^)(ObjectType object))block;
42+
43+
44+
#pragma mark - Reducing
45+
46+
- (nullable id)initial:(nullable id)initial reduce:(nullable id (^)(id __nullable memo, ObjectType object))reduce;
47+
48+
49+
#pragma mark - Collection Conversion
50+
51+
- (NSSet<ObjectType> *)toSet;
52+
- (NSMutableSet<ObjectType> *)toMutableSet;
53+
54+
- (NSOrderedSet<ObjectType> *)toOrderedSet;
55+
- (NSMutableOrderedSet<ObjectType> *)toMutableOrderedSet;
56+
57+
@end
58+
59+
60+
@interface NSMutableArray<ObjectType> (CBHMapReduceKit)
61+
62+
#pragma mark - Filtering
63+
64+
- (NSMutableArray<id> *)filter:(BOOL (^)(ObjectType object))block;
65+
66+
@end
67+
68+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)