readme.markdown #1

  • //
  • guest/
  • perforce_software/
  • helix-web-services/
  • main/
  • source/
  • client-javascript/
  • node_modules/
  • array-reduce/
  • readme.markdown
  • Markdown
  • View
  • Commits
  • Open Download .zip Download (851 B)

array-reduce

[].reduce() for old browsers

testling badge

build status

example

var reduce = require('array-reduce');
var xs = [ 1, 2, 3, 4 ];
var sum = reduce(xs, function (acc, x) { return acc + x }, 0);
console.log(sum);

output:

10

methods

var reduce = require('array-reduce')

var res = reduce(xs, f, init)

Create a result res by folding acc = f(acc, xs[i], i) over each element in the array xs at element i. If init is given, the first acc value is init, otherwise xs[0] is used.

install

With npm do:

npm install array-reduce

license

MIT

# array-reduce

`[].reduce()` for old browsers

[![testling badge](https://ci.testling.com/substack/array-reduce.png)](https://ci.testling.com/substack/array-reduce)

[![build status](https://secure.travis-ci.org/substack/array-reduce.png)](http://travis-ci.org/substack/array-reduce)

# example

```
var reduce = require('array-reduce');
var xs = [ 1, 2, 3, 4 ];
var sum = reduce(xs, function (acc, x) { return acc + x }, 0);
console.log(sum);
```

output:

```
10
```

# methods

``` js
var reduce = require('array-reduce')
```

## var res = reduce(xs, f, init)

Create a result `res` by folding `acc = f(acc, xs[i], i)` over each element in
the array `xs` at element `i`. If `init` is given, the first `acc` value is
`init`, otherwise `xs[0]` is used.

# install

With [npm](https://npmjs.org) do:

```
npm install array-reduce
```

# license

MIT
# Change User Description Committed
#1 19553 swellard Move and rename clients
//guest/perforce_software/helix-web-services/main/source/clients/2016.1.0/javascript/node_modules/array-reduce/readme.markdown
#1 18810 tjuricek First-pass at JavaScript client SDK.

JavaScript requires Node with Gulp to "browserfy" the library. It's the easiest way I found to use the swagger-js project; bundle up a wrapping method.

There is no JavaScript reference guide. The swagger-js doesn't really document what they do very well, actually.

Overall I'm not particularly impressed by swagger-js, it was hard to even figure out what the right method syntax was. We may want to invest time in doing it better.

This required setting CORS response headers, which are currently defaulted to a fairly insecure setting.