@rybr/lenses
Version:
a simple and light package meant to ease data traversal, manipulation, mutation, and transformation
1 lines • 5.42 kB
JavaScript
(()=>{var t={743:t=>{function r(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function e(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?r(Object(o),!0).forEach((function(r){n(t,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(o,r))}))}return t}function n(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=function(t){return null==t?"".concat(t):t.constructor?t.constructor.name:"Unknown"},s=function(t,r,e,n){return t===r||t instanceof n||i(t)===n.name||o(t)===e},u={STRING:{is:function(t){return s(t,u.STRING,"string",String)},toString:function(){return"STRING"}},FUNCTION:{is:function(t){return s(t,u.FUNCTION,"function",Function)},toString:function(){return"FUNCTION"}},NUMBER:{is:function(t){return s(t,u.NUMBER,"number",Number)},toString:function(){return"NUMBER"}},OBJECT:{is:function(t){return s(t,u.OBJECT,"object",Object)},toString:function(){return"OBJECT"}},ARRAY:{is:function(t){return t===u.ARRAY||Array.isArray(t)},toString:function(){return"ARRAY"}},HTML_ELEMENT:{is:function(t){return s(t,u.HTML_ELEMENT,"object",HTMLElement)},toString:function(){return"HTML_ELEMENT"}},INVALID:{is:function(t){return t===u.INVALID},toString:function(){return"INVALID"}}};t.exports={getConstructorName:i,getOperationType:function(t){return u.STRING.is(t)&&t.trim().length>0?u.STRING:u.NUMBER.is(t)&&t>=0?u.NUMBER:u.FUNCTION.is(t)?u.FUNCTION:u.INVALID},TYPES:u,loadGlobal:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"undefined"!=typeof window&&(window.L=e(e({},window.L),t))}}},798:(t,r,e)=>{var n=e(743),o=n.loadGlobal,i=n.TYPES,s=n.getConstructorName,u=function(t){return function(){for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return function(r){if(null==t||null==t.trim())throw new Error("no prototype function name specified");if(null==r)return r;if(!i.FUNCTION.is(r[t]))throw new Error("The function ".concat(t," does not exist for type ").concat(s(r)));return r[t].apply(r,e)}}},c=function(t){return null==t||(i.STRING.is(t)?!t||""==t||0===t.length:i.ARRAY.is(t)?0===t.length:!!i.OBJECT.is(t)&&0===Object.keys(t).length)};t.exports.call=function(t){for(var r=arguments.length,e=new Array(r>1?r-1:0),n=1;n<r;n++)e[n-1]=arguments[n];return function(r){return u(t).apply(void 0,e)(r)}},t.exports._call=u,t.exports.concat=u("concat"),t.exports.entries=function(){return function(t){return null==t?t:Object.entries(t)}},t.exports.every=u("every"),t.exports.fill=u("fill"),t.exports.filter=u("filter"),t.exports.find=u("find"),t.exports.findIndex=u("findIndex"),t.exports.forEach=u("forEach"),t.exports.includes=u("includes"),t.exports.indexOf=u("indexOf"),t.exports.join=u("join"),t.exports.keys=function(){return function(t){if(null==t)return t;if(i.OBJECT.is(t))return Object.keys(t);if(i.ARRAY.is(t))return Array.keys(t);throw new Error("Input must be of type Object or Array but found ".concat(s(t)))}},t.exports.lastIndexOf=u("lastIndexOf"),t.exports.map=u("map"),t.exports.push=u("push"),t.exports.reduce=u("reduce"),t.exports.reverse=u("reverse"),t.exports.slice=u("slice"),t.exports.some=u("some"),t.exports.sort=u("sort"),t.exports.splice=u("splice"),t.exports.values=function(){return function(t){if(null==t)return t;if(i.OBJECT.is(t))return Object.values(t);if(i.ARRAY.is(t))return Array.values(t);throw new Error("Input must be of type Object or Array but found ".concat(s(t)))}},t.exports.assign=function(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];return function(t){return null==t?t:Object.assign.apply(Object,[t].concat(r))}},t.exports.hasOwnProperty=function(t){return function(r){return null==r?r:Object.prototype.hasOwnProperty.call(r,t)}},t.exports.trim=u("trim"),t.exports.toLowerCase=u("toLowerCase"),t.exports.toUpperCase=u("toUpperCase"),t.exports.is=function(t){return function(r){return r===t||Object.is(r,t)}},t.exports.replace=u("replace"),t.exports.replaceAll=u("replaceAll"),t.exports.padEnd=u("padEnd"),t.exports.padStart=u("padStart"),t.exports.repeat=u("repeat"),t.exports.charAt=u("charAt"),t.exports.charCodeAt=u("charCodeAt"),t.exports.endsWith=u("endsWith"),t.exports.startsWith=u("startsWith"),t.exports.match=u("match"),t.exports.matchAll=u("matchAll"),t.exports.normalize=u("normalize"),t.exports.split=u("split"),t.exports.substring=u("substring"),t.exports.toLowerCase=u("toLowerCase"),t.exports.toUpperCase=u("toUpperCase"),t.exports.trim=u("trim"),t.exports.trimStart=u("trimStart"),t.exports.trimEnd=u("trimEnd"),t.exports.isArray=function(t){return null==t?t:Array.isArray(t)},t.exports.isEmpty=function(){return function(t){return c(t)}},t.exports.isNotEmpty=function(){return function(t){return!c(t)}},o(t.exports)}},r={};!function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{}};return t[n](o,o.exports,e),o.exports}(798)})();