Git Product home page Git Product logo

augment.js's People

Contributors

jdonaldson10 avatar nickjs avatar olivernn avatar wallin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

augment.js's Issues

Can we add string.include method?

As described here Mozila doc, there's a method string.includes to check whether a string contains searchString or not.


if (!String.prototype.includes) {
  String.prototype.includes = function(search, start) {
    'use strict';
    if (typeof start !== 'number') {
      start = 0;
    }

    if (start + search.length > this.length) {
      return false;
    } else {
      return this.indexOf(search, start) !== -1;
    }
  };
}

We should also add this in augment.js

ES5 bind

bound = function () {
    return self.apply( nop.prototype && this instanceof nop ? this : ( obj || {} ),
        args.concat( slice.call(arguments) ) );
};

http://es5.github.com/#x15.3.4.5

Set the [[Construct]] internal property of F as described in 15.3.4.5.2.

http://es5.github.com/#x15.3.4.5.2

Return the result of calling the [[Construct]] internal method oftarget providing args as the arguments.

http://es5.github.com/#x13.2.2

Return obj.

Basically your code always returns the return value of the bound function and doesn't handle cases like

new ( (function () {
  return undefined;
}).bind(lulz, args) ) !== undefined;

Here the return value of invoking new (and [[Construct]]) on the bound function should be that the new instance is returned, not the return value of the bound function.

Again see es5-shim for implementation.

Potential edge case bugs

https://gist.github.com/1120592

Lists a bunch of bugs that are in various implementations of ES5 shims. You may want to thoroughly check yours does not fail any.

For example

String#trim

using buggy character class \s instead of explicitly defining whitespace/line terminators

Note that \s fails in IE sometimes (because IE, rage.)

Suggestion

Object.create is that much used now but certainly it is important to have i think - checkout: http://javascript.crockford.com/prototypal.html . Also in this bundle may be provided JSON.parse and JSON.stringify for completeness.

Regards,
Daniel

P.S. i'm not a ruby dev so it's hard for me to just send you pull request for those

Customisable build.

It should be easier to build a stripped down subset of augment, including only the methods that you want to polyfill.

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.