Echo JS 0.11.0

<~>
zewish 3139 days ago. link parent 2 points
lodash.get is 200 lines of code and this is just 17 and it uses only builtin array and string functions.

Replies

alonronin 3138 days ago. link 2 points
your code is nice and elegant, however lodash treats more use cases, and performance proved (not just saying 'fast' at the title)

i'd use lodash in my project, but i like yours also.
eliseumds 3138 days ago. link 0 point
And lodash has 203 contributors, has been around since 2009 and it's very likely that every JS developer will need more than _.get() in their projects.
zewish 3138 days ago. link 1 point
Guys, guys, I'm not trying to create a lodash-killer library. I myself am a happy user of lodash and I use it on a daily basis. I also respect John Dalton for creating and maintaining it. Bear with me, please :)

This is just my solution of the same problem _.get solves. If you're concerned about the performance I've created a small benchmark which runs _.get and oget 1000 times each with the same test case. I'm not saying it is always faster, but on node.js 4.4.4 LTS it is currently a little faster.

You may check the benchmark here:
https://github.com/zewish/oget/tree/master/benchmark

Results on my machine are:
[oget] average time: 16146.49
[_get] average time: 17311.53
Julienng 3138 days ago. link 2 points
this is a bit unfair if you look at the code. Most of the line is comment...
zewish 3138 days ago. link 1 point
You should probably look at the code of the lodash.get module, one of the first lines of code does require('lodash._stringtopath').

Try to open this module and count only the the lines with code. All in all lodash.get is more than 200 lines of code :)