documentcloud / underscore-contrib

The brass buckles on Underscore's utility belt
MIT License
621 stars 117 forks source link

_.islike(obj, pattern) tests objects are like patterns #196

Open joebain opened 9 years ago

joebain commented 9 years ago

The impetus behind this function is to check arguments received are in the expected format and be able to show an error or do other appropriate actions if not.

_.islike(
  {name: "James", age: 10, hobbies: ["football", "computer games", "baking"]},
  {name: "", age: 0, hobbies: [""]}
)

Please check the docs for a more thorough description and let me know what you think.