Skip to content
Riccardo Cocetta edited this page Sep 17, 2015 · 18 revisions

Welcome to the r.cocetta/ kano-draw wiki!

Ho to validate steps:

Rules is an array of either string or object

If an element is a string it'll be considered a regex, if it's an object it'll be validated depending on the type. For the moment we only have type: function which will contain a function which can receive a string representing the line that it's validating.

If the array contains more than one element, the validator will check more than 1 line.

steps: [
    {
     ...
     rules: [
         '^for*.'
     ]
    },
    {
     ...
     rules: [
         { 
           "type": "function" 
           "fn"  : "function (str) {return str.length===3;}"
         }
     ]
    },
    {
     ...
     rules: [
         'color white',
         { 
           "type": "function" 
           "fn"  : "function (str) {return str.length===3;}"
         }
     ]
    },

]
Clone this wiki locally