// написать функцию для каррирования
const curry = (func) => {
// код
};
const sum = (a, b, c) => a + b + c;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | |
# dependencies | |
/node_modules | |
/.pnp | |
.pnp.js | |
# testing | |
/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const stringCheck = (keyToOmit) => (value, key) => keyToOmit === key; | |
const arrayOfStringCheck = (keysToOmit) => (value, key) => keysToOmit.includes(key); | |
const omit = (targetObject, options) => { | |
const check = typeof options === 'function' ? options : Array.isArray(options) ? arrayOfStringCheck : stringCheck; | |
return Object.keys(targetObject).reduce((result, key) => { | |
if (!check(targetObject[key], key, targetObject)) { | |
result[key] = targetObject[key]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const colorToHEX = (colorString) => { | |
if (colorString.startsWith('rgba(')) { | |
const rgba = colorString | |
.slice(5, colorString.length - 1) | |
.split(',') | |
.map((item) => +item.trim()); | |
const background = [255, 255, 255]; | |
const hex = [ | |
Math.round((rgba[3] * (rgba[0] / 255) + (1 - rgba[3]) * (background[0] / 255)) * 255), | |
Math.round((rgba[3] * (rgba[1] / 255) + (1 - rgba[3]) * (background[1] / 255)) * 255), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const colorToRGB = (colorString) => { | |
if (colorString.startsWith('rgba(')) { | |
const rgba = colorString | |
.slice(5, colorString.length - 1) | |
.split(',') | |
.map((item) => +item.trim()); | |
const background = [255, 255, 255]; | |
const rgb = [ | |
Math.round((rgba[3] * (rgba[0] / 255) + (1 - rgba[3]) * (background[0] / 255)) * 255), | |
Math.round((rgba[3] * (rgba[1] / 255) + (1 - rgba[3]) * (background[1] / 255)) * 255), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const colorToRGBA = (colorString, alpha) => { | |
if (colorString.startsWith('rgb(')) { | |
const rgb = colorString | |
.slice(4, colorString.length - 1) | |
.split(',') | |
.map((item) => +item.trim()); | |
return `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${alpha})`; | |
} |
OlderNewer