import { SKLayer , PBorder , Fill } from '../types' ; import { transSketchColor } from '../common/utils' ; param layer export const parseBorder = ( layer ) : PBorder [ ] => { const { borders = [ ] } = layer . style ; return borders . filter ( ( { isEnabled , fillType } ) => isEnabled && ( [ 0 , 1 ] . includes ( fillType ) ) ) . map ( ( { position , thickness , color , fillType , gradient } ) => { let fill ; if ( fillType === 0 ) { fill = { type : 0 , color : transSketchColor ( color ) } ; } else if ( fillType === 1 && [ 0 , 1 , 2 ] . includes ( gradient . gradientType ) ) { fill = { type : gradient . gradientType + 1 , stops : gradient . stops . map ( ( { position , color } ) => ( { position , color : transSketchColor ( color ) , } ) ) } ; } return { position : + position , thickness , fill } ; } ) ; } ;