Giter Club home page Giter Club logo

rubyfill's People

Contributors

quintin-reineccius avatar zackify avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rubyfill's Issues

Object.map causing errors in the browser and some tests

There's something weird going on with Object.map. It's causing the following error in Chrome:

Uncaught TypeError: Cannot assign to read only property 'map' of #<Object>

It looks like it's happening inside of React somewhere. Not sure if React defines this, or tries to assign to it?

It happens here:

/**
     * Executes the provided `callback` once for each enumerable own property in the
     * object and constructs a new object from the results. The `callback` is
     * invoked with three arguments:
     *
     *  - the property value
     *  - the property name
     *  - the object being traversed
     *
     * Properties that are added after the call to `mapObject` will not be visited
     * by `callback`. If the values of existing properties are changed, the value
     * passed to `callback` will be the value at the time `mapObject` visits them.
     * Properties that are deleted before being visited are not visited.
     *
     * @grep function objectMap()
     * @grep function objMap()
     *
     * @param {?object} object
     * @param {function} callback
     * @param {*} context
     * @return {?object}
     */
    function mapObject(object, callback, context) {
      if (!object) {
        return null;
      }
      var result = {};
      for (var name in object) {
        if (hasOwnProperty.call(object, name)) {
          result[name] = callback.call(context, object[name], name, object);
        }
      }
      return result;
    }

    module.exports = mapObject;

Add Object.merge

If Object.assign is available use this, otherwise make a polyfill and use that. @rampage1213

Add .blank

Object.keys(object).length for objects, you could figure the rest out ;) @rampage1213 i would definitely use this. Example:

let object = {name: 'z'}
object.blank -> false
let object = {}
object.blank -> true

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.