prototype.exe 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/prototype.js +11 -11
package/package.json
CHANGED
package/src/prototype.js
CHANGED
|
@@ -185,17 +185,17 @@ Define (String.prototype, "join", function (string) { return this + string; });
|
|
|
185
185
|
Define (String.prototype, "shuffle", function () { return this.split ("").shuffle ().join (""); });
|
|
186
186
|
Define (String.prototype, "to_normalize", function () { return this.normalize ("NFD").replace (/[\u0300-\u036f]/g, ""); });
|
|
187
187
|
Define (String.prototype, "slugify", function () {
|
|
188
|
-
var slug = [];
|
|
189
|
-
var char = String.char.alpha.numeric.split ("");
|
|
190
|
-
var normalize = this.to_normalize ();
|
|
191
|
-
for (var i in normalize) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
var slugify = slug.join ("").toLowerCase ().split ("--").join ("-").split ("--").join ("-").split ("--").join ("-");
|
|
196
|
-
if (slugify.endsWith ("-")) return slugify.slice (0, (- 1));
|
|
197
|
-
else return slugify;
|
|
198
|
-
});
|
|
188
|
+
var slug = [];
|
|
189
|
+
var char = String.char.alpha.numeric.split ("");
|
|
190
|
+
var normalize = this.to_normalize ();
|
|
191
|
+
for (var i in normalize) {
|
|
192
|
+
if (char.includes (normalize [i])) slug.push (normalize [i]);
|
|
193
|
+
else slug.push ("-");
|
|
194
|
+
}
|
|
195
|
+
var slugify = slug.join ("").toLowerCase ().split ("--").join ("-").split ("--").join ("-").split ("--").join ("-");
|
|
196
|
+
if (slugify.endsWith ("-")) return slugify.slice (0, (- 1));
|
|
197
|
+
else return slugify;
|
|
198
|
+
});
|
|
199
199
|
|
|
200
200
|
Define (String, "char", function () {});
|
|
201
201
|
Define (String.char, "small", "abcdefghijklmnopqrstuvwxyz");
|