Skip to content

Commit f75e27e

Browse files
committed
Add documentation to latest functions
1 parent d4626a4 commit f75e27e

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

jBUtil.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,15 @@
296296
}
297297
});
298298
};
299-
300-
/**
299+
300+
/**
301301
* Improved xhr call function, reduce some annoying configs and code required by
302302
* the original version (based on Promise)
303303
*
304304
* @param {object} para
305305
* @returns Promise the promise to fetch the result
306-
*/
307-
_jB.prototype.promiseFetch = function (para) {
306+
*/
307+
_jB.prototype.promiseFetch = function (para) {
308308
let defaultParams = {
309309
timeout: false,
310310
data: {},
@@ -317,7 +317,7 @@
317317
msg: ""
318318
};
319319
let params = jB.extend({}, defaultParams, para);
320-
if (params.call === undefined || params.call === '') {
320+
if (params.call === undefined || params.call === '') {
321321
console.error('jB.fetch: "call" parameter is not defined!');
322322
return;
323323
}
@@ -798,9 +798,18 @@
798798
//**************************************************************************
799799
// private methods - centralized functions
800800

801+
/**
802+
* Creates an input recoursivelly, if the value is atom just add one input,
803+
* if iterable creates recoursivelly one input for each child
804+
*
805+
* @param {string} key name of the key
806+
* @param {mixed} value the value(s)
807+
* @param {type} form the form node to insert the inputs
808+
* @returns {undefined}
809+
*/
801810
var _recoursiveCallInput = function (key, value, form) {
802811
if (value instanceof Array || typeof value === 'object') {
803-
for(let paramSubkey in value){
812+
for (let paramSubkey in value) {
804813
_recoursiveCallInput(key + "[" + paramSubkey + "]", value[paramSubkey], form);
805814
}
806815
} else {
@@ -825,15 +834,15 @@
825834
/**
826835
* Sanitize url, return url whithout any "undesired" stuff (particular chars ..)
827836
*
828-
* @param {strinf} url the url to sanitize
837+
* @param {string} url the url to sanitize
829838
* @returns {object} the response canatinig the following keys
830839
* - sanitized - what you're looking for, the sanitized url
831840
* - warning - true if the sanitize function found some "undesired" stuff
832841
*/
833842
var _sanitizeUrl = function (url) {
834843
var sanitizedMatch = url.match(/^(.*?[a-zA-Z0-9_\/])(([$&+,:;=?@<>#%][^\/]*)?)$/);
835-
if(sanitizedMatch === null){
836-
if (!this.config.silentMode) {
844+
if (sanitizedMatch === null) {
845+
if (!this.config.silentMode) {
837846
console.warn("jB: Current Url seems to be un-parsable");
838847
}
839848
}

0 commit comments

Comments
 (0)