Skip to content

Commit

Permalink
v0.0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPrimate committed May 12, 2022
1 parent 787e519 commit 7b3947c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.0.17

* Exclude legacy monsters option.

# 0.0.16

* Add missing config URL.
Expand Down
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ app.post(getMonsterProxyRoutes, cors(), express.json(), (req, res) => {

const homebrew = req.body.homebrew ? req.body.homebrew : false;
const homebrewOnly = req.body.homebrewOnly ? req.body.homebrewOnly : false;
const excludeLegacy = req.body.excludeLegacy ? req.body.excludeLegacy : false;

const exactNameMatch = req.body.exactMatch || false;
const performExactMatch = exactNameMatch && searchTerm && searchTerm !== "";
Expand All @@ -249,6 +250,14 @@ app.post(getMonsterProxyRoutes, cors(), express.json(), (req, res) => {

monsters
.extractMonsters(cacheId, searchTerm, homebrew, homebrewOnly, sources)
.then((data) => {
if (excludeLegacy) {
const filteredMonsters = data.filter((monster) => !monster.isHomebrew && !monster.isLegacy);
return filteredMonsters;
} else {
return data;
}
})
.then((data) => {
if (performExactMatch) {
const filteredMonsters = data.filter((monster) => monster.name.toLowerCase() === search.toLowerCase());
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ddb-proxy",
"version": "0.0.16",
"version": "0.0.17",
"main": "index.js",
"license": "MIT",
"scripts": {
Expand Down

0 comments on commit 7b3947c

Please sign in to comment.