Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const createUniformBorder = (
width: number,
color: string,
style: BorderStyle = 'solid',
position: FileFormat.BorderPosition = FileFormat.BorderPosition.Center,
lineCapStyle: FileFormat.LineCapStyle = FileFormat.LineCapStyle.Butt,
lineJoinStyle: FileFormat.LineJoinStyle = FileFormat.LineJoinStyle.Miter,
): { borderOptions: FileFormat.BorderOptions; borders: FileFormat.Border[] } => {
const borderOptions = makeBorderOptions(style, width, lineCapStyle, lineJoinStyle);
const borders: FileFormat.Border[] = [
{
_class: 'border',
isEnabled: true,
color: makeColorFromCSS(color),
fillType: FileFormat.FillType.Color,
position,
thickness: width,
contextSettings: {
_class: 'graphicsContextSettings',
blendMode: FileFormat.BlendMode.Normal,
opacity: 1,
export const makeBorderOptions = (
style: 'dashed' | 'dotted' | 'solid',
width: number,
lineCapStyle: FileFormat.LineCapStyle = FileFormat.LineCapStyle.Butt,
lineJoinStyle: FileFormat.LineJoinStyle = FileFormat.LineJoinStyle.Miter,
): FileFormat.BorderOptions => ({
_class: 'borderOptions',
isEnabled: false,
dashPattern: makeDashPattern(style, width),
lineCapStyle,
lineJoinStyle,
});