1
0
Fork 0
freesewing/markdown/dev/reference/api/pattern/needs/en.md
2021-09-25 17:05:18 +02:00

1.1 KiB

title
Pattern.needs()

A pattern's needs() method will return true or false depending on whether a pattern part is a requirement for the pattern to be drafted in its current configuration. In other words, it will return true of the part is needed.

A part is needed if:

You don't typically use this method. Instead, you configure part dependencies in your configuration file.

Pattern.needs() signature

bool pattern.needs(string partName)

Pattern.needs() example

import Aaron from "@freesewing/aaron"
import models from "@freesewing/models"

const pattern = new Aaron({
  settings: {
    embed: true,
  },
  measurements: models.manSize38
})

if (pattern.needs('front')) console.log('Front is needed')
else console.log('Front is not needed')