Skip to content

Commit

Permalink
Merge pull request #35 from translationCoreApps/release-v1.1.0
Browse files Browse the repository at this point in the history
Release v1.1.0
  • Loading branch information
richmahn authored Feb 6, 2019
2 parents 0e7ec45 + 44e2788 commit 4af098d
Show file tree
Hide file tree
Showing 7 changed files with 3,447 additions and 1,917 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"settings": {
},
"rules": {
"quotes": "off",
"semi": [
"error",
"always",
Expand Down
5,316 changes: 3,410 additions & 1,906 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{
"name": "string-punctuation-tokenizer",
"version": "0.9.1",
"version": "0.9.4",
"description": "Small library that provides functions to tokenize a string into an array of words with or without punctuation",
"main": "lib/index.js",
"scripts": {
"test": "eslint ./src ./index.js && jest",
"fix": "eslint ./src ./index.js --fix",
"compile": "rimraf lib && babel src/ -d lib/",
"prepublish": "npm run compile"
"test": "eslint ./src && jest",
"fix": "eslint ./src --fix",
"build": "babel ./src -d ./lib --ignore '**/__tests__,**/__mocks__'",
"compile": "rimraf lib && babel src/ -d lib/ --ignore '**/__tests__,**/__mocks__'",
"prebuild": "rm -rf ./lib",
"prepare": "if [ ! -d './lib/' ]; then npm run build; fi",
"prepublishOnly": "npm test && npm run compile",
"postpublish": "git tag v$npm_package_version && git push origin v$npm_package_version"
},
"jest": {
"collectCoverageFrom": [
Expand Down Expand Up @@ -40,14 +44,14 @@
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.2",
"babel-jest": "^22.4.1",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"eslint": "^4.18.1",
"eslint": "^5.10.0",
"eslint-config-google": "^0.9.1",
"eslint-plugin-jest": "^21.12.2",
"jest": "^22.4.2"
"eslint-plugin-jest": "^22.1.2",
"jest": "^23.6.0"
}
}
18 changes: 18 additions & 0 deletions src/__tests__/selectionHelpers.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-env jest */
import * as selectionHelpers from '../selectionHelpers';

describe('selectionArray()', function() {
it('should succeed with selection', function() {
const string = "To Titus, a true son in our common faith. Grace and peace from God the Father and Christ Jesus our Savior. ";
const selections = [{"text": "God", "occurrence": 1, "occurrences": 1}];
const expectedSelection = {
text: selections[0].text,
occurrence: selections[0].occurrence,
occurrences: selections[0].occurrences,
selected: true,
};
const output = selectionHelpers.selectionArray(string, selections);
expect(output.length).toEqual(3);
expect(output[1]).toEqual(expectedSelection);
});
});
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
word,
punctuation,
whitespace,
number_,
} from './tokenizers';

import {
Expand All @@ -28,4 +29,5 @@ export default {
word,
punctuation,
whitespace,
number: number_,
};
2 changes: 1 addition & 1 deletion src/selectionHelpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {occurrencesInString} from './tokenizers';
import {occurrencesInString} from './occurrences';
/**
* Splice string into array of ranges, flagging what is selected
* @param {String} string - string.
Expand Down
1 change: 1 addition & 0 deletions src/tokenizers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const word = xRegExp('[\\pL\\pM\\u200D]+', '');
export const punctuation = xRegExp('(^\\p{P}|[<>]{2})', '');
export const whitespace = /\s+/;
export const number = /\d+/;
export const number_ = xRegExp(number);
const tokenizerOptions = {word, whitespace, punctuation, number};

/**
Expand Down

0 comments on commit 4af098d

Please sign in to comment.