Skip to content

Commit

Permalink
fix: only eip number return null
Browse files Browse the repository at this point in the history
  • Loading branch information
snaildarter committed Dec 10, 2024
1 parent 68aaaf9 commit 1849c5a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@ export class AppService {
try {
const result = {};
// eip match
const numbers = content.match(/\d+/g);
const texts = content.match(/\D+/g);
const numbers = content.match(/\d+/g) || [];
const texts = content.match(/\D+/g) || [];
const txt = texts.length ? texts.join(' ').trim() : '';
const eips = [];
let eipCondition = '';
console.log(numbers);
if (numbers && numbers.length) {
numbers.forEach((item) => {
if (Number(item) < 10000) {
Expand All @@ -103,7 +102,7 @@ export class AppService {
}
}

if (eips.length && !txt) {
if (eips?.length && !txt) {
const eipRecords = await this.connection.query(
`SELECT eip, title, type, category FROM "EIPs" WHERE ${eipCondition}`,
);
Expand Down

0 comments on commit 1849c5a

Please sign in to comment.