@untemps/utils 2.3.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.createElement=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tag,n=void 0===t?"div":t,d=e.attributes,o=void 0===d?{}:d,r=e.content,l=void 0===r?null:r,i=e.textContent,a=void 0===i?null:i,u=e.parent,c=void 0===u?null:u,v=e.parentSelector,p=void 0===v?null:v,s=document.createElement(n);for(var h in o)s.setAttribute(h,o[h]);l&&s.appendChild(l),a&&!s.hasChildNodes()&&s.appendChild(document.createTextNode(a));var m=c||document.querySelector(p);return m&&m.appendChild(s),s};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.createElement=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tag,n=void 0===t?"div":t,o=e.attributes,d=void 0===o?{}:o,i=e.content,l=void 0===i?null:i,r=e.textContent,u=void 0===r?null:r,a=e.parent,c=void 0===a?null:a,v=e.parentSelector,p=void 0===v?null:v,s=e.boundingClientRect,C=void 0===s?null:s,h=document.createElement(n);for(var g in d)h.setAttribute(g,d[g]);l&&h.appendChild(l),u&&!h.hasChildNodes()&&h.appendChild(document.createTextNode(u));var m=c||document.querySelector(p);return m&&m.appendChild(h),C&&(h.getBoundingClientRect=function(){return C}),h};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../isString-64f2a506.js");exports.modifyElement=function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r;for(var o in e.isString(r)&&(i=document.querySelector(r)),t){var n,u;if(void 0===t[o]||null===t[o])null===(n=i)||void 0===n||n.removeAttribute(o);else null===(u=i)||void 0===u||u.setAttribute(o,t[o])}return i};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../string/isString.js");exports.modifyElement=function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r;for(var n in e.isString(r)&&(i=document.querySelector(r)),t){var o,u;if(void 0===t[n]||null===t[n])null===(o=i)||void 0===o||o.removeAttribute(n);else null===(u=i)||void 0===u||u.setAttribute(n,t[n])}return i};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../isString-64f2a506.js");exports.removeElement=function(r){var t,o,i=r;return e.isString(r)&&(i=document.querySelector(r)),null===(t=i)||void 0===t||null===(o=t.parentNode)||void 0===o?void 0:o.removeChild(i)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../string/isString.js");exports.removeElement=function(r){var t,i,o=r;return e.isString(r)&&(o=document.querySelector(r)),null===(t=o)||void 0===t||null===(i=t.parentNode)||void 0===i?void 0:i.removeChild(o)};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../number/getRandomInteger.js"),r=require("../number/normalizeMinMax.js"),a=["year","learn","key","cook","crosswalk","script","chief","plan","meat","vague","demonstrator","dictionary","visible","bomber","variation","leader","channel","litigation","royalty","impulse","package","oppose","privilege","begin","operation","herd","hemisphere","incongruous","horror","pipe","start","vertical","worry","reform","unlike","exhibition","disagree","allow","patrol","combine","impress","invisible","cage","log","snow","undertake","division","ethics","damage","responsible"],i=function(e,a){var i=r.normalizeMinMax(Math.abs(e),Math.abs(a)),o=i.min,n=i.max,t=Math.max(o,1);return{min:t,max:Math.max(n,t)}};exports.generateText=function(){for(var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=r.minWords,n=void 0===o?10:o,t=r.maxWords,s=void 0===t?50:t,m=r.dictionary,l=void 0===m?a:m,c="",d=i(n,s),g=d.min,p=d.max,u=e.getRandomInteger(g,p),h=0;h<u;h++){var v=l[Math.floor(Math.random()*l.length)];c+="".concat(h>0?" ":"").concat(v)}return c};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./generateText.js");require("../number/getRandomInteger.js"),require("../number/normalizeMinMax.js");exports.generateTokenizedText=function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.tokens,n=void 0===r?[]:r,o=t.divider,i=void 0===o?"%":o,a=t.minWords,d=void 0===a?10:a,s=t.maxWords,h=void 0===s?50:s,l=t.dictionary,c=void 0===l?void 0:l,g=e.generateText({minWords:Math.max(d,n.length),maxWords:Math.max(h,n.length),dictionary:c}),m=g.split(" "),v=Math.max(Math.floor((m.length-n.length)/n.length),1),x=[],u=0;u<n.length;u++){var M=Math.floor(Math.random()*v)+v*u;m[M]="".concat(i).concat(n[u]).concat(i),x.push(M)}return{indices:x,text:m.join(" ")}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../lang/isNil.js"),n=function(e){var n=new RegExp("([\\[\\^\\$\\.|\\?\\*\\+\\(\\)])+","g");return e.replace(n,(function(e){return e.split("").map((function(e){return"\\"+e})).join("")}))},t=function(e){return Object.keys(e).reduce((function(e,n,t){return"".concat(e).concat(t>0?"|":"").concat(n)}),"")};exports.interpolate=function(r){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"%",i=n(o),u=t(c),a=new RegExp("".concat(i,"(").concat(u,")").concat(i),"g");return r.replace(a,(function(n,t){return e.isNil(c[t])?t:c[t]}))};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/construct"),t=require("@babel/runtime/helpers/toConsumableArray");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=r(e),a=r(t);exports.interpolateLiteral=function(e,t){return u.default(Function,a.default(Object.keys(t)).concat(["return `".concat(e,"`")])).apply(void 0,a.default(Object.values(t)))};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.isString=function(t){return"string"==typeof t||"[object String]"===Object.prototype.toString.call(t)};
@@ -1 +1 @@
1
- var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tag,n=void 0===t?"div":t,d=e.attributes,o=void 0===d?{}:d,r=e.content,i=void 0===r?null:r,l=e.textContent,a=void 0===l?null:l,u=e.parent,v=void 0===u?null:u,c=e.parentSelector,p=void 0===c?null:c,h=document.createElement(n);for(var C in o)h.setAttribute(C,o[C]);i&&h.appendChild(i),a&&!h.hasChildNodes()&&h.appendChild(document.createTextNode(a));var m=v||document.querySelector(p);return m&&m.appendChild(h),h};export{e as createElement};
1
+ var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tag,n=void 0===t?"div":t,d=e.attributes,o=void 0===d?{}:d,i=e.content,l=void 0===i?null:i,r=e.textContent,u=void 0===r?null:r,a=e.parent,v=void 0===a?null:a,c=e.parentSelector,p=void 0===c?null:c,C=e.boundingClientRect,h=void 0===C?null:C,g=document.createElement(n);for(var m in o)g.setAttribute(m,o[m]);l&&g.appendChild(l),u&&!g.hasChildNodes()&&g.appendChild(document.createTextNode(u));var s=v||document.querySelector(p);return s&&s.appendChild(g),h&&(g.getBoundingClientRect=function(){return h}),g};export{e as createElement};
@@ -1 +1 @@
1
- import{i as r}from"../isString-9ddfe24d.js";var e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e;for(var o in r(e)&&(i=document.querySelector(e)),t){var n,l;if(void 0===t[o]||null===t[o])null===(n=i)||void 0===n||n.removeAttribute(o);else null===(l=i)||void 0===l||l.setAttribute(o,t[o])}return i};export{e as modifyElement};
1
+ import{isString as r}from"../string/isString.js";var t=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t;for(var o in r(t)&&(i=document.querySelector(t)),e){var n,l;if(void 0===e[o]||null===e[o])null===(n=i)||void 0===n||n.removeAttribute(o);else null===(l=i)||void 0===l||l.setAttribute(o,e[o])}return i};export{t as modifyElement};
@@ -1 +1 @@
1
- import{i as r}from"../isString-9ddfe24d.js";var e=function(e){var o,d,i=e;return r(e)&&(i=document.querySelector(e)),null===(o=i)||void 0===o||null===(d=o.parentNode)||void 0===d?void 0:d.removeChild(i)};export{e as removeElement};
1
+ import{isString as r}from"../string/isString.js";var o=function(o){var e,i,n=o;return r(o)&&(n=document.querySelector(o)),null===(e=n)||void 0===e||null===(i=e.parentNode)||void 0===i?void 0:i.removeChild(n)};export{o as removeElement};
@@ -0,0 +1 @@
1
+ import{getRandomInteger as r}from"../number/getRandomInteger.js";import{normalizeMinMax as a}from"../number/normalizeMinMax.js";var e=["year","learn","key","cook","crosswalk","script","chief","plan","meat","vague","demonstrator","dictionary","visible","bomber","variation","leader","channel","litigation","royalty","impulse","package","oppose","privilege","begin","operation","herd","hemisphere","incongruous","horror","pipe","start","vertical","worry","reform","unlike","exhibition","disagree","allow","patrol","combine","impress","invisible","cage","log","snow","undertake","division","ethics","damage","responsible"],i=function(r,e){var i=a(Math.abs(r),Math.abs(e)),o=i.min,n=i.max,t=Math.max(o,1);return{min:t,max:Math.max(n,t)}},o=function(){for(var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=a.minWords,n=void 0===o?10:o,t=a.maxWords,m=void 0===t?50:t,s=a.dictionary,l=void 0===s?e:s,c="",d=i(n,m),p=d.min,h=d.max,v=r(p,h),g=0;g<v;g++){var b=l[Math.floor(Math.random()*l.length)];c+="".concat(g>0?" ":"").concat(b)}return c};export{o as generateText};
@@ -0,0 +1 @@
1
+ import{generateText as o}from"./generateText.js";import"../number/getRandomInteger.js";import"../number/normalizeMinMax.js";var t=function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.tokens,r=void 0===n?[]:n,i=t.divider,a=void 0===i?"%":i,e=t.minWords,d=void 0===e?10:e,m=t.maxWords,h=void 0===m?50:m,l=t.dictionary,s=void 0===l?void 0:l,v=o({minWords:Math.max(d,r.length),maxWords:Math.max(h,r.length),dictionary:s}),c=v.split(" "),g=Math.max(Math.floor((c.length-r.length)/r.length),1),x=[],M=0;M<r.length;M++){var p=Math.floor(Math.random()*g)+g*M;c[p]="".concat(a).concat(r[M]).concat(a),x.push(p)}return{indices:x,text:c.join(" ")}};export{t as generateTokenizedText};
@@ -0,0 +1 @@
1
+ import{isNil as n}from"../lang/isNil.js";var t=function(n){var t=new RegExp("([\\[\\^\\$\\.|\\?\\*\\+\\(\\)])+","g");return n.replace(t,(function(n){return n.split("").map((function(n){return"\\"+n})).join("")}))},c=function(n){return Object.keys(n).reduce((function(n,t,c){return"".concat(n).concat(c>0?"|":"").concat(t)}),"")},r=function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"%",u=t(o),i=c(e),a=new RegExp("".concat(u,"(").concat(i,")").concat(u),"g");return r.replace(a,(function(t,c){return n(e[c])?c:e[c]}))};export{r as interpolate};
@@ -0,0 +1 @@
1
+ import r from"@babel/runtime/helpers/construct";import e from"@babel/runtime/helpers/toConsumableArray";var t=function(t,o){return r(Function,e(Object.keys(o)).concat(["return `".concat(t,"`")])).apply(void 0,e(Object.values(o)))};export{t as interpolateLiteral};
@@ -1 +1 @@
1
- var t=function(t){return"string"==typeof t||"[object String]"===Object.prototype.toString.call(t)};export{t as i};
1
+ var t=function(t){return"string"==typeof t||"[object String]"===Object.prototype.toString.call(t)};export{t as isString};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@untemps/utils",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "description": "",
5
5
  "repository": "git@github.com:untemps/utils.git",
6
6
  "keywords": [],
@@ -44,6 +44,7 @@
44
44
  "docdash": "^1.2.0",
45
45
  "fast-check": "^2.22.0",
46
46
  "foodoc": "^0.0.9",
47
+ "glob": "^8.0.3",
47
48
  "husky": "^7.0.0",
48
49
  "jest": "^27.5.1",
49
50
  "jsdoc": "^3.6.11",
@@ -1 +0,0 @@
1
- "use strict";exports.isString=function(t){return"string"==typeof t||"[object String]"===Object.prototype.toString.call(t)};