dotfiles/.vscode/extensions/saviorisdead.RustyCode-0.18.0/node_modules/underscore.string/chop.js

7 lines
192 B
JavaScript
Raw Normal View History

2016-09-11 09:29:13 +01:00
module.exports = function chop(str, step) {
if (str == null) return [];
str = String(str);
step = ~~step;
return step > 0 ? str.match(new RegExp('.{1,' + step + '}', 'g')) : [str];
};