MCPcopy Create free account
hub / github.com/babel/babel / p

Function p

Makefile.js:28–28  ·  view source on GitHub ↗
(e,t,r)

Source from the content-addressed store, hash-verified

26 * Copyright (c) 2015-present, Jon Schlinkert.
27 * Released under the MIT License.
28 */function et(){if($e)return Ne;$e=1;const e=Je(),t=(r,i,s)=>{if(!1===e(r))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===i||r===i)return String(r);if(!1===e(i))throw new TypeError("toRegexRange: expected the second argument to be a number.");let a={relaxZeros:!0,...s};"boolean"==typeof a.strictZeros&&(a.relaxZeros=!1===a.strictZeros);let c=r+":"+i+"="+String(a.relaxZeros)+String(a.shorthand)+String(a.capture)+String(a.wrap);if(t.cache.hasOwnProperty(c))return t.cache[c].result;let l=Math.min(r,i),u=Math.max(r,i);if(1===Math.abs(l-u)){let e=r+"|"+i;return a.capture?`(${e})`:!1===a.wrap?e:`(?:${e})`}let p=d(r)||d(i),f={min:r,max:i,a:l,b:u},m=[],h=[];if(p&&(f.isPadded=p,f.maxLen=String(f.max).length),l<0){h=n(u<0?Math.abs(u):1,Math.abs(l),f,a),l=f.a=0}return u>=0&&(m=n(l,u,f,a)),f.negatives=h,f.positives=m,f.result=function(e,t){let r=o(e,t,"-",!1)||[],n=o(t,e,"",!1)||[],i=o(e,t,"-?",!0)||[];return r.concat(i).concat(n).join("|")}(h,m),!0===a.capture?f.result=`(${f.result})`:!1!==a.wrap&&m.length+h.length>1&&(f.result=`(?:${f.result})`),t.cache[c]=f,f.result};function r(e,t,r){if(e===t)return{pattern:e,count:[],digits:0};let n=function(e,t){let r=[];for(let n=0;n<e.length;n++)r.push([e[n],t[n]]);return r}(e,t),o=n.length,i="",s=0;for(let e=0;e<o;e++){let[t,r]=n[e];t===r?i+=t:"0"!==t||"9"!==r?i+=u(t,r):s++}return s&&(i+=!0===r.shorthand?"\\d":"[0-9]"),{pattern:i,count:[s],digits:o}}function n(e,t,n,o){let s,u=function(e,t){let r=1,n=1,o=a(e,r),s=new Set([t]);for(;e<=o&&o<=t;)s.add(o),r+=1,o=a(e,r);for(o=c(t+1,n)-1;e<o&&o<=t;)s.add(o),n+=1,o=c(t+1,n)-1;return s=[...s],s.sort(i),s}(e,t),d=[],f=e;for(let e=0;e<u.length;e++){let t=u[e],i=r(String(f),String(t),o),a="";n.isPadded||!s||s.pattern!==i.pattern?(n.isPadded&&(a=p(t,n,o)),i.string=a+i.pattern+l(i.count),d.push(i),f=t+1,s=i):(s.count.length>1&&s.count.pop(),s.count.push(i.count[0]),s.string=s.pattern+l(s.count),f=t+1)}return d}function o(e,t,r,n,o){let i=[];for(let o of e){let{string:e}=o;n||s(t,"string",e)||i.push(r+e),n&&s(t,"string",e)&&i.push(r+e)}return i}function i(e,t){return e>t?1:t>e?-1:0}function s(e,t,r){return e.some(e=>e[t]===r)}function a(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function c(e,t){return e-e%Math.pow(10,t)}function l(e){let[t=0,r=""]=e;return r||t>1?`{${t+(r?","+r:"")}}`:""}function u(e,t,r){return`[${e}${t-e===1?"":"-"}${t}]`}function d(e){return/^-?(0+)\d/.test(e)}function p(e,t,r){if(!t.isPadded)return e;let n=Math.abs(t.maxLen-String(e).length),o=!1!==r.relaxZeros;switch(n){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${n}}`:`0{${n}}`}}return t.cache={},t.clearCache=()=>t.cache={},Ne=t}
29/*!
30 * fill-range <https://github.com/jonschlinkert/fill-range>
31 *

Callers 11

nFunction · 0.70
mFunction · 0.70
dFunction · 0.70
concurrencyFunction · 0.70
tFunction · 0.70
hFunction · 0.70
TFunction · 0.70
efFunction · 0.70
Makefile.jsFile · 0.70
flushFunction · 0.70
ibFunction · 0.70

Calls 12

mapMethod · 0.80
releaseMethod · 0.80
emptyMethod · 0.80
dFunction · 0.70
lFunction · 0.70
uFunction · 0.70
iFunction · 0.70
oFunction · 0.70
callMethod · 0.65
pushMethod · 0.45
testMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected