import { SEMAPHORE } from "@thi.ng/api/api" ; import { repeat } from "./repeat.js" ; remarks example ```ts
 * [...extendSides([1, 2, 3])]
 * // [ 1,  1, 2, 3,  3]
 *
 * [...extendSides([1, 2, 3], 3)]
 * // [ 1, 1, 1,  1, 2, 3,  3, 3, 3 ]
 *
 * [...extendSides([1, 2, 3], 0, 3)]
 * // [ 1, 2, 3,  3, 3, 3 ]
 * ```
 *
 * -  padSides * -  wrapSides param src param numLeft param numRight export function * extendSides < T > ( src , numLeft = 1 , numRight = numLeft ) { let prev = SEMAPHORE ; for ( let x of src ) { if ( numLeft > 0 && prev === SEMAPHORE ) { yield * repeat ( x , numLeft ) ; numLeft = 0 ; } yield x ; prev = x ; } if ( numRight > 0 && prev !== SEMAPHORE ) { yield * repeat ( prev , numRight ) ; } }