Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
baptistejamin authored Jul 15, 2024
2 parents 113fa26 + d35cb14 commit a3521c0
Show file tree
Hide file tree
Showing 13 changed files with 2,586 additions and 1,498 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
tags:
- "v*.*.*"

permissions:
id-token: write

name: Build and Release

jobs:
Expand All @@ -16,13 +19,13 @@ jobs:
- name: Install NodeJS
uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 20.x
registry-url: https://registry.npmjs.org

- name: Verify versions
run: node --version && npm --version && node -p process.versions.v8

- name: Release package
run: npm publish --ignore-scripts
run: npm publish --ignore-scripts --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [10.x, 12.x, 14.x, 16.x]
node-version: [16.x, 18.x, 20.x]
fail-fast: false

runs-on: ${{ matrix.os }}
Expand Down
55 changes: 1 addition & 54 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,61 +1,8 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/
package-lock.json

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# macOS
.DS_Store
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!/lib/**/*
4 changes: 2 additions & 2 deletions lib/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ class Email {

getVisibleText() {
return this.filterText((fragment) => {
return !fragment.isHidden;
return !fragment.isHidden();
});
}

getQuotedText() {
return this.filterText((fragment) => {
return fragment.isQuoted;
return fragment.isQuoted();
});
}

Expand Down
1 change: 0 additions & 1 deletion lib/emailreplyparser.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var EmailParser = require("./parser/emailparser");

class EmailReplyParser {

read(text) {
return new EmailParser().parse(text);
}
Expand Down
20 changes: 10 additions & 10 deletions lib/fragment.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
class Fragment {
constructor(content, isHidden, isSignature, isQuoted) {
this.content = content;
this.isHidden = isHidden;
this.isSignature = isSignature;
this.isQuoted = isQuoted;
this._content = content;
this._isHidden = isHidden;
this._isSignature = isSignature;
this._isQuoted = isQuoted;
}

isHidden() {
return this.isHidden;
return this._isHidden;
}

isSignature() {
return this.isSignature;
return this._isSignature;
}

isQuoted() {
return this.isQuoted;
return this._isQuoted;
}

getContent() {
return this.content;
return this._content;
}

isEmpty() {
return "" === this.getContent.replace(/\n/g, "");
return "" === this.getContent().replace(/\n/g, "");
}

toString() {
return this.getContent();
}
}

module.exports = Fragment;
module.exports = Fragment;
5 changes: 2 additions & 3 deletions lib/regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class RegexList {
/^\s*([a-z]{3,4}\.\s[\s\S]+\sskrev\s[\s\S]+:)$/m, // DATE skrev NAME <EMAIL>:
/^([0-9]{2}).([0-9]{2}).(20[0-9]{2})(.*)(([0-9]{2}).([0-9]{2}))(.*)\"( *)<(.*)>( *):$/m, // DD.MM.20YY HH:II NAME <EMAIL>
/^[0-9]{2}:[0-9]{2}(.*)[0-9]{4}(.*)\"( *)<(.*)>( *):$/, // HH:II, DATE, NAME <EMAIL>:
/^(.*)[0-9]{4}(.*)from(.*)<(.*)>:$/
/^(.*)[0-9]{4}(.*)from(.*)<(.*)>:$/,
/^-{1,10} ?(O|o)riginal (M|m)essage ?-{1,10}$/i,
]);

this.signatureRegex = this.buildRe2([
Expand All @@ -39,11 +40,9 @@ class RegexList {
/^\+{2,4}$/, // Separator
/^\={2,4}$/, // Separator
/^________________________________$/, // Separator
/^-{1,10}Original message-{1,10}$/,
/^Sent from (?:\s*.+)$/, // en
/^Get Outlook for (?:\s*.+).*/m, // en
/^Cheers,?!?$/mi, // en
/^Thank you,?!?$/mi, // en
/^Best wishes,?!?$/mi, // en
/^\w{0,20}\s?(\sand\s)?Regards,?!?!?$/mi, //en
/^Von (?:\s*.+) gesendet$/, // de
Expand Down
Loading

0 comments on commit a3521c0

Please sign in to comment.