Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
function stripchars(string, chars) {
|
||||
return string.replace(RegExp('['+chars+']','g'), '');
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
(() => {
|
||||
'use strict';
|
||||
|
||||
// stripChars :: String -> String -> String
|
||||
const stripChars = (strNeedles, strHayStack) =>
|
||||
strHayStack.replace(RegExp(`[${strNeedles}]`, 'g'), '');
|
||||
|
||||
// GENERIC FUNCTION
|
||||
|
||||
// curry :: ((a, b) -> c) -> a -> b -> c
|
||||
const curry = f => a => b => f(a, b);
|
||||
|
||||
// TEST FUNCTION
|
||||
|
||||
const noAEI = curry(stripChars)('aeiAEI');
|
||||
|
||||
// TEST
|
||||
return noAEI('She was a soul stripper. She took my heart!');
|
||||
|
||||
// 'Sh ws soul strppr. Sh took my hrt!'
|
||||
})();
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
(() => {
|
||||
'use strict';
|
||||
|
||||
// stripChars :: String -> String -> String
|
||||
const stripChars = (strNeedles, strHayStack) =>
|
||||
strHayStack.split('')
|
||||
.filter(x => !elem(x, strNeedles))
|
||||
.join('');
|
||||
|
||||
// GENERIC FUNCTIONS
|
||||
|
||||
// elem :: Eq a => a -> [a] -> Bool
|
||||
const elem = (x, xs) => xs.indexOf(x) !== -1;
|
||||
|
||||
// curry :: ((a, b) -> c) -> a -> b -> c
|
||||
const curry = f => a => b => f(a, b);
|
||||
|
||||
// TEST FUNCTION
|
||||
|
||||
const noAEI = curry(stripChars)('aeiAEI');
|
||||
|
||||
|
||||
// TEST
|
||||
return noAEI('She was a soul stripper. She took my heart!');
|
||||
|
||||
// 'Sh ws soul strppr. Sh took my hrt!'
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue