-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathisMetal.js
25 lines (22 loc) · 850 Bytes
/
isMetal.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const Pred = require('crocks/Pred');
const contramap = require('crocks/pointfree/contramap');
const R = require('ramda');
const removeWithInfluencesPart = R.compose(R.head, R.split(' with '));
const removeMetalCore = R.replace('metalcore', '');
const removePostMetal = R.replace(/post[ \-]metal/g, '');
const replaceNWOBHM = R.replace(/nwobhm/g, 'heavy metal');
const removeCruft = R.compose(
replaceNWOBHM,
removePostMetal,
removeMetalCore,
removeWithInfluencesPart,
R.toLower
);
const addRemoveCruft = contramap(removeCruft);
const isMetal = Pred(R.test(/metal/));
const getIsMetalSubGenrePredicate = subGenrePred => isMetal.concat(subGenrePred);
module.exports = {
removeWithInfluencesPart,
isMetal: addRemoveCruft(isMetal),
getIsMetalSubGenrePredicate: R.compose(addRemoveCruft, getIsMetalSubGenrePredicate)
};