1
0
Fork 0
freesewing/packages/plugin-validate/README.md

2.9 KiB

Freesewing logo

 freesewing
a library for made-to-measure sewing patterns

Travis build Version License Code coverage DeepScan grade Chat on Gitter Become a Patron

plugin-validate

A freesewing plugin that validates your pattern and input. It will check for:

  • Missing measurements that are required by the pattern
  • Missing X or Y coordinates in points
  • Points that aren't points or don't have proper attributes
  • Paths that don't do anything (no ops)
  • Paths that use points that aren't valid points
  • Text that will cause problems for translation

On any of these, this plugin will throw an error. As such, it's not meant to be used in production, but rather during pattern development, to spot issues in your code.

Usage

To load this plugin, add it to your instantiated pattern.

On node.js:

import pattern from '@freesewing/pattern-brian'
import validate from '@freesewing/plugin-validate'

pattern.with(validate);

In the browser, this plugin will register as freesewing.plugins.validate:

<script type="text/javascript" src="https://unpkg.com/freesewing"></script>
<script type="text/javascript" src="https://unpkg.com/@freesewing/plugin-validate"></script>
<script type="text/javascript" src="https://unpkg.com/@freesewing/pattern-brian"></script>

<script>
var pattern = freesewing.patterns.brian
  .with(freesewing.plugins.validate);
</script>

Install

To install, run:

npm install @freesewing/plugin-validate

License: MIT

See the license file for details.