Add Sheet -> create/remove to GoogleSheets node(#1620)

* Add operation 'addSheet' to GoogleSheets node

* lint fixes

*  Improvements

*  Move operations to "Sheet"

Co-authored-by: dali <servfrdali@yahoo.fr>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
Ricardo Espinoza
2021-04-03 04:04:22 -04:00
committed by GitHub
parent 99bb6e40c1
commit 12838f26e3
2 changed files with 255 additions and 5 deletions

View File

@@ -127,3 +127,19 @@ function getAccessToken(this: IExecuteFunctions | IExecuteSingleFunctions | ILoa
//@ts-ignore
return this.helpers.request(options);
}
// Hex to RGB
export function hexToRgb(hex: string) {
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
hex = hex.replace(shorthandRegex, (m, r, g, b) => {
return r + r + g + g + b + b;
});
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
red: parseInt(result[1], 16),
green: parseInt(result[2], 16),
blue: parseInt(result[3], 16),
} : null;
}