From aed06b7833864df9ef7b42a7fc167e7f46b90fac Mon Sep 17 00:00:00 2001 From: Marcel Voss Date: Sat, 1 May 2021 19:22:48 +0200 Subject: [PATCH] Add a license and readme file --- LICENSE | 21 +++++++++++++++++++++ README.md | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..893816e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Marcel Voss + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 60b8268..6289f37 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,38 @@ # Base62 +[![CI](https://github.com/marcelvoss/Base62/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/marcelvoss/Base62/actions/workflows/ci.yml) -A description of this package. +Base62 is a tiny package for [Base62](https://en.wikipedia.org/wiki/Base62) encoding/decoding values. It is tested, documented, easy-to-use and supports Apple Platforms, as well as Linux. + +## Installation +Base62 is distributed using the Swift Package Manager. To install it into a project, add it as a dependency within your `Package.swift` manifest: + +```swift +let package = Package( + ... + dependencies: [ + .package(url: "https://github.com/marcelvoss/Base62.git", from: "0.1.0") + ], + ... +) +``` + +Then import Base62 wherever you’d like to use it: + +```swift +import Base62 +``` + +## Usage +Using Base62 is incredibly easy, as it focusses on a single responsibility and does that nicely. + +Base62 ships with a single object that provides encoding and decoding functionality. + +```swift +let base62Encoded = Base62.encode(2021) +// 2021 == "wz" + +let base62Decoded = Base62.decode("GitHub") +// "GitHub" == 38750631667 +``` + +There are also extensions for `String` and `Int` available, if you prefer to use them rather than the `Base62` object directly.