Socket
Book a DemoInstallSign in
Socket

ndarray-foreach

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ndarray-foreach

Scans an ndarray

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

ndarray-foreach

Loop over an ndarray, convenience method using cwise.

Install

npm i ndarray-foreach

Example

var ndarray = require('ndarray')
var ndforeach = require('ndarray-foreach')

var data = ndarray([
  0, 1, 2,
  3, 4, 5,
  6, 7, 8
], [3, 3])

ndforeach(data, function (i, a) {
  console.log(i, a)
})

Output:

[ 0, 0 ] 0
[ 0, 1 ] 1
[ 0, 2 ] 2
[ 1, 0 ] 3
[ 1, 1 ] 4
[ 1, 2 ] 5
[ 2, 0 ] 6
[ 2, 1 ] 7
[ 2, 2 ] 8

API

require('ndarray-foreach')(array, f(index, v))

Scans an ndarray.

  • array is an ndarray
  • f(index, v) is a visitor function

License

(c) 2017 Mikola Lysenko, MIT License

Keywords

ndarray

FAQs

Package last updated on 24 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts