CutBox.app

Coverage Report

Created: 2024-03-12 03:40

.../Source/Extensions/Array+IndexSet.swift
Line
Count
Source
1
//
2
//  Array+IndexSet.swift
3
//  CutBox
4
//
5
//  Created by Jason Milkins on 7/4/18.
6
//  Copyright © 2018-2023 ocodo. All rights reserved.
7
//
8
9
import Foundation
10
11
extension Array {
12
13
1
    subscript(_ indexSet: IndexSet) -> [Element] {
14
1
        var result: [Element] = []
15
3
        indexSet.forEach {
16
3
            if $0 < self.count && $0 > -1 {
17
3
                result.append(self[$0])
18
3
            }
19
3
        }
20
1
        return result
21
1
    }
22
}