Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kabirnayeem99/kvininfo
Pure Kotlin Library for extracting info from VIN, validating VIN, and generating random/mocked VIN for testing.
https://github.com/kabirnayeem99/kvininfo
kotlin-android kotlin-multiplatform kotlin-multiplatform-library kotlin-multiplatform-mobile vin vin-decoder vin-utilities
Last synced: 7 days ago
JSON representation
Pure Kotlin Library for extracting info from VIN, validating VIN, and generating random/mocked VIN for testing.
- Host: GitHub
- URL: https://github.com/kabirnayeem99/kvininfo
- Owner: kabirnayeem99
- License: other
- Created: 2024-07-26T11:01:12.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-01T16:42:07.000Z (3 months ago)
- Last Synced: 2024-08-01T18:50:51.897Z (3 months ago)
- Topics: kotlin-android, kotlin-multiplatform, kotlin-multiplatform-library, kotlin-multiplatform-mobile, vin, vin-decoder, vin-utilities
- Language: Kotlin
- Homepage:
- Size: 241 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kVINInfo: A Kotlin Library for VIN Processing
License: [MIT License](LICENSE)
kVINInfo is a pure Kotlin library designed to simplify tasks related to Vehicle Identification
Numbers (VINs), including simple VIN Validation, extracting information from VIN, NHTSA Database
integration to get information like Vehicle type, Make and Model.Please, note that, This library draws inspiration from the Dart
library [vin-decoder-dart](https://github.com/adaptant-labs/vin-decoder-dart)
by [Adaptant Labs](https://github.com/adaptant-labs)
and [vindecoder.js](https://gist.github.com/kevboutin/3ac029e336fc7cafd20c05adda42ffa5)
by [Kevin Boutin](https://gist.github.com/kevboutin), so big shout out to them.**Warning**: For more complex VIN processing, professional-grade validation, or in-depth information
extraction, consider implementing custom logic or integrating with your company specific business
logic, or country-specific databases or APIs.## Install
This library can be installed with ease for both Kotlin Multiplatform projects and Android projects.
### Kotlin Multiplatform Projects
Add the following dependency to your commonMain source set:
```kotlin
val commonMain by getting {
dependencies {
implementation("io.github.kabirnayeem99:kvininfo:1.0.0")
}
}
```### Android Projects
Use the following dependency in your app module's build.gradle file:
#### Kotlin DSL (`build.gradle.kts`)
```kotlin
dependencies {
// all other dependencies
implementation("io.github.kabirnayeem99:kvininfo:1.0.0")
}
```#### Groovy DSL (`build.gradle`)
```groovy
dependencies {
// all other dependencies
implementation "io.github.kabirnayeem99:kvininfo:1.0.0"
}
```Note: Replace `1.0.0` with the latest version of the library.
## Usage
This library offers a simple API for working with VINs.
```kotlin
val vin = "WBA3A5G59DNP26082"
val vinInfo = VinInfo.fromNumber(vin)// Access VIN information
println(vinInfo.year) // 2013
println(vinInfo.region) // Europe
println(vinInfo.manufacturer) // BMW AG// Using the `use` scope for resource management
vinInfo.use {
println(it.wmi) // WMI part of the VIN
// ... other operations
}
```For more concise and expressive code, leverage Kotlin's extension functions:
```kotlin
"WBA3A5G59DNP26082".withVinInfo {
println(year) // 2013
println(region) // Europe
println(manufacturer) // BMW AG
println(getMakeFromNhtsa()) // BMW
println(getModelFromNhtsa()) // 328i
// ... other operations
}
```**Explanation**:
- The withVinInfo extension function provides a fluent-style API for working with VIN data.
- The lambda passed to withVinInfo receives the VinInfo instance as its receiver, allowing direct
access to its properties.## Contributions
We welcome contributions!
If you have any suggestions or improvements for kVINInfo, feel free to open an issue or make a PR.