@sanity/tsdoc
Version:
Generate API reference docs from TypeScript projects and store in a Sanity-friendly JSON format. Render a static frontend, or as React components.
19 lines (13 loc) • 454 B
text/typescript
import {isArray} from '../isArray'
export function addResponsiveProp(a: number | number[], b: number | number[]): number[] {
const _a = isArray(a) ? a : [a]
const _b = isArray(b) ? b : [b]
const len = Math.max(_a.length, _b.length)
const ret: number[] = []
for (let i = 0; i < len; i += 1) {
const aSize = _a[i] ?? _a[_a.length - 1] ?? 0
const bSize = _b[i] ?? _b[_b.length - 1] ?? 0
ret.push(aSize + bSize)
}
return ret
}