Housekeeping

This commit is contained in:
SukkaW
2023-07-24 23:02:22 +08:00
parent 79c761b0db
commit ce7db9693f
5 changed files with 55 additions and 71 deletions

View File

@@ -3,8 +3,6 @@ require('chai').should();
const Trie = require('./trie');
const assert = require('assert');
var SENTINEL = Trie.SENTINEL;
describe('Trie', () => {
it('should be possible to add items to a Trie.', () => {
const trie = new Trie();
@@ -57,7 +55,7 @@ describe('Trie', () => {
assert.strictEqual(trie.delete(''), false);
trie.delete('').should.eq(false);
trie.delete('hello').should.eq(false);
trie.delete('rat').should.eq(true);
trie.has('rat').should.eq(false);
trie.has('rate').should.eq(true);
@@ -182,4 +180,4 @@ describe('surge domainset dedupe', () => {
const trie = Trie.from(['skk.moe', 'sukkaskk.moe']);
trie.find('.skk.moe').should.eql([]);
});
})
});

View File

@@ -12,8 +12,8 @@ const withBanner = (title, description, date, content) => {
# ${title}
# Last Updated: ${date.toISOString()}
# Size: ${content.length}
${description.map(line => line ? `# ${line}` : '#').join('\n')}
########################################\n` + content.join('\n') + '\n################# END ###################\n';
${description.map(line => (line ? `# ${line}` : '#')).join('\n')}
########################################\n${content.join('\n')}\n################# END ###################\n`;
};
/**
* @param {string} title
@@ -24,14 +24,14 @@ ${description.map(line => line ? `# ${line}` : '#').join('\n')}
*/
const withBannerArray = (title, description, date, content) => {
return [
`########################################`,
'########################################',
`# ${title}`,
`# Last Updated: ${date.toISOString()}`,
`# Size: ${content.length}`,
...description.map(line => line ? `# ${line}` : '#'),
`########################################`,
...description.map(line => (line ? `# ${line}` : '#')),
'########################################',
...content,
`################# END ###################`,
'################# END ###################',
''
];
};