vkiryukhin / vkBeautify

vkBeautify is a small, simple and powerfull javascript plugin to beautify XML, JSON, CSS and SQL text.
http://www.eslinstructor.net/vkbeautify/
Other
316 stars 97 forks source link

NodeJS support - npm package - tests #4

Open it-ony opened 11 years ago

it-ony commented 11 years ago

Hi,

I added nodejs support for your library and prepared it for publishing to npm. Just go into the directory and use npm publish. See https://npmjs.org/doc/publish.html.

I also added two simple tests with mocha. Use mocha -R spec inside the project directory to run the tests. The project is also prepared to to run the tests on http://travis-ci.org.

vkiryukhin commented 11 years ago

Hi it-ony.

Thank you for your participation. In fact, vkBeautify already has nodejs version which is known as "pretty-data"

https://github.com/vkiryukhin/pretty-data https://npmjs.org/package/pretty-data

Does your changes have any advantage over existing pretty-data version? Thank you,

--Vadim

it-ony commented 11 years ago

Hi,

I saw the pretty-data version, after I changed the vkBeautify repository.

I think having one library that work for nodejs as well as for the browser should be generally the goal. This is in my opinion the biggest advantage over the pretty-data version.

This is possible from scratch because your library has no dependencies. This can be archived using the following snipped.

(function (exports) {

    exports.VkBeautify = VkBeautify;
    exports.vkbeautify = new VkBeautify();

})(typeof(exports) === "undefined" ? this : exports);

// in a browser this will be the window object

I think another advantages are the way the tests are written. No just printing the result, but also assert against the expected result. Modifying the tests to this approach, makes it possible to run them on a continues integration server.

It's up to you, but I promise the open source community will thank you for having one, well tested library.

-- Tony

xaka commented 10 years ago

+1, i'm looking for a npm and bower packages of vkBeautify as well. It's the matter of npm publish and bower publish after all, plus you can automate it with Travis CI if you don't want to waste time doing it manually.

danielmcq commented 8 years ago

+1 for merging this pull request.

Gerst20051 commented 7 years ago

👍