DEV Community

Discussion on: JavaScript Functions That Will Make Your Life Much Easier [Updatable].

Collapse
 
talorlanczyk profile image
TalOrlanczyk

for deep clone I prefer lodash because this method while it can be good in some cases it can fail.
Because it can lose data in some cases
Like Dates, functions, undefined, Infinity, RegExps, Maps, Sets, Blobs, or other complex types within your object it can be list or strigified
Its only good for object with string and numbers most of the time.
Still those are great functions that can be used in a large amount of projects

Collapse
 
youssefzidan profile image
Youssef Zidan • Edited

Thanks, My friend!
I modified the article based on your feedback!

Collapse
 
talorlanczyk profile image
TalOrlanczyk

there is a method I use a lot when I need to submit urls

export const isUrl = (s) => {
  // eslint-disable-next-line
  var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
  return regexp.test(s);
};
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
youssefzidan profile image
Youssef Zidan

Excellent!