Skip to content

Commit

Permalink
fix: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesus Seijas committed Mar 25, 2020
1 parent b64913a commit 0c4cb40
Show file tree
Hide file tree
Showing 92 changed files with 7,826 additions and 6,711 deletions.
5,878 changes: 3,492 additions & 2,386 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
"license": "MIT",
"dependencies": {},
"devDependencies": {
"coveralls": "^3.0.9",
"coveralls": "^3.0.11",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-prettier": "^6.9.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-jest": "^23.2.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jest": "^23.8.2",
"eslint-plugin-prettier": "^3.1.2",
"https-proxy-agent": "^5.0.0",
"jest": "^24.9.0",
"lerna": "^3.20.0",
"prettier": "^1.19.1"
"jest": "^25.1.0",
"lerna": "^3.20.2",
"prettier": "^2.0.2"
},
"jest": {
"verbose": true,
Expand Down
10 changes: 5 additions & 5 deletions packages/builtin-duckling/src/builtin-duckling.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ class BuiltinDuckling extends Clonable {
'Content-Length': postData.length,
},
};
const req = this.client.request(options, res => {
const req = this.client.request(options, (res) => {
let result = '';
res.on('data', chunk => {
res.on('data', (chunk) => {
result += chunk;
});
res.on('end', () => {
Expand All @@ -118,9 +118,9 @@ class BuiltinDuckling extends Clonable {
reject(err);
}
});
res.on('error', err => reject(err));
res.on('error', (err) => reject(err));
});
req.on('error', err => reject(err));
req.on('error', (err) => reject(err));
req.write(postData);
req.end();
});
Expand Down Expand Up @@ -215,7 +215,7 @@ class BuiltinDuckling extends Clonable {
}

transform(entities) {
return entities.map(x => this.transformEntity(x));
return entities.map((x) => this.transformEntity(x));
}

async findBuiltinEntities(utterance, language) {
Expand Down
2 changes: 1 addition & 1 deletion packages/builtin-microsoft/src/builtin-microsoft.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class BuiltinMicrosoft extends Clonable {
const result = [];
const source = [];
const culture = getCulture(locale);
this.settings.builtins.forEach(name => {
this.settings.builtins.forEach((name) => {
try {
const entities = Recognizers[`recognize${name}`](utterance, culture);
if (name === 'Number' && locale !== 'en') {
Expand Down
2 changes: 1 addition & 1 deletion packages/builtin-microsoft/test/builtin-microsoft.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const languages = [
];

describe('NER Manager builtins', () => {
languages.forEach(language => {
languages.forEach((language) => {
describe(`Numbers ${language.name}`, () => {
addTests(numberTests, language.locale);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/console-connector/src/console-connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ConsoleConnector extends Clonable {
output: process.stdout,
terminal: false,
});
this.rl.on('line', async line => this.hear(line));
this.rl.on('line', async (line) => this.hear(line));
}

say(message, reference) {
Expand Down
10 changes: 7 additions & 3 deletions packages/core-loader/src/container-bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ function loadPipelines(instance, fileName) {
}
} else if (fs.existsSync(fileName)) {
if (fs.lstatSync(fileName).isDirectory()) {
const files = listFilesAbsolute(fileName).filter(x => x.endsWith('.md'));
const files = listFilesAbsolute(fileName).filter((x) =>
x.endsWith('.md')
);
for (let i = 0; i < files.length; i += 1) {
loadPipelines(instance, files[i]);
}
Expand All @@ -81,7 +83,9 @@ function loadPlugins(instance, fileName) {
}
} else if (fs.existsSync(fileName)) {
if (fs.lstatSync(fileName).isDirectory()) {
const files = listFilesAbsolute(fileName).filter(x => x.endsWith('.js'));
const files = listFilesAbsolute(fileName).filter((x) =>
x.endsWith('.js')
);
for (let i = 0; i < files.length; i += 1) {
loadPlugins(instance, files[i]);
}
Expand All @@ -103,7 +107,7 @@ function traverse(obj, preffix) {
return obj;
}
if (Array.isArray(obj)) {
return obj.map(x => traverse(x, preffix));
return obj.map((x) => traverse(x, preffix));
}
if (typeof obj === 'object') {
const keys = Object.keys(obj);
Expand Down
8 changes: 4 additions & 4 deletions packages/core-loader/src/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ const {

function listFiles(folderPath, recursive = true) {
if (fs.existsSync(folderPath)) {
const all = fs.readdirSync(folderPath).map(x => path.join(folderPath, x));
const files = all.filter(x => fs.statSync(x).isFile());
const all = fs.readdirSync(folderPath).map((x) => path.join(folderPath, x));
const files = all.filter((x) => fs.statSync(x).isFile());
if (recursive) {
const dirs = all.filter(x => !files.includes(x));
const dirs = all.filter((x) => !files.includes(x));
const dirFiles = dirs.reduce(
(prev, current) => prev.concat(listFiles(current)),
[]
Expand All @@ -59,7 +59,7 @@ function getAbsolutePath(relative) {

function listFilesAbsolute(folderPath, recursive = true) {
const files = listFiles(folderPath, recursive);
return files.map(x => getAbsolutePath(x));
return files.map((x) => getAbsolutePath(x));
}

function loadEnv(fileName = '.env') {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-loader/test/assets/char.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Char {

filter(srcInput) {
const input = srcInput;
input.arr = input.arr.filter(x => !x.includes(input.excludeChars));
input.arr = input.arr.filter((x) => !x.includes(input.excludeChars));
return input;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/clonable.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Clonable {
*/
applySettings(srcobj, settings = {}) {
const obj = srcobj || {};
Object.keys(settings).forEach(key => {
Object.keys(settings).forEach((key) => {
if (obj[key] === undefined) {
obj[key] = settings[key];
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/container-bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function traverse(obj, preffix) {
return obj;
}
if (Array.isArray(obj)) {
return obj.map(x => traverse(x, preffix));
return obj.map((x) => traverse(x, preffix));
}
if (typeof obj === 'object') {
const keys = Object.keys(obj);
Expand Down
18 changes: 9 additions & 9 deletions packages/core/src/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,18 @@ const reHasUnicode = RegExp(
const reUnicode = RegExp(`${rsFitz}(?=${rsFitz})|${rsSymbol + rsSeq}`, 'g');
/* eslint-enable no-misleading-character-class */

const hasUnicode = str => reHasUnicode.test(str);
const unicodeToArray = str => str.match(reUnicode) || [];
const asciiToArray = str => str.split('');
const stringToArray = str =>
const hasUnicode = (str) => reHasUnicode.test(str);
const unicodeToArray = (str) => str.match(reUnicode) || [];
const asciiToArray = (str) => str.split('');
const stringToArray = (str) =>
hasUnicode(str) ? unicodeToArray(str) : asciiToArray(str);

function compareWildcars(text, rule) {
const escapeRegex = str => str.replace(/([.*+^=!:${}()|[\]/\\])/g, '\\$1');
const regexRule = `^${rule
.split('*')
.map(escapeRegex)
.join('.*')}$`.replace(/\?/g, '.');
const escapeRegex = (str) => str.replace(/([.*+^=!:${}()|[\]/\\])/g, '\\$1');
const regexRule = `^${rule.split('*').map(escapeRegex).join('.*')}$`.replace(
/\?/g,
'.'
);
return new RegExp(regexRule).test(text);
}

Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/memory-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ class MemoryStorage extends Clonable {
}

read(keys) {
return new Promise(resolve => {
return new Promise((resolve) => {
const data = {};
if (!Array.isArray(keys)) {
keys = [keys];
}
keys.forEach(key => {
keys.forEach((key) => {
const item = this.settings.memory[key];
if (item) {
data[key] = JSON.parse(item);
Expand All @@ -70,7 +70,7 @@ class MemoryStorage extends Clonable {

write(changes) {
return new Promise((resolve, reject) => {
Object.keys(changes).forEach(key => {
Object.keys(changes).forEach((key) => {
const newItem = changes[key];
const oldStr = this.settings.memory[key];
if (!oldStr || newItem.eTag === '*') {
Expand All @@ -88,8 +88,8 @@ class MemoryStorage extends Clonable {
}

delete(keys) {
return new Promise(resolve => {
keys.forEach(key => delete this.settings.memory[key]);
return new Promise((resolve) => {
keys.forEach((key) => delete this.settings.memory[key]);
resolve();
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/mock-fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

function readFile() {
return new Promise(resolve => {
return new Promise((resolve) => {
resolve(undefined);
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/stopwords.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Stopwords {
}

removeStopwords(tokens) {
return tokens.filter(x => this.isNotStopword(x));
return tokens.filter((x) => this.isNotStopword(x));
}

run(srcInput) {
Expand All @@ -54,7 +54,7 @@ class Stopwords {
const remover = this.container.get(`stopwords-${locale}`) || this;
input.tokens = remover
.removeStopwords(input.tokens, input)
.filter(x => x);
.filter((x) => x);
return input;
}
return srcInput;
Expand Down
138 changes: 69 additions & 69 deletions packages/core/src/timer.js
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
/*
* Copyright (c) AXA Group Operations Spain S.A.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

const { defaultContainer } = require('./container');

/**
* Class for a simple timer
*/
class Timer {
/**
* Constructor of the class
* @param {object} container Parent container
*/
constructor(container = defaultContainer) {
this.container = container.container || container;
this.name = 'timer';
}

/**
* Starts the timer
* @param {object} input
*/
start(input) {
if (input) {
input.hrstart = new Date();
}
return input;
}

/**
* Stops the timer
* @param {object} srcInput
*/
stop(srcInput) {
const input = srcInput;
if (input && input.hrstart) {
const hrend = new Date();
input.elapsed = hrend.getTime() - input.hrstart.getTime();
delete input.hrstart;
}
return input;
}

run(srcInput) {
this.start(srcInput);
}
}

module.exports = Timer;
/*
* Copyright (c) AXA Group Operations Spain S.A.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

const { defaultContainer } = require('./container');

/**
* Class for a simple timer
*/
class Timer {
/**
* Constructor of the class
* @param {object} container Parent container
*/
constructor(container = defaultContainer) {
this.container = container.container || container;
this.name = 'timer';
}

/**
* Starts the timer
* @param {object} input
*/
start(input) {
if (input) {
input.hrstart = new Date();
}
return input;
}

/**
* Stops the timer
* @param {object} srcInput
*/
stop(srcInput) {
const input = srcInput;
if (input && input.hrstart) {
const hrend = new Date();
input.elapsed = hrend.getTime() - input.hrstart.getTime();
delete input.hrstart;
}
return input;
}

run(srcInput) {
this.start(srcInput);
}
}

module.exports = Timer;
Loading

0 comments on commit 0c4cb40

Please sign in to comment.