JavaScript to Chunks
This week I’ve published a JavaScript module that chunks input string into array based on RegExp, which functions for either Web Browser or NodeJS based projects.
Check the documentation for detailed getting started and usage instructions, the source code is available on GitHub, and a live demo is hosted by GitHub Pages.
Example NodeJS Usage
const toChunks = require('to-chunks');
const input = '1.15.4-2Beta';
const regular_expression = new RegExp('\\.|-|[a-zA-Z]+');
const chunks = toChunks(input, regular_expression);
console.log(chunks);
//> ['1', '.', '15', '.', '4', '-', '2', 'Beta']