Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: purescript/purescript-strings
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.4.0
Choose a base ref
...
head repository: purescript/purescript-strings
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 4,116 additions and 1,470 deletions.
  1. +2 −4 .eslintrc.json
  2. +12 −0 .github/PULL_REQUEST_TEMPLATE.md
  3. +35 −0 .github/workflows/ci.yml
  4. +2 −1 .gitignore
  5. +0 −23 .travis.yml
  6. +251 −0 CHANGELOG.md
  7. +22 −16 LICENSE
  8. +3 −2 README.md
  9. +57 −0 bench/Main.purs
  10. +21 −12 bower.json
  11. +9 −5 package.json
  12. +0 −17 src/Data/Char.js
  13. +9 −12 src/Data/Char.purs
  14. +7 −7 src/Data/Char/Gen.purs
  15. +0 −180 src/Data/String.js
  16. +6 −429 src/Data/String.purs
  17. 0 src/Data/String/{CaseInsensitiveString.purs → CaseInsensitive.purs}
  18. +7 −8 src/Data/String/CodePoints.js
  19. +242 −254 src/Data/String/CodePoints.purs
  20. +116 −0 src/Data/String/CodeUnits.js
  21. +332 −0 src/Data/String/CodeUnits.purs
  22. +52 −0 src/Data/String/Common.js
  23. +96 −0 src/Data/String/Common.purs
  24. +14 −2 src/Data/String/Gen.purs
  25. +9 −0 src/Data/String/NonEmpty.purs
  26. +22 −0 src/Data/String/NonEmpty/CaseInsensitive.purs
  27. +138 −0 src/Data/String/NonEmpty/CodePoints.purs
  28. +304 −0 src/Data/String/NonEmpty/CodeUnits.purs
  29. +232 −0 src/Data/String/NonEmpty/Internal.purs
  30. +33 −0 src/Data/String/Pattern.purs
  31. +26 −18 src/Data/String/Regex.js
  32. +29 −15 src/Data/String/Regex.purs
  33. +25 −10 src/Data/String/Regex/Flags.purs
  34. +14 −14 src/Data/String/Regex/Unsafe.purs
  35. +2 −11 src/Data/String/Unsafe.js
  36. +0 −6 src/Data/String/Unsafe.purs
  37. +0 −28 test/Test/Data/Char.purs
  38. +106 −167 test/Test/Data/String.purs
  39. +14 −10 test/Test/Data/String/CaseInsensitive.purs
  40. +625 −185 test/Test/Data/String/CodePoints.purs
  41. +516 −0 test/Test/Data/String/CodeUnits.purs
  42. +220 −0 test/Test/Data/String/NonEmpty.purs
  43. +450 −0 test/Test/Data/String/NonEmpty/CodeUnits.purs
  44. +20 −11 test/Test/Data/String/Regex.purs
  45. +18 −15 test/Test/Data/String/Unsafe.purs
  46. +18 −8 test/Test/Main.purs
6 changes: 2 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{
"parserOptions": {
"ecmaVersion": 5
"ecmaVersion": 6,
"sourceType": "module"
},
"extends": "eslint:recommended",
"env": {
"commonjs": true
},
"rules": {
"strict": [2, "global"],
"block-scoped-var": 2,
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
**Description of the change**

Clearly and concisely describe the purpose of the pull request. If this PR relates to an existing issue or change proposal, please link to it. Include any other background context that would help reviewers understand the motivation for this PR.

---

**Checklist:**

- [ ] Added the change to the changelog's "Unreleased" section with a reference to this PR (e.g. "- Made a change (#0000)")
- [ ] Linked any existing issues or proposals that this pull request should close
- [ ] Updated or added relevant documentation
- [ ] Added a test for the contribution (if applicable)
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: purescript-contrib/setup-purescript@main
with:
purescript: "unstable"

- uses: actions/setup-node@v2
with:
node-version: "14.x"

- name: Install dependencies
run: |
npm install -g bower
npm install
bower install --production
- name: Build source
run: npm run-script build

- name: Run tests
run: |
bower install
npm run-script test --if-present
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/.*
!/.gitignore
!/.eslintrc.json
!/.travis.yml
!/.github/
/bower_components/
/node_modules/
/output/
package-lock.json
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

251 changes: 251 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
# Changelog

Notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

Breaking changes:

New features:

Bugfixes:

Other improvements:
- Redefine `Data.String.NonEmpty.CodeUnits.fromFoldable1` in terms of `singleton` (#168 by @postsolar)

## [v6.0.1](https://github.com/purescript/purescript-strings/releases/tag/v6.0.1) - 2022-08-16

Bugfixes:
- Fix `Char`'s `toEnum` implementation (#163 by @JordanMartinez)

## [v6.0.0](https://github.com/purescript/purescript-strings/releases/tag/v6.0.0) - 2022-04-27

Breaking changes:
- Migrate FFI to ES modules (#158 by @kl0tl and @JordanMartinez)
- Replaced polymorphic proxies with monomorphic `Proxy` (#158 by @JordanMartinez)
- In `slice`, drop bounds checking and `Maybe` return type (#145 by Quelklef)

New features:

Bugfixes:

Other improvements:
- Surround code with backticks in documentation (#148)
- Make `RegexFlags` a `newtype` and a `Newtype` instance for it(#159 by @mhmdanas)

## [v5.0.0](https://github.com/purescript/purescript-strings/releases/tag/v5.0.0) - 2021-02-26

Breaking changes:
- Added support for PureScript 0.14 and dropped support for all previous versions (#129)
- Updated `replace'` to reflect the existence of optional capturing groups (#126)

New features:
- Replaced `unsafeCoerce` with `coerce` where appropriate (#130)
- Replaced monomorphic proxies with `Type.Proxy.Proxy` and polymorphic variables (#134)
- Added a dotAll regexp flag (#133)

Bugfixes:
- Removed the bounds check from the foreign implementation of `lastIndexOf'` (#137)

Other improvements:
- Fix line endings to match overall project style (#132)
- Removed references to `codePointToInt`, which no longer exists (#135)
- Migrated CI to GitHub Actions and updated installation instructions to use Spago (#136)
- Added a changelog and pull request template (#140, #141)

## [v4.0.2](https://github.com/purescript/purescript-strings/releases/tag/v4.0.2) - 2020-05-13

- Improved performance for `stripPrefix` / `stripSuffix` (#123, @michaelficarra)

## [v4.0.1](https://github.com/purescript/purescript-strings/releases/tag/v4.0.1) - 2018-11-11

- Fixed out of bounds access in `unsafeCodePointAt0Fallback` (@zyla)
- Fixed `slice` when end index equals string length (@abaco)

## [v4.0.0](https://github.com/purescript/purescript-strings/releases/tag/v4.0.0) - 2018-05-23

- Updated for PureScript 0.12
- `splitAt` now always returns a value (#78, @MonoidMusician)
- Added `slice` (@themattchan)
- Added more `String` `Gen`s to correspond with `Char` `Gen`s (@matthewleon)
- `Regex` `match` now returns `NonEmptyArray`
- All string functions now operate on code points now rather than code units. The old functions are available via the `.CodeUnits` modules
- `fromCharCode` can return `Nothing` now if given a value out of range

## [v3.5.0](https://github.com/purescript/purescript-strings/releases/tag/v3.5.0) - 2018-02-12

- Added `Data.String.NonEmpty`

## [v3.4.0](https://github.com/purescript/purescript-strings/releases/tag/v3.4.0) - 2017-12-28

- Add `Show CodePoint` instance (@csicar)
- Add `codePointFromChar` (@csicar)
- Expanded docs for most functions in `Data.String` and `Data.String.CodePoints` (@csicar)

## [v3.3.2](https://github.com/purescript/purescript-strings/releases/tag/v3.3.2) - 2017-11-19

- Performance improvement in `Data.String.Regex.match` (@fehrenbach)

## [v3.3.1](https://github.com/purescript/purescript-strings/releases/tag/v3.3.1) - 2017-08-06

- Fix some `Show` instances (@Rufflewind)

## [v3.3.0](https://github.com/purescript/purescript-strings/releases/tag/v3.3.0) - 2017-07-10

- Add a new module `Data.String.CodePoints`, which treats strings as sequences of Unicode code points rather than sequences of UTF-16 code units. In the future we may swap this module with `Data.String`. (@michaelficarra)
- Fix a typo in the documentation (@ijks)

## [v3.2.1](https://github.com/purescript/purescript-strings/releases/tag/v3.2.1) - 2017-06-06

- Ensure `genString` behaves the same regardless of the `MonadGen` implementation of `chooseInt` when `max < min`

## [v3.2.0](https://github.com/purescript/purescript-strings/releases/tag/v3.2.0) - 2017-06-05

- Generated strings from `genString` now vary in length
- Added additional `Char` generators

## [v3.1.0](https://github.com/purescript/purescript-strings/releases/tag/v3.1.0) - 2017-04-28

- Added some generator functions - introduced `Data.String.Gen` and `Data.Char.Gen`

## [v3.0.0](https://github.com/purescript/purescript-strings/releases/tag/v3.0.0) - 2017-03-26

- Updated for PureScript 0.11

## [v2.1.0](https://github.com/purescript/purescript-strings/releases/tag/v2.1.0) - 2016-12-25

- Added `unsafeRegex` (@rightfold)

## [v2.0.2](https://github.com/purescript/purescript-strings/releases/tag/v2.0.2) - 2016-10-26

- Documentation fix for `split` #70 (@leighman)

## [v2.0.1](https://github.com/purescript/purescript-strings/releases/tag/v2.0.1) - 2016-10-08

- Improved `null` check implementation (@Risto-Stevcev)

## [v2.0.0](https://github.com/purescript/purescript-strings/releases/tag/v2.0.0) - 2016-10-08

- Updated dependencies
- `Pattern` and `Replacement` newtypes are now used to distinguish between arguments when a function accepts multiple strings
- `RegexFlags` have been reworked as a monoid (@Risto-Stevcev)

## [v1.1.0](https://github.com/purescript/purescript-strings/releases/tag/v1.1.0) - 2016-07-20

- Restored export of the `count` function.

## [v1.0.0](https://github.com/purescript/purescript-strings/releases/tag/v1.0.0) - 2016-06-01

This release is intended for the PureScript 0.9.1 compiler and newer.

**Note**: The v1.0.0 tag is not meant to indicate the library is “finished”, the core libraries are all being bumped to this for the 0.9 compiler release so as to use semver more correctly.

## [v0.7.1](https://github.com/purescript/purescript-strings/releases/tag/v0.7.1) - 2015-11-20

- Removed unused imports (@tfausak)

## [v0.7.0](https://github.com/purescript/purescript-strings/releases/tag/v0.7.0) - 2015-08-13

- Removed orphan (and incorrect) `Bounded Char` instance

## [v0.6.0](https://github.com/purescript/purescript-strings/releases/tag/v0.6.0) - 2015-08-02

- Added `toLower` and `toUpper` to `Data.Char`
- `search` in `Data.String.Regex` now returns `Maybe` result rather than using -1 for failure
- Added test suite

All updates by @LiamGoodacre

## [v0.5.5](https://github.com/purescript/purescript-strings/releases/tag/v0.5.5) - 2015-07-28

Add `stripSuffix`.

## [v0.5.4](https://github.com/purescript/purescript-strings/releases/tag/v0.5.4) - 2015-07-18

- Removed duplicate `Show` instance for `Char` (@anttih)

## [v0.5.3](https://github.com/purescript/purescript-strings/releases/tag/v0.5.3) - 2015-07-10

Add `stripPrefix` (@hdgarrood)

## [v0.5.2](https://github.com/purescript/purescript-strings/releases/tag/v0.5.2) - 2015-07-07

- Fixed `char` and `charCodeAt` in `Data.String.Unsafe` #36 (@stkb)

## [v0.5.1](https://github.com/purescript/purescript-strings/releases/tag/v0.5.1) - 2015-07-06

- Fixed missing `count` implementation (@qxjit)

## [v0.5.0](https://github.com/purescript/purescript-strings/releases/tag/v0.5.0) - 2015-06-30

This release works with versions 0.7.\* of the PureScript compiler. It will not work with older versions. If you are using an older version, you should require an older, compatible version of this library.

- Fixed various FFI exports (@sharkdp)
- Fixed `localeCompare`

## [v0.4.5](https://github.com/purescript/purescript-strings/releases/tag/v0.4.5) - 2015-03-23

- Added `char` to `Data.String.Unsafe` (@brainrape)
- Functions in `Data.String.Unsafe` now throw errors immediately when given unacceptable inputs (@brainrape)

## [v0.4.4](https://github.com/purescript/purescript-strings/releases/tag/v0.4.4) - 2015-03-22

- Updated docs

## [v0.4.3](https://github.com/purescript/purescript-strings/releases/tag/v0.4.3) - 2015-02-18

- Added `noFlags` record for default regex flags (@fresheyeball)

## [v0.4.2](https://github.com/purescript/purescript-strings/releases/tag/v0.4.2) - 2014-11-28

- Added `null`, `singleton`, `uncons`, `takeWhile`, and `dropWhile` to `Data.String` (@NightRa)

## [v0.4.1](https://github.com/purescript/purescript-strings/releases/tag/v0.4.1) - 2014-11-06

- Use ternary operator in JavaScript output (@davidchambers)

## [v0.4.0](https://github.com/purescript/purescript-strings/releases/tag/v0.4.0) - 2014-10-27

- Made `charCodeAt` safe, added unsafe versions of `charAt`, `charCodeAt` (@garyb)

## [v0.3.3](https://github.com/purescript/purescript-strings/releases/tag/v0.3.3) - 2014-10-24

- Added `split` to `Data.String.Regex` (@davidchambers)

## [v0.3.2](https://github.com/purescript/purescript-strings/releases/tag/v0.3.2) - 2014-10-16

- Added essential instances for `Char` (@jdegoes)

## [v0.3.1](https://github.com/purescript/purescript-strings/releases/tag/v0.3.1) - 2014-10-15

- Fixed typo in `fromCharArray` FFI implementation (@jdegoes)

## [v0.3.0](https://github.com/purescript/purescript-strings/releases/tag/v0.3.0) - 2014-10-14

- Introduced `Char` newtype and corresponding functions (@jdegoes)
- Made `charAt` safe - breaking change (@jdegoes)

## [v0.2.1](https://github.com/purescript/purescript-strings/releases/tag/v0.2.1) - 2014-07-21

- Fix typo in FFI definition for `flags` (@garyb)

## [v0.2.0](https://github.com/purescript/purescript-strings/releases/tag/v0.2.0) - 2014-07-20

- `Show` instance for `Regex` (@michaelficarra)
- `Regex` now has `RegexFlags` rather than a string for options (@michaelficarra)

## [v0.1.3](https://github.com/purescript/purescript-strings/releases/tag/v0.1.3) - 2014-05-04

- Renamed `Data.String.Regex.replaceR` to `replace`, added `replace'` which uses a function to construct replacements for matches.

## [v0.1.2](https://github.com/purescript/purescript-strings/releases/tag/v0.1.2) - 2014-04-30

- Added `indexOf'` and `lastIndexOf'` (paf31)

## [v0.1.1](https://github.com/purescript/purescript-strings/releases/tag/v0.1.1) - 2014-04-27

- Swapped `joinWith` arguments for better style

## [v0.1.0](https://github.com/purescript/purescript-strings/releases/tag/v0.1.0) - 2014-04-25

- Initial release
38 changes: 22 additions & 16 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
The MIT License (MIT)
Copyright 2018 PureScript

Copyright (c) 2014 PureScript
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

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:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

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.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading