Skip to content

Commit

Permalink
Expose Context from Sqids module
Browse files Browse the repository at this point in the history
Expose `Sqids.Context.Context` also from the main module as `Sqids.Context` for convenience: This way consumers using custom contexts only need to import the `Sqids.Context` module where the context is created. The modules for encoding or decoding sqids can just import `Sqids`.
  • Loading branch information
marc136 committed Jan 28, 2025
1 parent a44dd58 commit 88e9051
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

Expose `Sqids.Context.Context` also from the main module as `Sqids.Context` for convenience: This way consumers using custom contexts only need to import the `Sqids.Context` module where the context is created. The modules for encoding or decoding sqids can just import `Sqids`.

## 1.0.0

Port of [sqid-javascript](https://github.com/sqids/sqids-javascript/tree/94d69d1205849ca0a229346b435644b0cf38a574) to Elm
15 changes: 14 additions & 1 deletion src/Sqids.elm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Sqids exposing
( encode, encodeWith, EncodeError(..), encodeErrorToString, maxSafeInt
, decode, decodeWith, DecodeError(..), decodeErrorToString
, Context
)

{-|
Expand All @@ -15,12 +16,24 @@ module Sqids exposing
@docs decode, decodeWith, DecodeError, decodeErrorToString
# Context
@docs Context
-}

import Array exposing (Array)
import Set exposing (Set)
import Shuffle
import Sqids.Context exposing (Context)
import Sqids.Context


{-| The Context needed for the [encodeWith](#encodeWith) and [decodeWith](#decodeWith) functions.
Same as [Sqids.Context.Context](./Sqids-Context#Context). Exposed here for convenience.
-}
type alias Context =
Sqids.Context.Context


{-| Possible Error cases when trying to decode a string to integer numbers.
Expand Down

0 comments on commit 88e9051

Please sign in to comment.