anorgatarrak-wordpress-theme/node_modules/underscore.string/truncate.js

9 lines
273 B
JavaScript

var makeString = require('./helper/makeString');
module.exports = function truncate(str, length, truncateStr) {
str = makeString(str);
truncateStr = truncateStr || '...';
length = ~~length;
return str.length > length ? str.slice(0, length) + truncateStr : str;
};