Skip to content

Instantly share code, notes, and snippets.

'use strict'
/**
* Calculate relative value from number and percentage.
*
* @example f(500, 10) -> 50
* @example f(500, 200) -> 1000
*/
function numberFromPercentage(value, percentage) {
return (value / 100) * percentage
/**
* Convert URL from Youtube video for URL for embeding.
*
* @param {string} videoUrl - URL of Youtube VIdeo
*/
function makeYoutubeEmbed(videoUrl) {
if (typeof videoUrl !== 'string') {
return undefined
}