flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
23
VISUALIZACION/node_modules/polished/lib/internalHelpers/_constructGradientValue.js.flow
generated
vendored
Executable file
23
VISUALIZACION/node_modules/polished/lib/internalHelpers/_constructGradientValue.js.flow
generated
vendored
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
// @flow
|
||||
function constructGradientValue(literals: Array<string>, ...substitutions: Array<string>): string {
|
||||
let template = ''
|
||||
for (let i = 0; i < literals.length; i += 1) {
|
||||
template += literals[i]
|
||||
if (i === substitutions.length - 1 && substitutions[i]) {
|
||||
const definedValues = substitutions.filter(substitute => !!substitute)
|
||||
// Adds leading coma if properties preceed color-stops
|
||||
if (definedValues.length > 1) {
|
||||
template = template.slice(0, -1)
|
||||
template += `, ${substitutions[i]}`
|
||||
// No trailing space if color-stops is the only param provided
|
||||
} else if (definedValues.length === 1) {
|
||||
template += `${substitutions[i]}`
|
||||
}
|
||||
} else if (substitutions[i]) {
|
||||
template += `${substitutions[i]} `
|
||||
}
|
||||
}
|
||||
return template.trim()
|
||||
}
|
||||
|
||||
export default constructGradientValue
|
||||
Loading…
Add table
Add a link
Reference in a new issue