Skip to content

update interfaces: stop modifying prototype

Choose a tag to compare

@leungwensen leungwensen released this 28 Nov 09:32
· 156 commits to master since this release

reason I update interfaces

it seems that pastry of old versions is easily in conflict with other products.and the reason is, I modified the prototype of all kinds of data structures in pasty,therefor if one uses for in loop and forgets to ignore the uncountable properties (often those in prototype), errors are thrown.

so I decided to change all the interfaces, add methods directly to PT namespace, instead of adding them to prototype function.
code might look less prettier than that written with the older versions, but is robuster.

want to use old versions?

var key;
for (key in obj) {
    if (obj.hasOwnProperty(key)) { // obj.has(key)
        ....
    }
}

known products in conflict with old version pastry

mongoose
gmap api V3

more? please let me know.