Sha256: 161f24e38efc7d7f9c3ba408cc7bd7a68496c979f150beb52379d8a001dba03d

Contents?: true

Size: 438 Bytes

Versions: 5

Compression:

Stored size: 438 Bytes

Contents

function makeSlug(val, sep) { // code largely inspired by http://www.thewebsitetailor.com/jquery-slug-plugin/
	if (typeof sep == 'undefined') sep = '_';
	var alphaNumRegexp = new RegExp('[^a-zA-Z0-9\\' + sep + ']', 'g');	
	var avoidDuplicateRegexp = new RegExp('[\\' + sep + ']{2,}', 'g');
	val = val.replace(/\s/g, sep);
	val = val.replace(alphaNumRegexp, '');
	val = val.replace(avoidDuplicateRegexp, sep);
	return val.toLowerCase();
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
locomotive_cms-0.0.2.4 public/javascripts/admin/utils.js
locomotive_cms-0.0.2.3 public/javascripts/admin/utils.js
locomotive_cms-0.0.2.2 public/javascripts/admin/utils.js
locomotive_cms-0.0.2.1 public/javascripts/admin/utils.js
locomotive_cms-0.0.2 public/javascripts/admin/utils.js