Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bcongdon/emoji-ordering
📶 Utilities for ordering emojis according to the official Unicode emoji sort order
https://github.com/bcongdon/emoji-ordering
emoji unicode unicode-emoji
Last synced: about 2 months ago
JSON representation
📶 Utilities for ordering emojis according to the official Unicode emoji sort order
- Host: GitHub
- URL: https://github.com/bcongdon/emoji-ordering
- Owner: bcongdon
- License: mit
- Created: 2018-08-31T22:14:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-27T22:14:51.000Z (about 4 years ago)
- Last Synced: 2023-09-08T15:20:10.744Z (over 1 year ago)
- Topics: emoji, unicode, unicode-emoji
- Language: Go
- Size: 50.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 📶 emoji-ordering
> Utilities for ordering emojis according to the official Unicode emoji sort order[![Go Report Card](https://goreportcard.com/badge/github.com/bcongdon/emoji-ordering)](https://goreportcard.com/report/github.com/bcongdon/emoji-ordering)
[![GoDoc](https://godoc.org/github.com/bcongdon/emoji-ordering?status.svg)](https://godoc.org/github.com/bcongdon/emoji-ordering)## Installation
```
go get github.com/bcongdon/emoji-ordering
```## Usage
```go
package mainimport (
"github.com/bcongdon/emoji-ordering"
"fmt"
"sort"
)func main() {
emojis := []string{"😎", "💯", "🤔", "🤷♂️", "🤷"}
sort.Sort(ordering.EmojiSlice(emojis))
fmt.Println(emojis)
// [🤔, 😎, 💯, 🤷, 🤷♂️]fmt.Println(ordering.IsEmoji("🤷♂️"))
// truefmt.Println(ordering.IsEmoji("foo"))
// falsefmt.Println(ordering.IsEmoji("😀 ")) // with extra whitespace
// false// Constructing an Emoji Slice with Validation
emojis = []string{"😎", "💯", "foo"}
_, err := ordering.NewEmojiSlice(emojis)
fmt.Println(err)
// 'foo' is not an emoji
}
```