Git Product home page Git Product logo

object.reduce's Introduction

object.reduce NPM version NPM monthly downloads Linux Build Status

Reduces an object to a value that is the accumulated result of running each property in the object through a callback.

Install

Install with npm:

$ npm install --save object.reduce

Install with yarn:

$ yarn add object.reduce

Install with bower

$ bower install object.reduce --save

Usage

the initial value (or value from the previous callback call), the value of the current property, the key of the current property, and the object over which the function is iterating. Node.js/JavaScript utility.)_

Params

  • object {Object}: The object to iterate over (the iteratee)
  • fn {Function}: The function invoked per iteration.
  • init {Object}: The initial value to use for the accumulator.
  • thisArg {Object}: (optional) Object to use as the invocation context for the iterator (expose as this inside the iterator)

Executes the given callback fn once for each own enumerable property in the object. The callback receives the following arguments:

  • acc: the initial value (or value from the previous callback call),
  • value: the of the current property,
  • key: the of the current property, and
  • the original object over which the function is iterating.

Example

var reduce = require('object.reduce');
var a = {a: 'foo', b: 'bar', c: 'baz'};

reduce(a, function(acc, value, key, obj) {
  acc[key] = value.toUpperCase();
  return acc;
}, {});

//=> {a: 'FOO', b: 'BAR', c: 'BAZ'};

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.5.0, on April 17, 2017.

object.reduce's People

Contributors

jonschlinkert avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

object.reduce's Issues

Open questions

I think it would be cool to use some of the obect.* and other microlibs you've created; however, I have some open questions that really effect my decisions:

  1. Can you commit to supporting node 0.10 and 0.12 for a year+ for the modules? This is a big deal for me because that is the projection seldo made on twitter for node 0.10 usage.
  2. How do you feel about a "neutral ground" for the modules I pull into the gulp tree? You've typically been a great maintainer on the modules we've used, but I've recently been burnt by the BDFL model.
  3. Can you add Windows testing? It's something I'm trying to get added in many places, even if the OS doesn't effect the module specifically.
  4. Are you open to Major bumping everything below 1.0? I really want to get everything 1.0+ to really benefit from semver.

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.