1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-03 08:35:29 +02:00
joplin/ReactNativeClient/lib/ArrayUtils.js

16 lines
354 B
JavaScript
Raw Normal View History

2017-11-22 20:35:31 +02:00
const ArrayUtils = {};
ArrayUtils.unique = function(array) {
return array.filter(function(elem, index, self) {
return index === self.indexOf(elem);
});
}
ArrayUtils.removeElement = function(array, element) {
const index = array.indexOf(element);
if (index < 0) return array;
array.splice(index, 1);
return array;
}
2017-11-22 20:35:31 +02:00
module.exports = ArrayUtils;