Display optionals
This commit is contained in:
parent
5b9819b84f
commit
c179fbce7e
42
README.md
42
README.md
@ -20,17 +20,17 @@ npm start
|
||||
## Library
|
||||
|
||||
- `(import path rect)` Imports a graphic file with format.
|
||||
- `(export path format quality)` Exports a graphic file with format.
|
||||
- `(pos x y t)` Returns a position shape.
|
||||
- `(size w h t)` Returns a size shape.
|
||||
- `(rect x y w h t)` Returns a rect shape.
|
||||
- `(circle x y r t)` Returns a circle shape.
|
||||
- `(line a b t)` Returns a line shape.
|
||||
- `(text x y g s f t)` Returns a text shape.
|
||||
- `(svg d t)` Returns a svg shape.
|
||||
- `(stroke shape)` Strokes a shape.
|
||||
- `(fill rect)` Fills a shape.
|
||||
- `(clear rect)` Clears a rect.
|
||||
- `(export path ~format ~quality)` Exports a graphic file with format.
|
||||
- `(pos x y ~t)` Returns a position shape.
|
||||
- `(size w h ~t)` Returns a size shape.
|
||||
- `(rect x y w h ~t)` Returns a rect shape.
|
||||
- `(circle x y r ~t)` Returns a circle shape.
|
||||
- `(line a b ~t)` Returns a line shape.
|
||||
- `(text x y g s ~f ~t)` Returns a text shape.
|
||||
- `(svg d ~t)` Returns a svg shape.
|
||||
- `(stroke ~shape)` Strokes a shape.
|
||||
- `(fill ~rect)` Fills a shape.
|
||||
- `(clear ~rect)` Clears a rect.
|
||||
- `(add ...args)` Adds values.
|
||||
- `(sub ...args)` Subtracts values.
|
||||
- `(mul ...args)` Multiplies values.
|
||||
@ -54,34 +54,34 @@ npm start
|
||||
- `(or a b ...rest)` Returns true if at least one condition is true.
|
||||
- `(map fn arr)`
|
||||
- `(filter fn arr)`
|
||||
- `(reduce fn arr acc)`
|
||||
- `(reduce fn arr ~acc)`
|
||||
- `(len item)` Returns the length of a list.
|
||||
- `(first arr)` Returns the first item of a list.
|
||||
- `(last arr)` Returns the last
|
||||
- `(rest [_ ...arr])`
|
||||
- `(range start end step)`
|
||||
- `(range start end ~step)`
|
||||
- `(get item key)` Gets an object's parameter with name.
|
||||
- `(set item key val)` Sets an object's parameter with name as value.
|
||||
- `(frame)` Returns a rect of the frame.
|
||||
- `(center)` Returns a position of the center of the frame.
|
||||
- `(scale rect w h)`
|
||||
- `(resize w h)`
|
||||
- `(resize ~w ~h)`
|
||||
- `(crop rect)`
|
||||
- `(clone a b)`
|
||||
- `(of h ...keys)`
|
||||
- `(theme variable el)`
|
||||
- `(gradient [x1 y1 x2 y2] colors 'black'])`
|
||||
- `(theme variable ~el)`
|
||||
- `(gradient [x1 y1 x2 y2] ~colors 'black'])`
|
||||
- `(pixels rect fn q)`
|
||||
- `(saturation pixel q)`
|
||||
- `(contrast pixel q)`
|
||||
- `(saturation pixel ~q)`
|
||||
- `(contrast pixel ~q)`
|
||||
- `(echo ...args)`
|
||||
- `(str ...args)`
|
||||
- `(open path)` Imports a graphic file and resizes the frame.
|
||||
- `(folder path)` Returns the content of a folder path.
|
||||
- `(exit force)` Exits Ronin.
|
||||
- `(folder ~path)` Returns the content of a folder path.
|
||||
- `(exit ~force)` Exits Ronin.
|
||||
- `(ronin)`
|
||||
- `(time)` Returns timestamp in milliseconds.
|
||||
- `(animate play)` Toggles animation.
|
||||
- `(animate ~play)` Toggles animation.
|
||||
- `(js)`
|
||||
- `(test name a b)`
|
||||
|
||||
|
@ -178,7 +178,7 @@ function Commander (ronin) {
|
||||
for (const id in payload) {
|
||||
const name = payload[id].substr(0, payload[id].indexOf(' = '))
|
||||
const parent = payload[id].substr(payload[id].indexOf(' = ')).match(/\(([^)]+)\)/)
|
||||
const params = parent ? parent[1].split(',').map((word) => { return word.indexOf(' = ') ? word.split(' = ')[0].trim() : word }) : []
|
||||
const params = parent ? parent[1].split(',').map((word) => { return word.indexOf(' = ') > -1 ? '~' + (word.split(' = ')[0]).trim() : word.trim() }) : []
|
||||
const note = payload[id].indexOf('// ') > -1 ? payload[id].split('//')[1].trim() : ''
|
||||
this.dict[name] = { note, params }
|
||||
if (params.length < 1) { console.warn('Docs', 'Missing params for ' + name) }
|
||||
|
@ -330,7 +330,7 @@ function Library (ronin) {
|
||||
|
||||
// javascript interop
|
||||
this.js = window
|
||||
|
||||
|
||||
this.test = (name, a, b) => {
|
||||
if (`${a}` !== `${b}`) {
|
||||
console.warn('failed ' + name, a, b)
|
||||
|
Loading…
x
Reference in New Issue
Block a user