get-matrix-sums

Get matrix sums

Usage no npm install needed!

<script type="module">
  import getMatrixSums from 'https://cdn.skypack.dev/get-matrix-sums';
</script>

README

get-matrix-sums

Build Status

Installation

npm install get-matrix-sums --save

Syntax

getMatrixSums([
  [1, 1, 1],
  [1, 1, 1],
  [1, 1, 1]
]);

// [
//   [3,3,3] // Horizontal sums
//   [3,3,3] // Vertical sums
// ]

getMatrixSums([
  [1, 1, 1]
]);

// [
//   [3]     // Horizontal sums
//   [1,1,1] // Vertical sums
// ]

Tests

npm test

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

Release History

  • 1.1.0 Support for n !== m matrices
  • 1.0.0 First release