make compatible with browserify

added ability to disable extensions search on node so that the call to `fs.readdirSync` can be disabled when showdowns is being used with browserify (because that call cannot be handled by browserify)
This commit is contained in:
kapil verma 2014-05-13 05:32:20 +05:30
parent b3cc121d43
commit 3af3760263

View File

@ -95,6 +95,9 @@ var stdExtName = function(s) {
// //
Showdown.converter = function(converter_options) { Showdown.converter = function(converter_options) {
// set converter_options to a plain object if its undefined
converter_options = converter_options === undefined ? {} : converter_options
// //
// Globals: // Globals:
// //
@ -117,7 +120,7 @@ var g_output_modifiers = [];
// Automatic Extension Loading (node only): // Automatic Extension Loading (node only):
// //
if (typeof module !== 'undefined' && typeof exports !== 'undefined' && typeof require !== 'undefind') { if (converter_options.node !== false && typeof module !== 'undefined' && typeof exports !== 'undefined' && typeof require !== 'undefind') {
var fs = require('fs'); var fs = require('fs');
if (fs) { if (fs) {