Skip to content

Instantly share code, notes, and snippets.

View abidulrmdn's full-sized avatar

Abidul abidulrmdn

View GitHub Profile
@drozdzynski
drozdzynski / Str.js
Last active July 6, 2021 08:48
Laravel 5 slug function port to JavaScript
export default class Str {
static slug(value, sep) {
var separator = sep || '-';
value = Str.ascii(value);
var flip = separator == '-' ? '_' : '-';
value = value.replace(new RegExp(Str.pregQuote(flip), 'g'), separator);