From 2b4c3f7ae3f86b0012802555e7576b579a5729b7 Mon Sep 17 00:00:00 2001 From: Nicholas Scheel Date: Sat, 30 Jan 2021 16:52:37 -0500 Subject: [PATCH 1/3] Update for changes to purescript-unicode --- src/Data/String/Extra.purs | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/Data/String/Extra.purs b/src/Data/String/Extra.purs index 39c875d..28ccb0f 100644 --- a/src/Data/String/Extra.purs +++ b/src/Data/String/Extra.purs @@ -11,10 +11,11 @@ module Data.String.Extra import Data.Array as Array import Data.Array.NonEmpty as NonEmptyArray -import Data.Char.Unicode as Unicode +import Data.String.Unicode as Unicode +import Data.CodePoint.Unicode as UCP import Data.Foldable (foldMap) import Data.String as String -import Data.String.CodeUnits as SCU +import Data.String.CodePoints as SCP import Data.String.Regex (Regex) import Data.String.Regex as Regex import Data.String.Regex.Unsafe (unsafeRegex) @@ -29,7 +30,7 @@ import Prelude ((>>>), (<>), ($), map) camelCase :: String -> String camelCase = words >>> Array.uncons >>> foldMap \{ head, tail } -> - toUnicodeLower head <> foldMap pascalCase tail + Unicode.toLower head <> foldMap pascalCase tail -- | Converts a `String` to kebab case -- | @@ -38,7 +39,7 @@ camelCase = -- | ``` kebabCase :: String -> String kebabCase = - words >>> map toUnicodeLower >>> String.joinWith "-" + words >>> map Unicode.toLower >>> String.joinWith "-" -- | Converts a `String` to Pascal case -- | @@ -56,7 +57,7 @@ pascalCase = -- | ``` snakeCase :: String -> String snakeCase = - words >>> map toUnicodeLower >>> String.joinWith "_" + words >>> map Unicode.toLower >>> String.joinWith "_" -- | Converts the first character in a `String` to upper case, lower-casing -- | the rest of the string. @@ -66,8 +67,8 @@ snakeCase = -- | ``` upperCaseFirst :: String -> String upperCaseFirst = - SCU.uncons >>> foldMap \{ head, tail } -> - SCU.singleton (Unicode.toUpper head) <> toUnicodeLower tail + SCP.uncons >>> foldMap \{ head, tail } -> + SCP.fromCodePointArray (UCP.toTitle head) <> Unicode.toLower tail -- | Separates a `String` into words based on Unicode separators, capital -- | letters, dashes, underscores, etc. @@ -118,14 +119,6 @@ hasUnicodeWords :: String -> Boolean hasUnicodeWords = Regex.test regexHasUnicodeWords -toUnicodeLower :: String -> String -toUnicodeLower = - SCU.toCharArray >>> map Unicode.toLower >>> SCU.fromCharArray - -toUnicodeUpper :: String -> String -toUnicodeUpper = - SCU.toCharArray >>> map Unicode.toUpper >>> SCU.fromCharArray - regexUnicodeWords :: Regex regexUnicodeWords = regexGlobal From 3430731f9658a2329a8f9f05eec37cc8adc33070 Mon Sep 17 00:00:00 2001 From: Nicholas Scheel Date: Sun, 31 Jan 2021 13:16:53 -0500 Subject: [PATCH 2/3] Update packages.dhall hash to invalidate CI cache --- packages.dhall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages.dhall b/packages.dhall index 9c3ee6f..dd0a199 100644 --- a/packages.dhall +++ b/packages.dhall @@ -1,4 +1,4 @@ let upstream = - https://raw.githubusercontent.com/purescript/package-sets/prepare-0.14/src/packages.dhall + https://raw.githubusercontent.com/purescript/package-sets/prepare-0.14/src/packages.dhall sha256:baefc2d9387175879c9576620d245e708b11cda41569aac9631b351cb0616d06 in upstream From ec7cb1d685c3f767555b6db78c9d0cd5bc9e3868 Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Sun, 31 Jan 2021 11:58:40 -0800 Subject: [PATCH 3/3] Remove hash again --- packages.dhall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages.dhall b/packages.dhall index dd0a199..9c3ee6f 100644 --- a/packages.dhall +++ b/packages.dhall @@ -1,4 +1,4 @@ let upstream = - https://raw.githubusercontent.com/purescript/package-sets/prepare-0.14/src/packages.dhall sha256:baefc2d9387175879c9576620d245e708b11cda41569aac9631b351cb0616d06 + https://raw.githubusercontent.com/purescript/package-sets/prepare-0.14/src/packages.dhall in upstream