prototype.exe 0.0.13 → 0.0.15

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/prototype.js +12 -11
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prototype.exe",
3
3
  "description": "JScript",
4
- "version": "0.0.13",
4
+ "version": "0.0.15",
5
5
  "main": "src/prototype.js",
6
6
  "files": [
7
7
  "src/",
package/src/prototype.js CHANGED
@@ -64,6 +64,7 @@ Define (Object, "is", function () {});
64
64
  Define (Object.is, "set", function (input) { return ! Object.un_set (input); });
65
65
  Define (Object.is, "function", function (input) { return ["function", "object"].includes (input); });
66
66
  Define (Object.is, "url", function (input) { if (typeof input === "string") return input.startsWith ("http://") || input.startsWith ("https://") || input.startsWith ("//"); else return false; });
67
+ Define (Object.is, "hex", function (input) { return /^[0-9a-fA-F]+$/.test (input); });
67
68
  Define (Object.is, "ip", function (input) {
68
69
  var part = input.split (".");
69
70
  if (part.length === 4) {
@@ -185,17 +186,17 @@ Define (String.prototype, "join", function (string) { return this + string; });
185
186
  Define (String.prototype, "shuffle", function () { return this.split ("").shuffle ().join (""); });
186
187
  Define (String.prototype, "to_normalize", function () { return this.normalize ("NFD").replace (/[\u0300-\u036f]/g, ""); });
187
188
  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
- 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
- });
189
+ var slug = [];
190
+ var char = String.char.alpha.numeric.split ("");
191
+ var normalize = this.to_normalize ();
192
+ for (var i in normalize) {
193
+ if (char.includes (normalize [i])) slug.push (normalize [i]);
194
+ else slug.push ("-");
195
+ }
196
+ var slugify = slug.join ("").toLowerCase ().split ("--").join ("-").split ("--").join ("-").split ("--").join ("-");
197
+ if (slugify.endsWith ("-")) return slugify.slice (0, (- 1));
198
+ else return slugify;
199
+ });
199
200
 
200
201
  Define (String, "char", function () {});
201
202
  Define (String.char, "small", "abcdefghijklmnopqrstuvwxyz");