Skip to content

Commit 4af098d

Browse files
authored
Merge pull request #35 from translationCoreApps/release-v1.1.0
Release v1.1.0
2 parents 0e7ec45 + 44e2788 commit 4af098d

File tree

7 files changed

+3447
-1917
lines changed

7 files changed

+3447
-1917
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"settings": {
1010
},
1111
"rules": {
12+
"quotes": "off",
1213
"semi": [
1314
"error",
1415
"always",

package-lock.json

Lines changed: 3410 additions & 1906 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
{
22
"name": "string-punctuation-tokenizer",
3-
"version": "0.9.1",
3+
"version": "0.9.4",
44
"description": "Small library that provides functions to tokenize a string into an array of words with or without punctuation",
55
"main": "lib/index.js",
66
"scripts": {
7-
"test": "eslint ./src ./index.js && jest",
8-
"fix": "eslint ./src ./index.js --fix",
9-
"compile": "rimraf lib && babel src/ -d lib/",
10-
"prepublish": "npm run compile"
7+
"test": "eslint ./src && jest",
8+
"fix": "eslint ./src --fix",
9+
"build": "babel ./src -d ./lib --ignore '**/__tests__,**/__mocks__'",
10+
"compile": "rimraf lib && babel src/ -d lib/ --ignore '**/__tests__,**/__mocks__'",
11+
"prebuild": "rm -rf ./lib",
12+
"prepare": "if [ ! -d './lib/' ]; then npm run build; fi",
13+
"prepublishOnly": "npm test && npm run compile",
14+
"postpublish": "git tag v$npm_package_version && git push origin v$npm_package_version"
1115
},
1216
"jest": {
1317
"collectCoverageFrom": [
@@ -40,14 +44,14 @@
4044
"devDependencies": {
4145
"babel-cli": "^6.26.0",
4246
"babel-core": "^6.26.0",
43-
"babel-eslint": "^8.2.2",
44-
"babel-jest": "^22.4.1",
47+
"babel-eslint": "^10.0.1",
48+
"babel-jest": "^23.6.0",
4549
"babel-plugin-transform-runtime": "^6.23.0",
4650
"babel-preset-env": "^1.6.1",
4751
"babel-preset-es2015": "^6.24.1",
48-
"eslint": "^4.18.1",
52+
"eslint": "^5.10.0",
4953
"eslint-config-google": "^0.9.1",
50-
"eslint-plugin-jest": "^21.12.2",
51-
"jest": "^22.4.2"
54+
"eslint-plugin-jest": "^22.1.2",
55+
"jest": "^23.6.0"
5256
}
5357
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* eslint-env jest */
2+
import * as selectionHelpers from '../selectionHelpers';
3+
4+
describe('selectionArray()', function() {
5+
it('should succeed with selection', function() {
6+
const string = "To Titus, a true son in our common faith. Grace and peace from God the Father and Christ Jesus our Savior. ";
7+
const selections = [{"text": "God", "occurrence": 1, "occurrences": 1}];
8+
const expectedSelection = {
9+
text: selections[0].text,
10+
occurrence: selections[0].occurrence,
11+
occurrences: selections[0].occurrences,
12+
selected: true,
13+
};
14+
const output = selectionHelpers.selectionArray(string, selections);
15+
expect(output.length).toEqual(3);
16+
expect(output[1]).toEqual(expectedSelection);
17+
});
18+
});

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
word,
55
punctuation,
66
whitespace,
7+
number_,
78
} from './tokenizers';
89

910
import {
@@ -28,4 +29,5 @@ export default {
2829
word,
2930
punctuation,
3031
whitespace,
32+
number: number_,
3133
};

src/selectionHelpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {occurrencesInString} from './tokenizers';
1+
import {occurrencesInString} from './occurrences';
22
/**
33
* Splice string into array of ranges, flagging what is selected
44
* @param {String} string - string.

src/tokenizers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const word = xRegExp('[\\pL\\pM\\u200D]+', '');
55
export const punctuation = xRegExp('(^\\p{P}|[<>]{2})', '');
66
export const whitespace = /\s+/;
77
export const number = /\d+/;
8+
export const number_ = xRegExp(number);
89
const tokenizerOptions = {word, whitespace, punctuation, number};
910

1011
/**

0 commit comments

Comments
 (0)