Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jpjs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jpjs - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

README.md

2

dist/jpjs.js

@@ -1,2 +0,2 @@

var e=Array.prototype.push;var n=!("undefined"==typeof window||!window.document||!window.document.createElement),t={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};exports.compactArray=function(e){for(var n=[],t=0;t<e.length;++t){var r=e[t];null!=r&&n.push(r)}return n},exports.concatAllArray=function(n){for(var t=[],r=0;r<n.length;r++){var o=n[r];if(Array.isArray(o))e.apply(t,o);else if(null!=o)throw new TypeError('concatAllArray: All items in the array must be an array or null, got "'+o+'" at index "'+r+'" instead')}return t},exports.copyToClipboard=function(e,n){void 0===n&&(n=document.body);var t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",n.appendChild(t);var r=document.getSelection(),o=!!(r&&r.rangeCount>0)&&r.getRangeAt(0);t.select(),document.execCommand("copy"),n.removeChild(t),o&&r&&(r.removeAllRanges(),r.addRange(o))},exports.dataUriToBlob=function(e){var n;n=e.split(",")[0].indexOf("base64")>=0?atob(e.split(",")[1]):decodeURI(e.split(",")[1]);for(var t=e.split(",")[0].split(":")[1].split(";")[0],r=new Uint8Array(n.length),o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return new Blob([r],{type:t})},exports.debounce=function(e,n,t){var r;return function(){var o=this,a=arguments,i=t&&!r;clearTimeout(r),r=setTimeout(function(){r=null,t||e.apply(o,a)},n),i&&e.apply(o,a)}},exports.encodeSVGAsDataUri=function(e){return"data:image/svg+xml,"+encodeURIComponent(e).replace(/%0A/g,"").replace(/%20/g," ").replace(/%3D/g,"=").replace(/%3A/g,":").replace(/%2F/g,"/").replace(/%22/g,"'")},exports.ExecutionEnvironment=t,exports.fromPhoneE164=function(e){return 12===e.length?e.substring(2,5)+"-"+e.substring(5,8)+"-"+e.substring(8,12):e},exports.getActiveElement=function(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(n){return e.body}},exports.humanizeList=function(e,n){if(void 0===n&&(n={oxfordComma:!0,skipConjunction:!1,conjunction:"and"}),!Array.isArray(e))throw new TypeError("humanize-list expected an array");var t=e.length;if(1===t)return e[0];if(n.skipConjunction)return e.join(", ");var r="";if(2===t)return e.join(" "+n.conjunction+" ");for(var o=0;o<t;o++)o===t-1?(n.oxfordComma&&(r+=","),r+=" "+n.conjunction+" "):0!==o&&(r+=", "),r+=e[o];return r},exports.makeCancelable=function(e){var n=!1;return[new Promise(function(t,r){e.then(function(e){return n?r({isCanceled:!0}):t(e)},function(e){return r(n?{isCanceled:!0}:e)})}),function(){n=!0}]},exports.throttle=function(e,n){var t=null,r=null,o=this,a=function(){e.apply(o,r),t=null};return function(){t||(r=arguments,t=setTimeout(a,n))}},exports.toPhoneE164=function(e){return 10===(e=e.replace(/[^0-9]/g,"")).length&&(e="1"+e),"+"+e},exports.toRadian=function(e){return e*Math.PI/180},exports.toSlug=function(e){var n=e;return n?n=(n=(n=(n=(n=n.toLowerCase().trim()).replace(/ & /g," and ")).replace(/[ ]+/g,"-")).replace(/[-]+/g,"-")).replace(/[^a-z0-9-]+/g,""):""},exports.uniq=function(e){var n=new Set;return e.filter(function(e){if(!n.has(e))return n.add(e),!0})};
var e=Array.prototype.push;var n=!("undefined"==typeof window||!window.document||!window.document.createElement),t={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};function r(e){return e*Math.PI/180}var o={20:1128.49722,19:2256.99444,18:4513.98888,17:9027.977761,16:18055.95552,15:36111.91104,14:72223.82209,13:144447.6442,12:288895.2884,11:577790.5767,10:1155581.153,9:2311162.307,8:4622324.614,7:9244649.227,6:18489298.45,5:36978596.91,4:73957193.82,3:147914387.6,2:295828775.3,1:591657550.5};exports.compactArray=function(e){for(var n=[],t=0;t<e.length;++t){var r=e[t];null!=r&&n.push(r)}return n},exports.concatAllArray=function(n){for(var t=[],r=0;r<n.length;r++){var o=n[r];if(Array.isArray(o))e.apply(t,o);else if(null!=o)throw new TypeError('concatAllArray: All items in the array must be an array or null, got "'+o+'" at index "'+r+'" instead')}return t},exports.copyToClipboard=function(e,n){void 0===n&&(n=document.body);var t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",n.appendChild(t);var r=document.getSelection(),o=!!(r&&r.rangeCount>0)&&r.getRangeAt(0);t.select(),document.execCommand("copy"),n.removeChild(t),o&&r&&(r.removeAllRanges(),r.addRange(o))},exports.dataUriToBlob=function(e){var n;n=e.split(",")[0].indexOf("base64")>=0?atob(e.split(",")[1]):decodeURI(e.split(",")[1]);for(var t=e.split(",")[0].split(":")[1].split(";")[0],r=new Uint8Array(n.length),o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return new Blob([r],{type:t})},exports.debounce=function(e,n,t){var r;return function(){var o=this,a=arguments,i=t&&!r;clearTimeout(r),r=setTimeout(function(){r=null,t||e.apply(o,a)},n),i&&e.apply(o,a)}},exports.encodeSVGAsDataUri=function(e){return"data:image/svg+xml,"+encodeURIComponent(e).replace(/%0A/g,"").replace(/%20/g," ").replace(/%3D/g,"=").replace(/%3A/g,":").replace(/%2F/g,"/").replace(/%22/g,"'")},exports.ExecutionEnvironment=t,exports.fromPhoneE164=function(e){return 12===e.length?e.substring(2,5)+"-"+e.substring(5,8)+"-"+e.substring(8,12):e},exports.getActiveElement=function(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(n){return e.body}},exports.getDistance=function(e,n,t){void 0===t&&(t=2);var o=r(n.lat-e.lat),a=r(n.lng-e.lng),i=r(e.lat),s=r(n.lat),c=Math.sin(o/2)*Math.sin(o/2)+Math.sin(a/2)*Math.sin(a/2)*Math.cos(i)*Math.cos(s);return(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))*6371).toFixed(t)},exports.googleMapsZoomToMeters=function(e){return o[e]},exports.humanizeList=function(e,n){if(void 0===n&&(n={oxfordComma:!0,skipConjunction:!1,conjunction:"and"}),!Array.isArray(e))throw new TypeError("humanize-list expected an array");var t=e.length;if(1===t)return e[0];if(n.skipConjunction)return e.join(", ");var r="";if(2===t)return e.join(" "+n.conjunction+" ");for(var o=0;o<t;o++)o===t-1?(n.oxfordComma&&(r+=","),r+=" "+n.conjunction+" "):0!==o&&(r+=", "),r+=e[o];return r},exports.makeCancelable=function(e){var n=!1;return[new Promise(function(t,r){e.then(function(e){return n?r({isCanceled:!0}):t(e)},function(e){return r(n?{isCanceled:!0}:e)})}),function(){n=!0}]},exports.throttle=function(e,n){var t=null,r=null,o=this,a=function(){e.apply(o,r),t=null};return function(){t||(r=arguments,t=setTimeout(a,n))}},exports.toApiError=function(e){return e.response&&e.response.data&&e.response.data.error_description?e.response.data.error_description:e.response&&e.response.data&&e.response.data.message?e.response.data.message:"We are having difficulty connecting to the server. Please check your internet connection and try again. (code "+(e.response&&e.response.status?e.response.status:-1)+")"},exports.toPhoneE164=function(e){return 10===(e=e.replace(/[^0-9]/g,"")).length&&(e="1"+e),"+"+e},exports.toRadian=r,exports.toSlug=function(e){var n=e;return n?n=(n=(n=(n=(n=n.toLowerCase().trim()).replace(/ & /g," and ")).replace(/[ ]+/g,"-")).replace(/[-]+/g,"-")).replace(/[^a-z0-9-]+/g,""):""},exports.uniq=function(e){var n=new Set;return e.filter(function(e){if(!n.has(e))return n.add(e),!0})};
//# sourceMappingURL=jpjs.js.map
{
"name": "jpjs",
"version": "1.1.0",
"version": "1.2.0",
"main": "dist/jpjs.js",

@@ -11,2 +11,3 @@ "umd:main": "dist/jpjs.umd.js",

"prepare": "npm run build",
"test": "echo \"yolo\"",
"build": "microbundle --typescript && cp ./dist/src/* ./dist/ && rm -rf ./dist/src",

@@ -13,0 +14,0 @@ "start": "microbundle watch --typescript"

@@ -10,5 +10,8 @@ export * from './compactArray';

export * from './getActiveElement';
export * from './getDistance';
export * from './googleMapsZoomToMeters';
export * from './humanizeList';
export * from './makeCancellablePromise';
export * from './throttle';
export * from './toApiError';
export * from './toPhoneE164';

@@ -15,0 +18,0 @@ export * from './toRadian';

@@ -9,1 +9,12 @@ export type Omit<T, K extends keyof T> = Pick<

export type Many<T> = T | T[];
export interface Geo {
/**
* latitude
*/
lat: number;
/**
* longitude
*/
lng: number;
}

@@ -20,3 +20,3 @@ {

// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./dist",
// "outDir": "./dist",
/* Redirect output structure to the directory. */

@@ -23,0 +23,0 @@ "rootDir": "./",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc