Comments (6)
probably so. ramda
is probably less likely to collide, but R
sure is easier to write. Also, this is really only an issue in a browser environment, AFAICT.
@CrossEye, your thoughts?
from ramda.
We can consider it.
I'm not convinced either way. R
is of course more likely to conflict with someone else's name. But it is easier to type. I tend to use it like this, so neither matters much to me:
var sillyUntestedModule = (function(R) {
var map = R.map, foldl = R.foldl, prop = R.prop, add = R.add, divide = R.divide, fork = R.fork;
// now I use the names unprefixed:
var sum = foldl(add, 0);
return {
incrementAll: map(add(1)),
average: fork(divide, sum, prop('length'))
};
}(ramda));
from ramda.
I'm currently using it wrapped as an AngularJS module and injecting it in controllers as _
(an underscore) as i like not having too much visual content before the function name but i do want everything inside of a "namespace". I took that from libraries like Underscore.js and LoDash which also provide similar functionalities to Ramda, so i think it was a good pick. I think that it's ok to use a longer descriptive name for when you're not using any kind of module system (AMD/CommonJS) to avoid collisions and in that case you can simply assign R = ramda
, though i highly recommend you use some kind of dependency/module system, even on the most basic setup.
from ramda.
do you have a url of your project, or is it not public? I am interested to see how someone other than me and scott uses the lib.
from ramda.
It's a private project, but i can show you the Angular module wrapper:
angular
.module('ramda', [])
.factory('ramda', ['$window', function ($window) {
return $window.ramda;
}]);
And this is an example of how i use it elsewhere (specially in services):
angular
.module('myservice', ['ramda'])
.service('myService', ['ramda', function(_) {
/*
* Returns an array of unique advertisers from a list of lines.
*
* @param {array} lines The list of lines to get advertisers from.
* @returns {array}
*/
this.getSortedUniqueAdvertisers = _.compose(
_.sort(_.gt),
_.filter(_.not(_.isEmpty)),
_.uniq,
_.map(function(item) { return item.data.advertiser.value; })
);
}]);
from ramda.
I think we can leave the name ramda
for now. We can revisit this in a few weeks if desired.
from ramda.
Related Issues (20)
- `reduce` with partial application caches results? HOT 1
- Ramda `0.28.0` contains CWE-843 and CWE-915 HOT 1
- assocPath number path with undefined value expect array but got object HOT 1
- clone new Array(number); HOT 4
- v0.29.0 released HOT 19
- Documentation errors in R.swap examples HOT 2
- 0.29.0 Upgrade Guide HOT 14
- Example with R.find() does not work HOT 3
- `is` implementation can not pass leetcode testing HOT 7
- pathEq types are not consistent with the code in 0.29.0 HOT 5
- Cannot update a nested map via R.modifyPath HOT 2
- R.find and R.propEq HOT 2
- Version exported subfolders HOT 2
- Compose type definitions
- propEq documentation error HOT 4
- [Bug] groupBy result keys order when 0 as first character HOT 6
- R.pipe(R.tryCatch, ...) anomaly HOT 12
- clone does not clone error instance HOT 2
- swap does not work as intended
- Ramda is 3x slower because it uses the arguments object? HOT 10
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 ramda.