DEV Community

Cover image for Learning about Deno building Gusano 🐍
Wilson Tovar
Wilson Tovar

Posted on

Learning about Deno building Gusano 🐍

A few days ago I started to follow Deno more closely. Although I have more than 3 years of experience in Node JS the proposals that Deno makes seem very interesting to me.

So, a couple of days ago I decided to try it out 🀷. So I made a little library called "Gusano" (Worm) that allows you to create simple pipelines.

GitHub logo krthr / gusano

A minimal workflows lib for Deno πŸ¦–

Gusano 🐍

A minimal workflows lib for Deno πŸ¦–

API

Simple example

import { Block, Engine } from 'https://raw.githubusercontent.com/krthr/gusano/master/index.ts'

const sum : Block {

    id: 'sum',
    name: 'Sum block',

    run: (a, b) => Number(a) + Number(b),

    version: '0.1.0'

}

const engine = new Engine({ sum })

engine.on('end', ({ result, time }) => {
    console.log(result) // [3]
    console.log(time)   // 2
})

engine.start('sum', 1, 2)
Enter fullscreen mode Exit fullscreen mode

A more complex example / Prime generator

/**
 * This block generates `n + 1`.
 */
export const generator: Block = {
  id: "generator",
  name: "Generator Block",
  version: "0.1.0",
  run: (n,
…
Enter fullscreen mode Exit fullscreen mode

I want to share my entire learning journey with you in the future.

PS: I also receive suggestions and PR's ;) hahaa

Top comments (0)