1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Support importing JEX and raw data

This commit is contained in:
Laurent Cozic
2018-02-25 17:01:16 +00:00
parent 39ddd934f6
commit 8f2e5faff3
8 changed files with 431 additions and 7 deletions

View File

@ -15,7 +15,6 @@ ArrayUtils.removeElement = function(array, element) {
// https://stackoverflow.com/a/10264318/561309
ArrayUtils.binarySearch = function(items, value) {
var startIndex = 0,
stopIndex = items.length - 1,
middle = Math.floor((stopIndex + startIndex)/2);
@ -37,4 +36,13 @@ ArrayUtils.binarySearch = function(items, value) {
return (items[middle] != value) ? -1 : middle;
}
ArrayUtils.findByKey = function(array, key, value) {
for (let i = 0; i < array.length; i++) {
const o = array[i];
if (typeof o !== 'object') continue;
if (o[key] === value) return o;
}
return null;
}
module.exports = ArrayUtils;