prototype.exe 0.0.5 → 0.0.7

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 +7 -8
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prototype.exe",
3
3
  "description": "JScript",
4
- "version": "0.0.5",
4
+ "version": "0.0.7",
5
5
  "main": "src/prototype.js",
6
6
  "files": [
7
7
  "src/",
package/src/prototype.js CHANGED
@@ -61,10 +61,9 @@ Define (Object.type_of, "regex", function (input) { if (arguments.length) return
61
61
  Define (Object.type_of, "string", function (input) { if (arguments.length) return Object.type_of (input) === "[object String]"; else return "[object String]"; });
62
62
 
63
63
  Define (Object, "is", function () {});
64
- Define (Object.is, "url", function (url) {
65
- if (typeof url === "string") return url.startsWith ("http://") || url.startsWith ("https://") || url.startsWith ("//");
66
- else return false;
67
- });
64
+ Define (Object.is, "set", function (input) { return ! Object.un_set (input); });
65
+ Define (Object.is, "function", function (input) { return ["function", "object"].includes (input); });
66
+ Define (Object.is, "url", function (input) { if (typeof input === "string") return input.startsWith ("http://") || input.startsWith ("https://") || input.startsWith ("//"); else return false; });
68
67
  Define (Object.is, "ip", function (input) {
69
68
  var part = input.split (".");
70
69
  if (part.length === 4) {
@@ -83,7 +82,6 @@ Define (Object, "clone", function (object) { return JSON.parse (JSON.stringify (
83
82
 
84
83
  Define (Object, "un_define", function (input) { if (arguments.length) return input === undefined; else return undefined; });
85
84
  Define (Object, "un_set", function (input) { return input === undefined || input === null; });
86
- Define (Object.is, "set", function (input) { return ! Object.un_set (input); });
87
85
 
88
86
  /**
89
87
  * array
@@ -824,6 +822,7 @@ Define (Function.theme, "is_night", function () { return window.matchMedia && wi
824
822
  Define (Function, "html", class {
825
823
  constructor () {
826
824
  this.markup = new Function.html.markup ("html");
825
+ this.context = {}
827
826
  this.var = {
828
827
  title: "Untitled",
829
828
  viewport: "width=device-width, initial-scale=1.0, maximum-scale=3.0, user-scalable=1",
@@ -835,8 +834,8 @@ Define (Function, "html", class {
835
834
  error: {},
836
835
  }
837
836
  }
838
- title (title) { if (Object.is.set (title)) this.var.title = title; return this.var.title; }
839
- description (description) { if (Object.is.set (description)) this.var.description = description; return this.var.description; }
837
+ title (title, context) { if (["function", "object"].includes (typeof title) && ! this.context.title && ["context", "format"].includes (title.name)) this.context.title = title; else if (arguments.length > 1 && this.context.title) return this.var.title = this.context.title (title, context); else if (Object.is.set (title)) this.var.title = title; return this.var.title; }
838
+ description (description, context) { if (["function", "object"].includes (typeof description) && ! this.context.description && ["context", "format"].includes (description.name)) this.context.description = description; else if (arguments.length > 1 && this.context.description) return this.var.description = this.context.description (description, context); else if (Object.is.set (description)) this.var.description = description; return this.var.description; }
840
839
  error (error) { if (error) this.var.error = error; return this.var.error; }
841
840
  get (key) { return this.var [key]; }
842
841
  set (key, value) {
@@ -1636,7 +1635,7 @@ Symbol.export = {
1636
1635
  define: Object.define, un_define: Object.un_define, un_set: Object.un_set,
1637
1636
  object: Object, array: Array, string: String, number: Number, function: Function,
1638
1637
  date: Date, time: Date.time, timeout: Date.timeout, datetime: new Date.io,
1639
- event: Event, promise: Promise, resolve: Promise.resolve, reject: Promise.reject,
1638
+ event: Event, promise: Promise, resolve: function () { return Promise.resolve (... arguments); }, reject: function () { return Promise.reject (... arguments); },
1640
1639
  url: URL, path: Function.path, file: Function.file, dir: Function.dir, http: Function.http,
1641
1640
  db: Function.db, database: Function.database,
1642
1641
  cookie: Function.cookie, session: Function.session, ls: Function.ls,