npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

seneca-flow

v1.0.10

Published

Senca action flow control, templating and data transformation

Downloads

13

Readme

Flow - a Seneca plugin

Join the chat at https://gitter.im/seneca-flow/Lobby Travis Coveralls npm version

Why write code when you can write messages

The plugin enables actions to contain actions with can be used to format properties for the action.

  • Control flow
  • Output transforms using lodash
  • Templating

Features

All messages can have the following properties:

  • if$: string with condition to be evaluated in order to run the actions
  • until$: string with condition to be evaluated in order to continue
  • wait$: milliseconds to wait before retry action to check until$
  • pause$: milliseconds to pause after action has completed
  • $$'anyproperty': object each property is a action which is preloaded to use in templates
  • $'anyproperty': object will execute message and set action property without $. Nested properties must prefix $ for each parent.
  • out$: object/array of actions which run using Waterfall. Fixed value which can use template functions.
  • key$: string for the key to store the message data. Used in sequences
  • exit$: string condition for exit. Used in sequences

Templates

Each of the actions property values can contain the following:

  • $: using only the $ will assign the input data of the same property
    • input { x:10 } action { x:'$' } set action { x:10 }
  • $*: assigns all input data
    • input { x:10 } action { x:'$*' } set action { x : { x:10 } }
  • <%= %>: lodash templating
    • input { x:10, y:20, msg:'hello' } action { alert:'<%= $.msg %> x = <%= $.x %> y = <%= $.y %>' } set action { alert : 'hello x = 10 y = 20' }
  • If none of the above but contains $ the expression will be evaluated
    • input { x:10 } action { y:'$.x', z:'$.x * $.x' } set action { y : 10, z : 100 }

Input data is created and assigned to $ from $$'anyproperty' and data from the previous action in sequences.

Sequence

Properties:

  • sequence: (required) array of actions
    • exit$: (optional) string condition for exit on each action. Run after each action and can use :
      • '$' which will be populated with results set via key$ and 'in' will be set to the previous action result
      • 'out' which will contain the result of the action
  • merge: (optional) boolean Merge result data when set via key$ otherwise overwrite
  • data: (optional) object to be passed to each action for templating
  • extend: (optional) object to extend each action
  • in: (optional) set in data for start of sequence

Iterate

Properties:

  • iterate: (required) object action to use to iterate
  • with: (with or times required) array of objects to to iterator as "in" property
  • times: (with or times required) integer number of times to iterate
  • exit: (optional) string condition for exit. Run after each action and can use :
    • '$.in' will be set to the current 'with' data.
    • 'index' current index
    • 'out' which will contain the result of the action
  • series: (optional) boolean force run in series
  • data: (optional) object to be passed to each iteration for templating
  • extend: (optional) object to extend each action

Parallel

Properties:

  • parallel: (required) array actions to execute
  • merge: (optional) boolean merge results of actions

Waterfall

Properties:

  • waterfall: (required) array actions to execute. Actions must accept 'in' property
  • in: (optional) data to pass to first item

Map

Properties:

  • map: (required) object action to run for each
  • in: (required) array

_ : Lodash

This is a waterfall compatible function to transform action results via the out$ property

Properties:

  • _: (required) string lodash function to call
  • in: (required) data to pass to first argument
  • args: (optional) arguments for function
  • select: (optional) property to operate on

Install

npm install seneca-flow

Testing

npm test

Releases

  • 0.0.1:
    • initial
  • 1.0.1:
    • use seneca-parambulator
    • rename each to map
    • add coveralls
    • update code style for linting
  • 1.0.2
    • update dependencies

License

Copyright (c) 2016 Georgi Griffiths; Licensed under MIT.