mirror of
https://github.com/beautifier/js-beautify.git
synced 2024-11-23 12:49:40 +00:00
Draft for defaultOptions
This commit is contained in:
parent
d98c27bcf2
commit
88fd75760e
@ -28,11 +28,13 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
var Beautifier = require('./beautifier').Beautifier;
|
||||
var Beautifier = require('./beautifier').Beautifier,
|
||||
Options = require('./options').Options;
|
||||
|
||||
function css_beautify(source_text, options) {
|
||||
var beautifier = new Beautifier(source_text, options);
|
||||
return beautifier.beautify();
|
||||
}
|
||||
|
||||
module.exports = css_beautify;
|
||||
module.exports = css_beautify;
|
||||
module.exports.defaultOptions = new Options();
|
@ -28,11 +28,13 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
var Beautifier = require('./beautifier').Beautifier;
|
||||
var Beautifier = require('./beautifier').Beautifier,
|
||||
Options = require('./options').Options;
|
||||
|
||||
function style_html(html_source, options, js_beautify, css_beautify) {
|
||||
var beautifier = new Beautifier(html_source, options, js_beautify, css_beautify);
|
||||
return beautifier.beautify();
|
||||
}
|
||||
|
||||
module.exports = style_html;
|
||||
module.exports = style_html;
|
||||
module.exports.defaultOptions = new Options();
|
@ -37,6 +37,7 @@ function style_html(html_source, options, js, css) {
|
||||
css = css || css_beautify;
|
||||
return html_beautify(html_source, options, js, css);
|
||||
}
|
||||
style_html.defaultOptions = html_beautify.defaultOptions;
|
||||
|
||||
module.exports.js = js_beautify;
|
||||
module.exports.css = css_beautify;
|
||||
|
@ -28,11 +28,13 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
var Beautifier = require('./beautifier').Beautifier;
|
||||
var Beautifier = require('./beautifier').Beautifier,
|
||||
Options = require('./options').Options;
|
||||
|
||||
function js_beautify(js_source_text, options) {
|
||||
var beautifier = new Beautifier(js_source_text, options);
|
||||
return beautifier.beautify();
|
||||
}
|
||||
|
||||
module.exports = js_beautify;
|
||||
module.exports = js_beautify;
|
||||
module.exports.defaultOptions = new Options();
|
@ -18,6 +18,11 @@ function test_legacy_names() {
|
||||
results.expect(typeof beautify.css, 'function');
|
||||
results.expect(typeof beautify.html, 'function');
|
||||
|
||||
console.log('Ensure defaultOptions are defined');
|
||||
results.expect(typeof beautify.js.defaultOptions, 'object');
|
||||
results.expect(typeof beautify.css.defaultOptions, 'object');
|
||||
results.expect(typeof beautify.html.defaultOptions, 'object');
|
||||
|
||||
console.log('Ensure that legacy import names equal the new ones');
|
||||
results.expect(beautify.js, beautify.js_beautify);
|
||||
results.expect(beautify.css, beautify.css_beautify);
|
||||
|
Loading…
Reference in New Issue
Block a user