Skip to content

Commit

Permalink
Optimize getProviderData func
Browse files Browse the repository at this point in the history
  • Loading branch information
serpro69 committed Oct 28, 2024
1 parent 71d2bd4 commit 4af3dad
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,8 @@ class FakerService {
* has declared a provider that matches the [simpleClassName] parameter.
*/
private fun getProviderData(primary: YamlCategory, secondary: Category? = null): YamlCategoryData {
return secondary?.let {
load(primary, secondary)[primary]
} ?: dictionary[primary]
return dictionary[primary]
?: secondary?.let { load(primary, secondary)[primary] }
?: load(primary)[primary]
?: throw NoSuchElementException("Category $primary not found in $this")
}
Expand Down

0 comments on commit 4af3dad

Please sign in to comment.