mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Function descriptions
This commit is contained in:
parent
9a39d2246e
commit
dcfff32fcc
2 changed files with 15 additions and 2 deletions
|
@ -26,6 +26,11 @@ export function atob(data) {
|
|||
return window.btoa(Buffer.from(data, "base64").toString("utf8"));
|
||||
}
|
||||
//https://medium.com/@asadise/sorting-a-json-array-according-one-property-in-javascript-18b1d22cd9e9
|
||||
/**
|
||||
* Sort a json collection by a property ascending
|
||||
* @param {string} property property to sort on
|
||||
* @returns sorted json collection
|
||||
*/
|
||||
export function sortByProperty(property) {
|
||||
return function (a, b) {
|
||||
if (a[property] > b[property]) return 1;
|
||||
|
@ -36,6 +41,11 @@ export function sortByProperty(property) {
|
|||
}
|
||||
|
||||
//https://medium.com/@asadise/sorting-a-json-array-according-one-property-in-javascript-18b1d22cd9e9
|
||||
/**
|
||||
* Sort a json collection by a property descending
|
||||
* @param {string} property property to sort on
|
||||
* @returns sorted json collection
|
||||
*/
|
||||
export function sortByPropertyDesc(property) {
|
||||
return function (a, b) {
|
||||
if (a[property] < b[property]) return 1;
|
||||
|
|
|
@ -25,10 +25,13 @@ export function addDataToWaterfall(data) {
|
|||
//console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setwaterfall colormap array by index
|
||||
* @param {number} index colormap index to use
|
||||
*/
|
||||
export function setColormap(index)
|
||||
{
|
||||
if (isNaN(index)) index=0;
|
||||
console.log("Setting waterfall colormap to " + index)
|
||||
//console.log("Setting waterfall colormap to " + index)
|
||||
spectrum.setColorMap(index);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue