Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/transformify
Takes a synchronous function that transforms a string and converts it into a transform compatible with browserify, catw and mutiny.
https://github.com/thlorenz/transformify
Last synced: 15 days ago
JSON representation
Takes a synchronous function that transforms a string and converts it into a transform compatible with browserify, catw and mutiny.
- Host: GitHub
- URL: https://github.com/thlorenz/transformify
- Owner: thlorenz
- License: mit
- Created: 2013-12-16T22:28:54.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-01-21T21:41:44.000Z (almost 11 years ago)
- Last Synced: 2024-05-08T17:30:27.837Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 145 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# transformify [![build status](https://secure.travis-ci.org/thlorenz/transformify.png)](http://travis-ci.org/thlorenz/transformify)
Takes a synchronous function that transforms a string and converts it into a transform compatible with browserify, catw and mutiny.
```js
var transformify = require('transformify');function toUpper(s) {
return s.toUpperCase();
}require('fs').createReadStream(__filename)
.pipe(transformify(toUpper)(/* file not used */))
.pipe(process.stdout);
```### Output
```
VAR TRANSFORMIFY = REQUIRE('TRANSFORMIFY')FUNCTION TOUPPER(S) {
RETURN S.TOUPPERCASE();
}REQUIRE('FS').CREATEREADSTREAM(__FILENAME)
.PIPE(TRANSFORMIFY(TOUPPER)(/* FILE NOT USED */))
.PIPE(PROCESS.STDOUT);
```## Installation
npm install transformify
## API
### transformify(fn)
```
/**
* Takes a synchronous function that transforms a string and returns a transform compatible with browserify, catw and mutiny.
*
* @name transformify
* @function
* @param {Function(String):String} fn
* @return {Function(String):TransformStream} function that returns a transform stream
*/
```## License
MIT