Comparing version 1.2.0 to 2.0.0
@@ -1,1 +0,1 @@ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(this,(function(){return(()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>a});const o=e=>{try{return e?e.toLowerCase():e}catch(e){return console.log(e),null}},r=function(e,t,o){var r;function n(){if(4==r.readyState)if(r.status.toString().match(/^20[0-9]$/)){var e=function(){var e=r.getResponseHeader("Content-Type"),t=r.responseText;if(e){var o=e.split(";");try{switch(o[0]){case"application/json":return JSON.parse(t);default:return t}}catch(e){throw"Unable to convert response header"}}}();t.call(this,e,r)}else o.call(this,r.responseText,r)}function i(e,t){var o=[];for(var r in e)if(e.hasOwnProperty(r)){var n=t?t+"["+r+"]":r,a=e[r];o.push("object"==typeof a?i(a,n):encodeURIComponent(n)+"="+encodeURIComponent(a))}return o.join("&")}return window.XMLHttpRequest?r=new XMLHttpRequest:window.ActiveXObject&&(r=new ActiveXObject("Microsoft.XMLHTTP")),{request:function(){if(window.XMLHttpRequest)r.onload=n;else{if(!window.ActiveXObject)throw"unable to process ajax";r.onreadystatechange=n}var t=i(e.params);if("get"==e.method.toLowerCase()&&"object"==typeof e.params){if(-1==e.url.indexOf("?"))e.url+="?";else{var o=e.url.split("?");o[1]&&o[1].split("=")[1]&&(e.url+="&")}e.url+=t}e.hasOwnProperty("async")||(e.async=!0),r.open(e.method,e.url,e.async),e.headers&&function(e){for(let t in e)r.setRequestHeader(t,e[t])}(e.headers),r.send(t)}}},n=(e,t)=>{const o=e.split("/"),r=t.split("/");if(o.length!==r.length)return!1;for(let e=0;e<o.length;e++){const t=o[e];if(t!==r[e]&&":any"!==t)return!1}return!0},i=e=>{const t="https://dashboard.mockforme.com",i=`${t}/mockforme`,a=`${t}/gateway/_mfm_`,s="mockforme";let c=[];const l=window.location,p=l.protocol;if(l.host,l.port,!e)throw"mockforme token cannot be null";const u=(e,t="get")=>{let r=null;if(!Array.isArray(c))return r;for(let i=0;i<c.length;i++){const a=c[i];if(o(a.apiMethod)===o(t)&&(a.apiEndpoint===e||n(a.apiEndpoint,e))){r={url:e,method:a.apiMethod},a._ri_&&(r._ri_=a._ri_);break}}return r},d=()=>{(()=>{const t=window.fetch;window.fetch=function(o,r={}){r.method||(r.method="get");let n=arguments;o&&(o.startsWith("//")?o=`${window.location.protocol}${o}`:o.startsWith("/")&&(o=`${window.location.origin}${o}`));const a=new URL(o),c=a&&a.pathname,l=a&&a.search,p=u(c,r.method);return p&&(o=`${i}${p.url}${l}`,n[0]=o,r.headers={[s]:e},p&&p._ri_&&(r.headers._ri_=p._ri_)),t.call(this,o,r)}})(),(()=>{let t=window.XMLHttpRequest.prototype.open;window.XMLHttpRequest.prototype.open=function(o,r,n,a,c){try{r&&(r.startsWith("//")?r=`${window.location.protocol}${r}`:r.startsWith("/")?r=`${window.location.origin}${r}`:r.indexOf("://")>-1||(r=`${p}//${r}`));const n=new URL(r),a=n&&n.pathname,c=n&&n.search;let l=arguments;const d=u(a,o);return d&&(l[1]=`${i}${d.url}${c}`),this.onreadystatechange=function(){1==this.readyState&&(this.setRequestHeader(s,e),d&&d._ri_&&this.setRequestHeader("_ri_",d._ri_))},t.apply(this,l)}catch(e){return console.log("Error in mock api, could be invalid url",e),t.apply(this,arguments)}}})()};return{initialize:e=>{var t;d(),t=t=>{e&&e(t)},r({method:"get",url:a,async:!1},(e=>{var o;e&&(o=e,c=c.concat(o)),t(e)}),(()=>{console.log("Error in loading mocked apis")})).request()}}};window.mockforme=i;const a=i;return t})()})); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(this,(function(){return(()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{mockforme:()=>l});const o=e=>{try{return e?e.toLowerCase():e}catch(e){return console.log(e),null}},r=()=>"undefined"==typeof window,n=function(e,t,o){const n=r();var i;function s(){if(4==i.readyState)if(i.status.toString().match(/^20[0-9]$/)){var e=function(){var e=i.getResponseHeader("Content-Type"),t=i.responseText;if(e){var o=e.split(";");try{switch(o[0]){case"application/json":return JSON.parse(t);default:return t}}catch(e){throw"Unable to convert response header"}}}();t.call(this,e,i)}else o.call(this,i.responseText,i)}function a(e,t){var o=[];for(var r in e)if(e.hasOwnProperty(r)){var n=t?t+"["+r+"]":r,i=e[r];o.push("object"==typeof i?a(i,n):encodeURIComponent(n)+"="+encodeURIComponent(i))}return o.join("&")}return n||(window.XMLHttpRequest?i=new XMLHttpRequest:window.ActiveXObject&&(i=new ActiveXObject("Microsoft.XMLHTTP"))),{request:function(){if(!n){if(window.XMLHttpRequest)i.onload=s;else{if(!window.ActiveXObject)throw"unable to process ajax";i.onreadystatechange=s}var t=a(e.params);if("get"==e.method.toLowerCase()&&"object"==typeof e.params){if(-1==e.url.indexOf("?"))e.url+="?";else{var o=e.url.split("?");o[1]&&o[1].split("=")[1]&&(e.url+="&")}e.url+=t}e.hasOwnProperty("async")||(e.async=!0),i.open(e.method,e.url,e.async),e.headers&&function(e){for(let t in e)i.setRequestHeader(t,e[t])}(e.headers),i.send(t)}}}},i=(e,t)=>{const o=e.split("/"),r=t.split("/");if(o.length!==r.length)return!1;for(let e=0;e<o.length;e++){const t=o[e];if(t!==r[e]&&":any"!==t)return!1}return!0},s=e=>{if(r())return;const t="https://dashboard.mockforme.com",s=`${t}/mockforme`,a=`${t}/gateway/_mfm_`,c="mockforme";let l=[];const u=window.location,d=u.protocol;if(u.host,u.port,!e)throw"mockforme token cannot be null";const p=(e,t="get")=>{let r=null;if(!Array.isArray(l))return r;for(let n=0;n<l.length;n++){const s=l[n];if(o(s.apiMethod)===o(t)&&(s.apiEndpoint===e||i(s.apiEndpoint,e))){r={url:e,method:s.apiMethod},s._ri_&&(r._ri_=s._ri_);break}}return r},f=()=>{(()=>{const t=window.fetch;window.fetch=function(o,r={}){r.method||(r.method="get");let n=arguments;o&&(o.startsWith("//")?o=`${window.location.protocol}${o}`:o.startsWith("/")&&(o=`${window.location.origin}${o}`));const i=new URL(o),a=i&&i.pathname,l=i&&i.search,u=p(a,r.method);return u&&(o=`${s}${u.url}${l}`,n[0]=o,r.headers={[c]:e},u&&u._ri_&&(r.headers._ri_=u._ri_)),t.call(this,o,r)}})(),(()=>{let t=window.XMLHttpRequest.prototype.open;window.XMLHttpRequest.prototype.open=function(o,r,n,i,a){try{r&&(r.startsWith("//")?r=`${window.location.protocol}${r}`:r.startsWith("/")?r=`${window.location.origin}${r}`:r.indexOf("://")>-1||(r=`${d}//${r}`));const n=new URL(r),i=n&&n.pathname,a=n&&n.search;let l=arguments;const u=p(i,o);return u&&(l[1]=`${s}${u.url}${a}`),this.onreadystatechange=function(){1==this.readyState&&(this.setRequestHeader(c,e),u&&u._ri_&&this.setRequestHeader("_ri_",u._ri_))},t.apply(this,l)}catch(e){return console.log("Error in mock api, could be invalid url",e),t.apply(this,arguments)}}})()};return{run:e=>{var t;f(),t=t=>{e&&e(t)},n({method:"get",url:a,async:!1},(e=>{var o;e&&(o=e,l=l.concat(o)),t(e)}),(()=>{console.log("Error in loading mocked apis")})).request()}}},a=r();a||(window.mockforme=s);let c=s;a&&(c=e=>({run:()=>{console.log("node mockforme(t).run()")}}));const l=c;return t})()})); |
{ | ||
"name": "mockforme", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "mockforme client integration kit. Intercept APIs & get mock responses. Integrate mockforme SDK with your codebase in seconds", | ||
"main": "dist/mockforme.min.js", | ||
"typings": "dist/mockforme.d.ts", | ||
"files": [ | ||
@@ -18,3 +19,5 @@ "dist/*" | ||
"visitor prioritization", | ||
"throttle api" | ||
"throttle api", | ||
"mockforme", | ||
"mock for me" | ||
], | ||
@@ -28,5 +31,3 @@ "scripts": { | ||
"dependencies": {}, | ||
"devDependencies": { | ||
} | ||
"devDependencies": {} | ||
} |
@@ -29,3 +29,3 @@ | ||
``` | ||
mockforme('<ACCESS_TOKEN>').initialize(); | ||
mockforme('<ACCESS_TOKEN>').run(); | ||
``` | ||
@@ -39,3 +39,3 @@ | ||
``` | ||
window.mockforme('<ACCESS_TOKEN>').initialize(); | ||
window.mockforme('<ACCESS_TOKEN>').run(); | ||
``` | ||
@@ -42,0 +42,0 @@ |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
6646
5
9