Comments (9)
Thanks @dvv. We'll change it wherever we make that call. Do you know why a direct call to hasOwnProperty is not consistent?
from now.
Have no idea so far. I guess because obj.hasOwnProperty
itself can be overridden.
update: they use __hasProp = Object.prototype.hasOwnProperty
(notice prototype
)
update2: exactly because obj.hasOwnProperty
itself can be tainted/overridden
update3: this might be the reason why this change fixes the issue: there also exist objects which have no hasOwnProperty
in their prototype -- the most prominent is null
;)
from now.
Javascript is a silly language. I suppose this is something that should be changed. Iteration through objects is a mess in this language.
from now.
Sure. Two options: rely upon underscore, which is all about convenient iterations over "lists", normalizing hashes and arrays; or CS which has clean syntax for that ;) The third option is to very carefully code inline patterns, or reinvent own set of helpers -- this usually leads to nowhere in the long run.
from now.
@dvv Why not fork and write you own CoffeeScript version? Sounds like it's so easy and convenient that you'd be done in a few hours.
from now.
Of course not. I'm just trying to help biting problems I see. Plus, it will be useless unless it's accepted into the master. The whole point I'm asking whether CS source is feasible to have is to explore the field of your opinions. I'm not trying to force using CS in any way.
from now.
Thanks for both of your contributions guys. Dvv has been very polite in helping us out. More awareness of best practices can't hurt.
from now.
@dvv I have changed all obj.hasOwnProperty
to Object.hasOwnProperty.call
Is there a benefit of using Object.prototype.hasOwnProperty.call
vs Object.hasOwnProperty.call
??
from now.
Thanks!
I guess the latter costs one more hop along the prototype chain. They just teach us augmenting/mangling Object.prototype
is bad practice, so they assume Object.prototype.hasOwnProperty
is pristine in either case.
from now.
Related Issues (20)
- installation fail :( HOT 3
- Can not read the property of 'ressource' undefined HOT 1
- No dev in six months. What is the future of NowJS? HOT 13
- Now module Installation failed ..... throwing error in windows
- npm install now ..... throwing error HOT 1
- Not working with Dojo due to Socket.io-client
- Implementing chat module by using Nowjs HOT 6
- now.js and node autocluster core module
- Issue in limit of sending message in chat
- /nowjs/now.js ??
- website HOT 7
- Connecting to nodejs on http from https site HOT 1
- cannot finde module '../build/Release/nodeproxy.node'
- iOS app crashed in release mode while using Nowjs library
- Now doesn't work with latest sockets.io HOT 2
- Does not work with angular-cli: content.charCodeAt is not a function
- possible spam HOT 1
- Error: Cannot find module 'now' HOT 3
- Error: Cannot find module 'now'
- http://www.nowjs.com is not correct HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from now.