How to use the match function from ramda
Find comprehensive JavaScript ramda.match code examples handpicked from public code repositorys.
127 128 129 130 131 132 133 134 135 136
return R.pipe( () => this.shell("dumpsys activity activities").toString(), R.split("\n"), R.map(R.pipe( R.trim, R.match(/Run #\d+: ActivityRecord{\w+ \w+ ([\w\.\/]+)/), it => it ? it[1] : null, )), R.filter(R.identity), )();
1
1
0
2858 2859 2860 2861 2862 2863 2864 2865 2866 2867
* @param {String} str The string to match against * @return {Array} The list of matches or empty array. * @see R.test * @example * * R.match(/([a-z]a)/g, 'bananas'); //=> ['ba', 'na', 'na'] * R.match(/a/, 'b'); //=> [] * R.match(/a/, null); //=> TypeError: null does not have a method named "match" */ var match = _curry2(function match(rx, str) {
0
0
0
+ 71 other calls in file
GitHub: jcla1/AdventOfCode
3 4 5 6 7 8 9 10 11 12 13 14
const input = fs.readFileSync('inputs/day02.input', 'utf8').trim(); const pwPolicies = R.compose( R.map(R.o( R.slice(1, 5), R.match(/(\d+)-(\d+) ([a-z]): ([a-z]+)/))), R.split('\n'))(input); const isValidPart1 = ([low, high, lett, pw]) => { // example p = ['1', '3', 'a', 'abcde']
0
0
0
+ 2 other calls in file
GitHub: jcla1/AdventOfCode
6 7 8 9 10 11 12 13 14 15 16 17
const targetArea = R.compose( ([x1, x2, y1, y2]) => [[x1, y1], [x2, y2]], R.map(parseInt), R.slice(1, 5), R.match(/target area: x=(-?\d+)\.\.(-?\d+), y=(-?\d+)\.\.(-?\d+)/))(input); const isInArea = ([[x1, y1], [x2, y2]], [x, y]) => x1 <= x && x <= x2 && y1 <= y && y <= y2; const isRightOrBelow = ([[, y1], [x2]], [x, y]) => x2 < x || y < y1;
0
0
0
GitHub: jcla1/AdventOfCode
27 28 29 30 31 32 33 34 35 36
// remove the trailing ']' rest = R.drop(1, rest); return [[left, right], rest]; } else { // or the snail number is just a plain old integer const [, num, rest] = R.match(/^(\d+)(.*)/, s); return [parseInt(num), rest]; } };
0
0
0
+ 3 other calls in file
GitHub: jcla1/AdventOfCode
9 10 11 12 13 14 15 16 17 18 19 20
const lines = R.compose( R.map(R.compose( R.map(parseInt), R.slice(1, 5), R.match(/(\d+),(\d+) -> (\d+),(\d+)/))), R.split('\n'))(input); const isGridLine = (l) => l[0] === l[2] || l[1] === l[3]; const addBoards = R.mergeDeepWith(R.add);
0
0
0
GitHub: stuf/lenses_v0
5 6 7 8 9 10 11 12 13 14
// Just force rest to be lowercase lol const capitalize = str => [str.charAt(0).toUpperCase(), str.slice(1).toLowerCase()].join(''); const tokenizeCamelCase = R.pipe( R.match(/(^[a-z]+|[A-Z][a-z]+)/g), R.map(R.toLower), ); const tokenizeKebabCase = R.pipe(R.split('-'), R.map(R.toLower));
0
0
1
ramda.clone is the most popular function in ramda (30311 examples)