Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
95141c92
Commit
95141c92
authored
Apr 09, 2019
by
James Laver
Committed by
Alexandre Delanoë
Apr 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Gargantext.Utils.Regex for low level regex work
parent
f17c98df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
Regex.js
src/Gargantext/Utils/Regex.js
+8
-0
Regex.purs
src/Gargantext/Utils/Regex.purs
+22
-0
No files found.
src/Gargantext/Utils/Regex.js
0 → 100644
View file @
95141c92
function
_cloneRegex
(
r
)
{
return
new
RegExp
(
r
.
source
,
r
.
flags
);
}
function
_getRegexLastIndex
(
r
)
{
return
r
.
lastIndex
;
}
function
_execRegex
(
r
,
s
)
{
return
r
.
exec
(
s
);
}
module
.
exports
=
{
_cloneRegex
:
_cloneRegex
,
_getRegexLastIndex
:
_getRegexLastIndex
,
_execRegex
:
_execRegex
};
src/Gargantext/Utils/Regex.purs
0 → 100644
View file @
95141c92
-- | Utilities for working with regexes in a naughty mutable manner
module Gargantext.Utils.Regex where
import Effect (Effect)
import Prelude ((<$>))
import Data.Maybe (Maybe(..))
import Effect.Uncurried (EffectFn2, runEffectFn2)
import Data.Function.Uncurried (Fn1, runFn1)
import Data.Nullable (Nullable, toMaybe)
import Data.String.Regex (Regex)
foreign import _cloneRegex :: Fn1 Regex Regex
foreign import _getRegexLastIndex :: Fn1 Regex Int
foreign import _execRegex :: EffectFn2 Regex String (Nullable String)
cloneRegex :: Regex -> Regex
cloneRegex = runFn1 _cloneRegex
getRegexLastIndex :: Regex -> Int
getRegexLastIndex = runFn1 _getRegexLastIndex
execRegex :: Regex -> String -> Effect (Maybe String)
execRegex r s = toMaybe <$> runEffectFn2 _execRegex r s
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment