Skip to content

Commit

Permalink
v0.0.5 released
Browse files Browse the repository at this point in the history
Added:
- jQuery object support (e.g.: $(selector).jExtract(struct); )
- support string as parent (e.g.: jExtract(struct, "<div>some text</div>"); )
- short name for jExtract function: $E (e.g.: $E(struct, parent); )
  • Loading branch information
Mikhail Kormanowsky authored Jan 5, 2018
1 parent ff7f2a5 commit a7788a5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion jextract.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ function jExtract(struct, parent) {
if(!isNaN(parseFloat(str)) || leaveNaN) return parseFloat(str);
return 0;
};

//Since v0.0.5: allow extracting from string
if(isString(parent)){
return jExtract(struct, $('<div>' + parent + '</div>'));
}else
//Start our loop
$.each(struct, function (i, e) {
//Recursion :)
Expand Down Expand Up @@ -174,3 +177,12 @@ function jExtract(struct, parent) {
//Return structure filled in with data
return result;
}

/** Since v0.0.5: allow extracting from element using jQuery */

jQuery.fn.jExtract = function(struct){
return jExtract(struct, $(this));
}

/** Since v0.0.5: a short name for jExtract: $E */
$E = jExtract;
2 changes: 1 addition & 1 deletion jextract.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a7788a5

Please sign in to comment.