https://github.com/mesqueeb/justsugar
🍰 JS-inspired Syntax Sugar on top of Swift to make working with Arrays/Strings/... easier
https://github.com/mesqueeb/justsugar
array-extensions javascript js js-syntax string-extensions swift syntax-sugar
Last synced: 4 months ago
JSON representation
🍰 JS-inspired Syntax Sugar on top of Swift to make working with Arrays/Strings/... easier
- Host: GitHub
- URL: https://github.com/mesqueeb/justsugar
- Owner: mesqueeb
- License: mit
- Created: 2024-05-25T05:14:04.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-11T00:27:28.000Z (5 months ago)
- Last Synced: 2026-01-11T08:23:17.258Z (5 months ago)
- Topics: array-extensions, javascript, js, js-syntax, string-extensions, swift, syntax-sugar
- Language: Swift
- Homepage: https://swiftpackageindex.com/mesqueeb/justsugar/documentation/justsugar/swift
- Size: 1.71 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# JustSugar 🍰
[](https://swiftpackageindex.com/mesqueeb/JustSugar)
[](https://swiftpackageindex.com/mesqueeb/JustSugar)
```
.package(url: "https://github.com/mesqueeb/JustSugar", from: "0.2.6")
```
JS-inspired Syntax Sugar on top of Swift to do two things:
1. Adds useful Array and String methods inspired by JS like `.at`, `.slice`, `.join`, etc.
2. Adds all the most common JS Array and String methods to Swift, with deprecation warnings where Swift has an alternative that is just as good.
- In this case we want to prefer the Swift method, so a deprecation warning is shown when reaching for the JS method. This is perfect for new Swift developers coming from JavaScript or TypeScript.
**Example of the .slice method**

**Example of JS methods with deprecation warning prompting to use the Swift equivalent**

## Full Documentation
See the SPM [JustSugar documentation](https://swiftpackageindex.com/mesqueeb/justsugar/documentation/justsugar/swift) for more info.
## TypeScript VS Swift Cheatsheet
See [mesqueeb.github.io/SwiftVsTypeScript](https://mesqueeb.github.io/SwiftVsTypeScript/) for a cheatsheet comparing Swift and TypeScript.