JSFiddle - React, Tailwind, and code Playground

by wiktor_stribizew

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  <BODY>
    <p>
       The code is borrowed from https://ru.stackoverflow.com/questions/245209 and https://www.npmjs.com/package/to-regex-range library
    </p>
    <INPUT id="rangeLeft" value=1 /> - <INPUT id="rangeRight" value=365 />
    <BR/>
    <BUTTON id="run">Generate</BUTTON>
    <PRE id="result" ></PRE>
    <BUTTON id="test">Check</BUTTON>
  </BODY>

CSS

#test { display:none }

JavaScript

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).toRegexRange=e()}}(function(){return function(){return function e(t,n,r){function i(u,a){if(!n[u]){if(!t[u]){var s="function"==typeof require&&require;if(!a&&s)return s(u,!0);if(o)return o(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[u]={exports:{}};t[u][0].call(f.exports,function(e){return i(t[u][1][e]||e)},f,f.exports,e,t,n,r)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;u<r.length;u++)i(r[u]);return i}}()({1:[function(e,t,n){"use strict";const r=e("is-number"),i=(e,t,n)=>{if(!1===r(e))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===t||e===t)return String(e);if(!1===r(t))throw new TypeError("toRegexRange: expected the second argument to be a number.");let o={relaxZeros:!0,...n};"boolean"==typeof o.strictZeros&&(o.relaxZeros=!1===o.strictZeros);let s=e+":"+t+"="+String(o.relaxZeros)+String(o.shorthand)+String(o.capture)+String(o.wrap);if(i.cache.hasOwnProperty(s))return i.cache[s].result;let c=Math.min(e,t),f=Math.max(e,t);if(1===Math.abs(c-f)){let n=e+"|"+t;return o.capture?`(${n})`:!1===o.wrap?n:`(?:${n})`}let l=h(e)||h(t),d={min:e,max:t,a:c,b:f},p=[],g=[];if(l&&(d.isPadded=l,d.maxLen=String(d.max).length),c<0){g=u(f<0?Math.abs(f):1,Math.abs(c),d,o),c=d.a=0}return f>=0&&(p=u(c,f,d,o)),d.negatives=g,d.positives=p,d.result=function(e,t,n){let r=a(e,t,"-",!1,n)||[],i=a(t,e,"",!1,n)||[],o=a(e,t,"-?",!0,n)||[];return r.concat(o).concat(i).join("|")}(g,p,o),!0===o.capture?d.result=`(${d.result})`:!1!==o.wrap&&p.length+g.length>1&&(d.result=`(?:${d.result})`),i.cache[s]=d,d.result};function o(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=function(e,t){let n=[];for(let...