jorgebucaran / classcat

Build a class attribute string quickly
MIT License
906 stars 22 forks source link

Handling case when there is defined function in Object prototype #2

Closed robhil closed 7 years ago

robhil commented 7 years ago

HI, I found issue in your code: Check here: https://codepen.io/anon/pen/QqWzPy I added myFunction2 to Object.prototype and your function return myFunction2 as a class. I wrote some unit tests and fix for this issue

codecov-io commented 7 years ago

Codecov Report

Merging #2 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master     #2   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          13     13           
  Branches        6      6           
=====================================
  Hits           13     13
Impacted Files Coverage Δ
src/index.js 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ac254c1...a0fa2bc. Read the comment docs.

jorgebucaran commented 7 years ago

@robhil Thanks for bringing this up!

Why would anyone really extend the Object prototype this way?

robhil commented 7 years ago

@jbucaran Personally Im not big fun of extending prototypes of native objects but I saw a lot of projects where developers do it. E.g. You want to use Object.prototype.assign, but you have to support IE where there is no assign fn. so you can implement your own function