majodev / metalsmith-data-markdown

A Metalsmith plugin to use markdown content within html tags via data-markdown attribute

Home Page:http://ranf.tl/2014/10/01/extracting-libs-from-a-node-js-project/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unessissary use of _.isUndefined()

unstoppablecarl opened this issue · comments

It is a minor thing but I do not think it is necessary to use _.isUndefined() in this context.

https://github.com/majodev/metalsmith-data-markdown/blob/master/index.js#L29

_.isUndefined in lodash source

https://github.com/lodash/lodash/blob/2.4.1/dist/lodash.compat.js#L2917

In all versions of nodejs undefined is not mutable.

It would be much simpler to read and write if(options === undefined){ ....

I just looked at your other new metalsmith plugins. I will be putting them to good use 😃

metalsmith-headings-identifier has the same problem with its options code.

The way you wrote your options code in metalsmith-word-count is much easier to read and just as effective.

https://github.com/majodev/metalsmith-word-count/blob/master/index.js#L19

ah finally, you might be the first one ever, who reviews the code of one of my lil' projects. Thanks for your interest!

I will definitely change the default options setup in my code this evening, as you said, it looks horrible. ^^

Defaults setup code of metalsmith-data-markdown changed (also finally added a unit test). I will close this issue here and update my other plugins as well...

Thanks for your feedback!