Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Rename fuse.Array#inject to a more standard name of reduce.

#116

The inject method behavior is very close to the standard Array method of reduce. We should rename this method to follow the standard name and behavior.

MDC Array#reduce: https://developer.mozilla.org/en/JavaScript/Reference/Global_Object...

Reported by Joe Gornick · March 4th, 2011 @ 12:37 AM

State: new
Milestone: none
Assigned to: Joe Gornick Joe Gornick

Activity

  1. Joe Gornick
  2. Kit Goncharov
    Kit Goncharov

    Agreed. I think the API for Array#inject is more intuitive than Array#reduce, but that's probably because I've used the former so often in Ruby. We can probably relegate the current inject implementation to the Prototype emulation layer.

    March 4th, 2011 @ 11:43 PM

  3. Joe Gornick
    Joe Gornick

    Kit, I think you may have read this incorrectly. We are looking to rename inject -> reduce and follow the behavior as described in spec.

    March 4th, 2011 @ 11:52 PM

  4. Kit Goncharov
    Kit Goncharov

    Sorry, allow me to clarify. I know we want to rename inject to reduce and make it spec-compliant, but wouldn't we'd still need to implement inject in the emulation layer?

    March 4th, 2011 @ 11:56 PM

  5. Joe Gornick
    Joe Gornick

    Oh, I get it now! Yes, you are correct about implementing a custom inject in the Prototype emulator.

    March 4th, 2011 @ 11:57 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.