string-reduce

1.0.0 • Public • Published

string-reduce Build Status

Reduce a string to a value

Installation

npm i --save string-reduce

Usage

var reduce = require('string-reduce')
 
var sum = reduce('yolo', (sum, char) => {
  return sum + character.charCodeAt()
}, 0)
// sum: 451
 
var expectedSum = 0 +    
  'y'.charCodeAt(0) + // 121
  'o'.charCodeAt(0) + // 111
  'l'.charCodeAt(0) + // 108
  'o'.charCodeAt(0)   // 111
// expectedSum: 451

License

MIT

/string-reduce/

    Package Sidebar

    Install

    npm i string-reduce

    Weekly Downloads

    995

    Version

    1.0.0

    License

    ISC

    Last publish

    Collaborators

    • tjmehta