-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3977cf2
commit 56e2a73
Showing
10 changed files
with
4,546 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: ["@tammergard/eslint-config-base"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: npm | ||
directory: / | ||
schedule: | ||
interval: weekly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Review | ||
run: yarn review | ||
|
||
release: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Review | ||
run: yarn review | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Run semantic-release | ||
run: yarn semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
...require("@tammergard/prettier-config"), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: "@tammergard/semantic-release-config-npm", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
export function countCharacters(text: string) { | ||
const characters = text.length; | ||
return characters; | ||
const characters = text.length | ||
return characters | ||
} | ||
|
||
export function countWords(text: string) { | ||
const words = text.split(/ |\t|\n|\r/).filter((word) => word !== "").length; | ||
return words; | ||
const words = text.split(/ |\t|\n|\r/).filter((word) => word !== "").length | ||
return words | ||
} | ||
|
||
export function countSequenceOccurances(text: string, sequence: string) { | ||
const occurances = | ||
text.toLowerCase().split(sequence.toLowerCase()).length - 1; | ||
return occurances; | ||
const occurances = text.toLowerCase().split(sequence.toLowerCase()).length - 1 | ||
return occurances | ||
} | ||
|
||
const WORDS_PER_MINUTE = 200; | ||
const WORDS_PER_MINUTE = 200 | ||
|
||
export function getReadingTime(text: string) { | ||
const words = countWords(text); | ||
const minutes = words / WORDS_PER_MINUTE; | ||
const milliseconds = minutes * 60 * 1000; | ||
const words = countWords(text) | ||
const minutes = words / WORDS_PER_MINUTE | ||
const milliseconds = minutes * 60 * 1000 | ||
return { | ||
words, | ||
minutes, | ||
milliseconds, | ||
}; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,24 +2,34 @@ | |
"name": "text-analyzer", | ||
"version": "1.5.0", | ||
"description": "Utility functions providing possibilities to analyze text.", | ||
"scripts": { | ||
"build": "tsc", | ||
"lint": "eslint .", | ||
"prettier": "prettier --write .", | ||
"review": "yarn install --frozen-lockfile && yarn lint && yarn prettier" | ||
}, | ||
"devDependencies": { | ||
"@tammergard/eslint-config-base": "2.2.0", | ||
"@tammergard/prettier-config": "1.4.0", | ||
"@tammergard/semantic-release-config-npm": "1.0.0", | ||
"eslint": "8.4.1", | ||
"eslint-config-airbnb-base": "15.0.0", | ||
"eslint-config-prettier": "8.3.0", | ||
"eslint-plugin-import": "2.25.3", | ||
"eslint-plugin-jest": "25.3.0", | ||
"eslint-plugin-prettier": "4.0.0", | ||
"prettier": "2.5.1", | ||
"semantic-release": "18.0.1", | ||
"typescript": "4.5.4" | ||
}, | ||
"author": "Filip Tammergård <[email protected]> (https://tammergard.se)", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"files": [ | ||
"dist/index.js", | ||
"dist/index.d.ts" | ||
], | ||
"author": "Filip Tammergård <[email protected]> (https://tammergard.se)", | ||
"license": "MIT", | ||
"scripts": { | ||
"prebuild": "rimraf dist/", | ||
"build": "tsc", | ||
"npm-publish": "npm run build && npm publish", | ||
"postnpm-publish": "rimraf dist/" | ||
}, | ||
"devDependencies": { | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.2.4" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/filiptammergard/text-analyzer.git" | ||
|
Oops, something went wrong.