projects
/
gnome.introspection-doc-generator
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
generate gjs documentation, run under gjs
[gnome.introspection-doc-generator]
/
String.js
diff --git
a/String.js
b/String.js
index
d30b494
..
716803a
100755
(executable)
--- a/
String.js
+++ b/
String.js
@@
-8,16
+8,18
@@
* Fork - LGPL
* <script type="text/javascript">
*/
* Fork - LGPL
* <script type="text/javascript">
*/
+
// usage:
// Seed.include('String.js');
// usage:
// Seed.include('String.js');
-XObject = imports.XObject.XObject;
+
+const XObject = imports.XObject.XObject;
-XObject.extend(String,
+XObject.extend(String,
{
{
-
+
/** @scope String */
/** @scope String */
-
+
/**
* Escapes the passed string for ' and \
* @param {String} string The string to escape
/**
* Escapes the passed string for ' and \
* @param {String} string The string to escape
@@
-51,7
+53,8
@@
XObject.extend(String,
}
return result;
},
}
return result;
},
- /**
+
+ /**
* Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each
* token must be unique, and must increment in the format {0}, {1}, etc. Example usage:
* <pre><code>
* Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each
* token must be unique, and must increment in the format {0}, {1}, etc. Example usage:
* <pre><code>
@@
-71,7
+74,6
@@
XObject.extend(String,
return args[i];
});
},
return args[i];
});
},
-
/**
* Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each
/**
* Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each
@@
-93,7
+95,7
@@
XObject.extend(String,
return this.htmlEncode(args[i]);
});
},
return this.htmlEncode(args[i]);
});
},
-
+
/**
* Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages.
* @param {String} value The string to encode
/**
* Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages.
* @param {String} value The string to encode
@@
-104,8
+106,6
@@
XObject.extend(String,
String(value).replace(/&/g, "&"
).replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """);
}
String(value).replace(/&/g, "&"
).replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """);
}
-
-
}
);
}
);
@@
-125,35
+125,32
@@
XObject.extend(String,
* @param {String} other The new value to use if the string already equals the first value passed in
* @return {String} The new value
*/
* @param {String} other The new value to use if the string already equals the first value passed in
* @return {String} The new value
*/
-
+
XObject.extend(String.prototype, {
XObject.extend(String.prototype, {
-
+
toggle : function(value, other){
return this == value ? other : value;
},
toggle : function(value, other){
return this == value ? other : value;
},
-
+
trim : function (toTrim) {
var out = this.ltrim(toTrim);
out = out.rtrim(toTrim);
return out;
},
trim : function (toTrim) {
var out = this.ltrim(toTrim);
out = out.rtrim(toTrim);
return out;
},
-
+
ltrim : function (toTrim) {
if (this.substr(0, toTrim.length) == toTrim) {
return this.slice(toTrim.length);
}
ltrim : function (toTrim) {
if (this.substr(0, toTrim.length) == toTrim) {
return this.slice(toTrim.length);
}
-
+
return this;
},
return this;
},
-
+
rtrim : function (toTrim) {
if (this.substr(this.length - toTrim.length) == toTrim) {
return this.slice(0, this.length - toTrim.length);
}
rtrim : function (toTrim) {
if (this.substr(this.length - toTrim.length) == toTrim) {
return this.slice(0, this.length - toTrim.length);
}
-
+
return this;
}
return this;
}
-
-
-
-});
\ No newline at end of file
+});