Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
41 lines (32 loc) · 956 Bytes

File metadata and controls

41 lines (32 loc) · 956 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
public class JSArrayRef {
static let classObject = JSObjectRef.global.Array.function!
static func isArray(_ object: JSObjectRef) -> Bool {
classObject.isArray.function!(object).boolean!
}
let ref: JSObjectRef
public init?(_ ref: JSObjectRef) {
guard Self.isArray(ref) else { return nil }
self.ref = ref
}
}
extension JSArrayRef: Sequence {
public typealias Element = JSValue
public func makeIterator() -> Iterator {
Iterator(ref: ref)
}
public class Iterator: IteratorProtocol {
let ref: JSObjectRef
var index = 0
init(ref: JSObjectRef) {
self.ref = ref
}
public func next() -> Element? {
defer { index += 1 }
guard index < Int(ref.length.number!) else {
return nil
}
let value = ref.get(index)
return value.isNull ? nil : value
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.