Sha256: 339600ea9016bfb0f821ab7d90725a5a8101b6703868a4af5e2d06e5c28e7c2f
Contents?: true
Size: 748 Bytes
Versions: 14
Compression:
Stored size: 748 Bytes
Contents
# Returns a replica of the given hash. # Don't use this method for real objects with superclasses, prototypes, and stuff. modularity.clone_hash = (obj) -> result = {} result[key] = value for own key, value of obj result # Returns an object that contains only the attributes # that are different between obj_1 and obj_2. # Only looks for changed attributes, not missing attributes. modularity.object_diff = (obj_1, obj_2) -> result = {} for own key, value_2 of obj_2 do (key, value_2) -> value_1 = obj_1[key] result[key] = value_2 if value_1 != value_2 result # Returns the number of attributes of the given object. # NOTE(KG): This doesn't work in IE8. modularity.object_length = (obj) -> Object.keys(obj).length
Version data entries
14 entries across 14 versions & 2 rubygems