erasaur / meteor-lodash Goto Github PK
View Code? Open in Web Editor NEWMeteor Wrapper for Lo-Dash
Home Page: https://atmospherejs.com/erasaur/meteor-lodash
License: Other
Meteor Wrapper for Lo-Dash
Home Page: https://atmospherejs.com/erasaur/meteor-lodash
License: Other
The following code which should show a
instead shows global this (e.g. Window).
var self = "a";
lodash.forEach([1], function() {
console.log(this);
}, self);
I inspected the definition of lodash.forEach via a script tag, then I found the following definition.
/** // 1
* @license // 2
* lodash 3.10.1 <https://lodash.com/> // 3
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> // 4
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> // 5
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors // 6
* Available under MIT license <https://lodash.com/license> // 7
*/ // 8
... snip ...
function forEach(collection, iteratee) { // 5987
return (typeof iteratee == 'function' && isArray(collection)) // 5988
? arrayEach(collection, iteratee) // 5989
: baseEach(collection, toFunction(iteratee)); // 5990
} // 5991
The above code seems not to be included in https://github.com/lodash/lodash/blob/master/lodash.js.
So I'm confusing. I'm not sure about where I should report this issue ... anyway I report it to you.
This package includes css files in '\lodash\vendor\firebug-lite\skin\xp'
specifically 'firebug-1.3a2.css'
includes rules for body and html that leads to unexpected behavior. Is there a particular reason for including the vendor skins?
The specific rule
html, body {
margin: 0;
padding: 0;
overflow: hidden;
}
body {
font-family: Lucida Grande, Tahoma, sans-serif;
font-size: 11px;
background: #fff;
}
If I add your project, and open a console in my meteor app:
lodash.VERSION
"3.3.0"
_.VERSION
"1.5.2"
Hi,
Is there a way to not overwrite the _ of underscore package ?
I just want lodash calling lodash, and still use underscore calling _
Is it possible with your wrapper ?
Thanks
Lodash 3.2 is out, can you update ?
Seems the version of lodash is pretty out-dated .. any plans of updating this at all?
May I convince you to try rocket:module
? It will share your lodash from NPM with all the Meteor packages of a given Meteor application at the same time so you don't have to wrap lodash from NPM inside of your meteor-lodash package.
This reduces the amount of maintenance that you need to do to publish new versions of lodash by 100%, while affording other Meteor package developers the freedom to use other NPM packages that may also depend on lodash from NPM.
There's no way you'd want to wrap all the NPM packages that depend on lodash from NPM into your meteor-lodash package.
rocket:module
allows for Meteor packages to get and share external libraries from NPM, avoiding the pollution of the Atmosphere caused by Meteor packages that depend on the same NPM packages. Meteor's default behavior is to compile, save, and store an NPM package into each Meteor package during publication of the Meteor packages onto Atmosphere.
For example, if 10 Meteor packages in your application depend on 10 libraries from NPM, and those 10 NPM libraries all depend on React from NPM, then your application now has 10 copies of the React library...
That's 10 singleton React objects in your application.
React isn't meant to be used that way. That's way worse than having 10 versions of jQuery in the same application: $
, $1
, $2
, $3
, $4
, $5
, $6
, $7
, $8
, $9
, and $10
.
To help the cause, use rocket:module
to specify all your NPM dependencies. Once you've done that, rocket:module
will handle the sharing of those NPM modules across your app's Meteor packages.
... still possible for
_
to be redefiend asunderscore
...
"A wrapper for Lo-Dash v3.1.0, a utility library built on top of Underscore.js."
implies that lodash uses underscore, rather than replaces it. It might be clearer if it was changed to something like:
"A wrapper for Lo-Dash v3.1.0, a replacement for the Underscore.js utility library."
I used underscore
in my app.
And now I want to try lodash
.
Its conflict or not (I use _
keyword for underscore
and lodash
keyword for lodash
?
Hey,
In the discussion of "Investigate swapping underscore with Lo-dash in meteor", it's mentioned that meteor doesn't touch the existing underscore version because it may introduce bugs.
Though overriding _ is intended as the package exports an _, but it doesn't work and I think that's why everything is working correctly, else things could break if meteor code started to use lodash.
So for safety, I think recommended way to include lodash should be just declaring var _ = lodash
in your js files , so the declaration is limited to file scope and that way you get to use lodash and meteor code gets to use underscore.
Thoughts?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.