Giter VIP home page Giter VIP logo

Comments (6)

buzzdecafe avatar buzzdecafe commented on June 7, 2024

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.

CrossEye avatar CrossEye commented on June 7, 2024

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.

alejandroiglesias avatar alejandroiglesias commented on June 7, 2024

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.

buzzdecafe avatar buzzdecafe commented on June 7, 2024

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.

alejandroiglesias avatar alejandroiglesias commented on June 7, 2024

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.

CrossEye avatar CrossEye commented on June 7, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.