Comparing version 0.1.1 to 0.2.0
33
ordu.js
/* Copyright (c) 2016 Richard Rodger and other contributors, MIT License */ | ||
'use strict' | ||
var Assert = require('assert') | ||
module.exports = function (opts) { | ||
module.exports = function(opts) { | ||
return new Ordu(opts) | ||
} | ||
var orduI = -1 | ||
function Ordu (opts) { | ||
function Ordu(opts) { | ||
var self = this | ||
++orduI | ||
opts = opts || {} | ||
@@ -26,3 +21,2 @@ Assert('object' === typeof opts) | ||
self.add = api_add | ||
@@ -34,7 +28,5 @@ self.process = api_process | ||
var tasks = [] | ||
function api_add (spec, task) { | ||
function api_add(spec, task) { | ||
task = task || spec | ||
@@ -57,3 +49,2 @@ | ||
// Valid calls: | ||
@@ -64,3 +55,3 @@ // * process(spec, ctxt, data) | ||
// * process() | ||
function api_process () { | ||
function api_process() { | ||
var i = arguments.length | ||
@@ -104,5 +95,4 @@ var data = 0 < i && arguments[--i] | ||
function api_tasknames () { | ||
return tasks.map(function (v) { | ||
function api_tasknames() { | ||
return tasks.map(function(v) { | ||
return v.name | ||
@@ -112,5 +102,4 @@ }) | ||
function api_taskdetails () { | ||
return tasks.map(function (v) { | ||
function api_taskdetails() { | ||
return tasks.map(function(v) { | ||
return v.name + ':{tags:' + v.tags + '}' | ||
@@ -120,4 +109,3 @@ }) | ||
function api_toString () { | ||
function api_toString() { | ||
return opts.name + ':[' + self.tasknames() + ']' | ||
@@ -129,4 +117,3 @@ } | ||
function contains (all, some) { | ||
function contains(all, some) { | ||
for (var i = 0; i < some.length; ++i) { | ||
@@ -133,0 +120,0 @@ if (-1 === all.indexOf(some[i])) { |
{ | ||
"name": "ordu", | ||
"version": "0.2.0", | ||
"description": "Execute functions in a configurable order, modifying a shared data structure.", | ||
@@ -17,6 +18,11 @@ "homepage": "https://github.com/rjrodger/ordu", | ||
"main": "ordu.js", | ||
"version": "0.1.1", | ||
"scripts": { | ||
"test": "lab -v -P test -L -t 100", | ||
"build": "./build.sh" | ||
"test": "lab -L -v -P test -t 100 -r console -o stdout -r html -o test/coverage.html", | ||
"coveralls": "lab -s -P test -r lcov | coveralls", | ||
"prettier": "prettier --write *.js lib/*.js test/*.js", | ||
"clean": "rm -rf node_modules package-lock.json yarn.lock", | ||
"reset": "npm run clean && npm i && npm test", | ||
"repo-tag": "REPO_VERSION=`node -e \"console.log(require('./package').version)\"` && echo TAG: v$REPO_VERSION && git commit -a -m v$REPO_VERSION && git push && git tag v$REPO_VERSION && git push --tags;", | ||
"repo-publish-quick": "npm run prettier && npm test && npm run repo-tag --registry http://registry.npmjs.org && npm publish --registry http://registry.npmjs.org", | ||
"repo-publish": "npm run clean && npm i && npm run repo-publish-quick" | ||
}, | ||
@@ -26,16 +32,12 @@ "license": "MIT", | ||
"ordu.js", | ||
"ordu-min.js", | ||
"ordu-min.map", | ||
"LICENSE" | ||
"LICENSE", | ||
"README.md" | ||
], | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"code": "3.0.x", | ||
"coveralls": "2.11.x", | ||
"docco": "0.7.x", | ||
"eslint-config-seneca": "3.x.x", | ||
"eslint-plugin-hapi": "4.x.x", | ||
"eslint-plugin-standard": "2.x.x", | ||
"lab": "11.0.x" | ||
"@hapi/code": "^8.0.1", | ||
"@hapi/lab": "^22.0.3", | ||
"coveralls": "^3.0.9", | ||
"prettier": "^1.19.1" | ||
} | ||
} |
# ordu | ||
[](https://gitter.im/rjrodger/ordu?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![npm version][npm-badge]][npm-url] | ||
[![Build Status][travis-badge]][travis-url] | ||
[![Coverage Status][coveralls-badge]][coveralls-url] | ||
[![Dependency Status][david-badge]][david-url] | ||
### Execute functions in a configurable order, modifying a shared data structure. | ||
[Annotated Source](http://rjrodger.github.io/ordu/doc/ordu.html) | ||
Task functions are executed in order of addition, and passed a shared | ||
@@ -73,1 +75,16 @@ context, and a modifiable data structure. Execution is | ||
## License | ||
Copyright (c) 2014-2016, Seamus D'Arcy and other contributors. | ||
Licensed under [MIT][]. | ||
[MIT]: ./LICENSE | ||
[travis-badge]: https://travis-ci.org/rjrodger/ordu.svg | ||
[travis-url]: https://travis-ci.org/rjrodger/ordu | ||
[npm-badge]: https://img.shields.io/npm/v/ordu.svg | ||
[npm-url]: https://npmjs.com/package/ordu | ||
[david-badge]: https://david-dm.org/rjrodger/ordu.svg | ||
[david-url]: https://david-dm.org/rjrodger/ordu | ||
[coveralls-badge]: https://coveralls.io/repos/github/rjrodger/ordu/badge.svg?branch=master | ||
[coveralls-url]: https://coveralls.io/github/rjrodger/ordu?branch=master |
7180
4
90