-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.mjs
23 lines (19 loc) · 1.08 KB
/
node.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import what from '..';
// import what from 'jswhat';
// General usage
const match = what.is('[email protected]')[0];
console.log('Simply match an email only\n', match.matched);
// Search with a string
const sMatched = matches.map((m) => m.matched);
console.log('\nFind every possible match within\n', sMatched.join(', '));
// Filter the output by a name, short name, category or tag
const fOptions = { search: true, filter: ['Email'] };
const fMatched = filtered.map((m) => m.matched);
console.log('\nOnly match possible email addresses\n', fMatched.join(', '));
// Exclude a name, short name, category or tag
const eOptions = { search: true, exclude: ['URL', 'YouTube'] };
const excluded = what.is('[email protected] [email protected] https://youtube.com/pewdiepie', eOptions);
const eMatched = excluded.map((m) => m.matched);
console.log('\nExclude a property from the results, in this case URLs and YouTube related\n', eMatched.join(', '));