
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
ndarray-string
Advanced tools
Turns a string into an ndarray
var ndstring = require("ndarray-string")
var x = ndstring("foobar", [2,3])
console.log(ndstring.toString(x))
["foo", "bar"]
We can also do fancier stuff. For example, here are all rotations of "banana"
var y = ndstring("bananabanana", [6,6], [1,1])
console.log(ndstring.toString(y))
[ 'banana', 'ananab', 'nanaba', 'anaban', 'nabana', 'abanan' ]
Install using npm:
npm install ndarray-string
var ndstring = require("ndarray-string")
ndstring(str[, shape, stride, offset])
Constructs an ndarray view of str. The values of the ndarray are the full unicode code points of str
. The resulting ndarray is a view of a 32 bit unsigned int typed array.
str
is the string which gets turned into an ndarrayshape
is the shape of the resulting ndarraystride
is the stride of the ndarrayoffset
is the offsetReturns An ndarray view of the code points of str
ndstring.toString(arr)
Turns an ndarray view of a string into an array of strings.
arr
is an ndarray view of a string, for example created using the above methodReturns An array of native arrays of strings, with the strings corresponding to the last dimension of the input array (so if the input has only one dimension, only a string is returned).
(c) 2013 Mikola Lysenko. MIT License
FAQs
ndarray views of strings
We found that ndarray-string demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.