processor
v0.1.9
Published
Component object model library
Downloads
2,889
Readme
processor.js Component object model library
processor.js is a platform-independent, JavaScript node.js npm-based library for creating problem-oriented object models, implementation of component-based architecture and application of IoC-patterns. See also controls.js COM library.
About the syntax:
// fs.* namespace component module
// Copy files to folder
create('fs.copy', [['libs/jquery.js', 'libs/marked.js', 'libs/bootstrap.js'], 'temp'])
.updateSync();
// Enumerate files in subdirectories
var list =
create('fs.walker [f]', [/.*\.utest\.js/i, 'src'])
.listSync();
// Creating object model
// list source files
root
.add('source:fs.directory force', 'temp')
._add('file1:filereader', 'test1.dat')
._add('file2:filereader', 'test2.dat');
// destination file
root
.add('destination:filewriter', 'temp/out.dat');
// operation
root.add('concat:fs.concat', [root.source.childs, root.destination]);
// events
root.findFirst('filereader')
.on('watcher', function() {
alert('oops! test1.dat file changed!');
});
Approach using OM will allow more flexibility to manage tasks and task parameters. And the possibilities of language, whether it is even and JavaScript, allow you to program components in a simple way, macros and scripts of any complexity.
Installing
npm install processor
install modules
npm install com-fs
...
using
var processor = require('processor'),
create = processor.create.bind(processor);
// using fs namespace components
require('com-fs');
// recursively walk and build file list
create('fs.walker raw', [/.*\.js/, '/src'])
.listSync(function(path) {
...
});
});
modules
GitHub modules list repository
com-fs basic file system components module