Comments (11)
both to accept only arrays (or plural array, singular only string?)
I would accept only strings for singular and plural only arrays.
from jstransformer.
I'd actually opt to removing outputFormat entirely.
from jstransformer.
I would accept only strings for singular and plural only arrays.
yea, exactly. I thought for something like this
var outputFormat = this._tr.outputFormat || this._tr.outputFormats;
var inputFormat = this._tr.inputFormat || this._tr.inputFormats || this.name;
outputFormat = Array.isArray(outputFormat) ? outputFormat : [outputFormat];
inputFormat = Array.isArray(inputFormat) ? inputFormat : [inputFormat];
this.outputFormat = this.outputFormats = outputFormat;
this.inputFormat = this.inputFormats = inputFormat;
from jstransformer.
I'd actually opt to removing outputFormat entirely.
why?
from jstransformer.
Remove outputFormat because it makes assumptions on the context of the application. As you demonstrated, the output can be changed based on the options passed to the Tranformer.
I've used Mustache to output CSS before, I've used ECO to output JavaScript. There is no way for us to determine what's expected for the output, so we should make no assumption in the matter.
from jstransformer.
There is no way for us to determine what's expected for the output, so we should make no assumption in the matter
true
from jstransformer.
hmm. good point.
from jstransformer.
@jstransformers/owners one more use case
https://github.com/jstransformers/jstransformer-gray-matter - what should be inputFormats/outputFormat? text? it accept and output markdown, html, css, html and etc, common used for markdown, hbs, mustache and etc.
from jstransformer.
and actually, all template engines or even just mustache-like engines can output just simple text not html, its based on the context of the application
from jstransformer.
oh, yea, outputFormat
is json, but what to be the inputFormats
?
from jstransformer.
The purpose of outputFormat is to define a default output format for a given transformer. I.e. If asked to transform a file with a given transformer and told nothing else, what file extension should I use for the output by default.
The purpose of inputFormats is to list the input file extensions that correspond to a given transformer. I.e. If I'm given a collection of files and a collection of transformers, which transformer should I use for which file.
These use cases should hopefully make it clear that there's not much use in having an array for outputFormat, but it does make sense to have an array of inputFormats
from jstransformer.
Related Issues (20)
- jsx-template
- Mermaid: Data Flow Diagrams
- Polished CSS
- Ibra
- markdown-in-js
- thysultan/jsx.js - small and extensible transpiler HOT 1
- Switch to npm organization HOT 2
- Support sync rendering even of async transforms
- Emoji
- jQuery View Engine
- blockml HOT 1
- Typescript/JavaScript to C
- imagemin
- lit-html
- Mark
- trademark/copyright issue on logo HOT 3
- Prepack
- renderAsync can throw synchronously, should return a rejected promise instead? HOT 1
- Slack Group? HOT 3
- An in-range update of is-promise is breaking the build 🚨 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jstransformer.