Giter Site home page Giter Site logo

vgrichina / functional.js Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 2.0 104 KB

Unofficial GitHub repo for http://osteele.com/sources/javascript/functional/ by Oliver Steele

Home Page: http://osteele.com/sources/javascript/functional/

License: MIT License

Ruby 1.57% JavaScript 98.43%

functional.js's Introduction

Functional defines higher-order methods and functions for functional
and function-level programming.  It also defines "string lambdas",
that allow strings such as `x+1` and `x -> x+1` to be used in some
contexts as functions.

It is licensed under the MIT License.

For more details, see http://osteele.com/javascripts/functional .

Credits:
- Oliver Steele -- primary author
- Dean Edwards -- Array.slice suggestion
- henrah -- Function.lambda memoization
- Raganwald -- Rhino compatibility

functional.js's People

Contributors

vgrichina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

functional.js's Issues

BUG

String.prototype.toFunction = function() {
      var body = this;
          if (body.match(/\breturn\b/))
                return new Function(this); //<= bug is here
         return this.lambda();
     }

Above will obviously not generate any arguments required.

     "return x * y".toFunction()
     // wil generate
    function anonymous () { return x * y }  

I never understood why is this not just:

  String.prototype.toFunction = function() {
         return this.lambda();
  }

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.