Skip to content

Commit

Permalink
Remove Quick and Nimble; redesign arrayLookup and lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
iWECon committed Dec 30, 2022
1 parent 7e40ce5 commit 8147fa4
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 287 deletions.
43 changes: 0 additions & 43 deletions Package.resolved

This file was deleted.

7 changes: 1 addition & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@ let package = Package(
products: [
.library(name: "Lookup", targets: ["Lookup"]),
],
dependencies: [
.package(url: "https://github.com/Quick/Quick.git", from: "4.0.0"),
.package(url: "https://github.com/Quick/Nimble.git", from: "9.0.0")
],
targets: [
.target(name: "Lookup", dependencies: []),
.testTarget(
name: "LookupTests",
dependencies: [
"Lookup",
"Quick", "Nimble"
"Lookup"
])
],
swiftLanguageVersions: [.v5]
Expand Down
14 changes: 9 additions & 5 deletions Sources/Lookup/Lookup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -513,22 +513,26 @@ public extension Lookup {
array!
}

var arrayLookup: Lookup {
var arrayLookup: [Lookup] {
switch rawType {
case .array:
return Lookup(rawArray)
return rawArray.map { Lookup($0) }
case .string:
if let originString = object as? String,
let stringData = originString.data(using: .utf8),
let _array = try? JSONSerialization.jsonObject(with: stringData, options: []) as? [Any]
{
return Lookup(_array)
return _array.map { Lookup($0) }
}
return .null
return []
default:
return .null
return []
}
}

var lookup: Lookup {
Lookup(rawValue)
}
}


Expand Down
Loading

0 comments on commit 8147fa4

Please sign in to comment.