Skip to content

Commit

Permalink
Release. Bump version number
Browse files Browse the repository at this point in the history
  • Loading branch information
bryaningl3 committed Mar 1, 2021
1 parent 74fd077 commit e503ba4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 59 deletions.
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Barchart Market Data SDK <small>JavaScript 5.8.0</small>
# Barchart Market Data SDK <small>JavaScript 5.8.1</small>

> Inject real-time market data into your JavaScript applications
Expand Down
4 changes: 2 additions & 2 deletions example/browser/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -5048,7 +5048,7 @@ module.exports = (() => {
'use strict';

return {
version: '5.8.0'
version: '5.8.1'
};
})();

Expand Down Expand Up @@ -7252,7 +7252,7 @@ module.exports = (() => {
const currentYear = getCurrentYear();
let year = parseInt(yearString);

if (year < 10) {
if (year < 10 && yearString.length === 1) {
const bump = year < currentYear % 10 ? 1 : 0;
year = Math.floor(currentYear / 10) * 10 + year + bump * 10;
} else if (year < 100) {
Expand Down
2 changes: 1 addition & 1 deletion lib/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module.exports = (() => {
'use strict';

return {
version: '5.8.0'
version: '5.8.1'
};
})();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@barchart/marketdata-api-js",
"version": "5.8.0",
"version": "5.8.1",
"description": "SDK for streaming market data from Barchart.com",
"author": {
"name": "Eero Pikat",
Expand Down
61 changes: 7 additions & 54 deletions test/dist/barchart-marketdata-api-tests-5.js
Original file line number Diff line number Diff line change
Expand Up @@ -3901,72 +3901,25 @@ module.exports = (() => {
} else if (comparator(item, a[0]) < 0) {
a.unshift(item);
} else {
a.splice(binarySearchForInsert(a, item, comparator, 0, a.length - 1), 0, item);
a.splice(binarySearch(a, item, comparator, 0, a.length - 1), 0, item);
}

return a;
},

/**
* Performs a binary search to locate an item within an array.
*
* @param {*[]} a
* @param {*} key
* @param {Function} comparator
* @param {Number=} start
* @param {Number=} end
* @returns {*|null}
*/
binarySearch(a, key, comparator, start, end) {
assert.argumentIsArray(a, 'a');
assert.argumentIsRequired(comparator, 'comparator', Function);
assert.argumentIsOptional(start, 'start', Number);
assert.argumentIsOptional(end, 'end', Number);

if (a.length === 0) {
return null;
}

return binarySearchForMatch(a, key, comparator, start || 0, end || a.length - 1);
}

};

function binarySearchForMatch(a, key, comparator, start, end) {
const size = end - start;
const midpointIndex = start + Math.floor(size / 2);
const midpointItem = a[midpointIndex];
const comparison = comparator(key, midpointItem);

if (comparison === 0) {
return midpointItem;
} else if (size < 2) {
const finalIndex = a.length - 1;
const finalItem = a[finalIndex];

if (end === finalIndex && comparator(key, finalItem) === 0) {
return finalItem;
} else {
return null;
}
} else if (comparison > 0) {
return binarySearchForMatch(a, key, comparator, midpointIndex, end);
} else {
return binarySearchForMatch(a, key, comparator, start, midpointIndex);
}
}

function binarySearchForInsert(a, item, comparator, start, end) {
function binarySearch(array, item, comparator, start, end) {
const size = end - start;
const midpointIndex = start + Math.floor(size / 2);
const midpointItem = a[midpointIndex];
const midpointItem = array[midpointIndex];
const comparison = comparator(item, midpointItem) > 0;

if (size < 2) {
if (comparison > 0) {
const finalIndex = a.length - 1;
const finalIndex = array.length - 1;

if (end === finalIndex && comparator(item, a[finalIndex]) > 0) {
if (end === finalIndex && comparator(item, array[finalIndex]) > 0) {
return end + 1;
} else {
return end;
Expand All @@ -3975,9 +3928,9 @@ module.exports = (() => {
return start;
}
} else if (comparison > 0) {
return binarySearchForInsert(a, item, comparator, midpointIndex, end);
return binarySearch(array, item, comparator, midpointIndex, end);
} else {
return binarySearchForInsert(a, item, comparator, start, midpointIndex);
return binarySearch(array, item, comparator, start, midpointIndex);
}
}
})();
Expand Down

0 comments on commit e503ba4

Please sign in to comment.