JSFiddle - React, Tailwind, and code Playground

by Stev Peifer

HTML

<div id="test"></div>

JavaScript

(
        function($){
                $.fn.map=function(option){
                    //~ Create objects and default options
                    console.log(option);
                        var _this=$.extend({},this),
                            defaultOption={
                                'borderRadius':3,
                                'caption':'',
                                'height':'',
                                'showCoord':false,
                                'width':'',
                                'x':'',
                                'y':''
                            },
                            memory=new Object(),
                            option=$.extend({},defaultOption,option);
                    //~ Check and throw errors for invalid options
                        if(isNaN(option.borderRadius=parseInt(option.borderRadius)))
                            $.error('$.map() - Unexpected value specified for option: borderRadius.');
                        if(typeof option.caption!='string'&&typeof option.caption!='number')
                            $.error('$.map() - Unexpected value specified for option: caption.');
                        if(isNaN(option.height=(parseInt(option.height)||this.height())))
                            $.error('$.map() - Unexpected value specified for option: height.');
                        if(typeof option.showCoord!='boolean')
                            $.error('$.map() - Unexpected value specified for option: showCoord.');
                        if(isNaN(option.width=(parseInt(option.width)||this.width())))
                            $.error('$.map() - Unexpected value specified for option: width.');
                        if(typeof option.x=='undefined'||isNaN(option.x=parseInt(option.x)))
                            $.error('$.map() - Unexpected value specified for option: x.');
                        if(typeof option.y=='undefined'||isNaN(option.y=parseInt(option.y)))
            ...