New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

creepyface

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

creepyface - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

dist/creepyface.cjs.js

@@ -99,3 +99,3 @@ 'use strict';

var closestLook = closest(angle, looks);
if (Math.abs(shortest(closestLook.angle - angle)) < fieldOfVision / 2) {
if (closestLook && Math.abs(shortest(closestLook.angle - angle)) < fieldOfVision / 2) {
src = closestLook.src;

@@ -102,0 +102,0 @@ }

@@ -95,3 +95,3 @@ import getElementCenter from 'get-element-center';

var closestLook = closest(angle, looks);
if (Math.abs(shortest(closestLook.angle - angle)) < fieldOfVision / 2) {
if (closestLook && Math.abs(shortest(closestLook.angle - angle)) < fieldOfVision / 2) {
src = closestLook.src;

@@ -98,0 +98,0 @@ }

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.creepyFace=e()}(this,function(){"use strict";function t(t,e,n){var r=t.coords,o=n.looks,u=n.hover,a=n.fieldOfVision,i=p(y(f(r,E(e)),Math.PI/2)),s=n.default;if(u&&M(e,r))s=u;else{var c=S(i,o);Math.abs(g(c.angle-i))<a/2&&(s=c.src)}return s}function e(t){if(!t)return Promise.reject();if("string"==typeof t){var n=t;(t=new Image).src=n}else{if(void 0!==t.length){var r=[].map.call(t,function(t){return e(t).catch(function(t){return t})});return Promise.all(r).then(function(t){var e=t.filter(function(t){return t.naturalWidth});return e.length===t.length?e:Promise.reject({loaded:e,errored:t.filter(function(t){return!t.naturalWidth})})})}if("IMG"!==t.tagName)return Promise.reject()}var o=new Promise(function(e,n){function r(){t.naturalWidth?e(t):n(t),t.removeEventListener("load",r),t.removeEventListener("error",r)}t.naturalWidth?e(t):t.complete?n(t):(t.addEventListener("load",r),t.addEventListener("error",r))});return o.image=t,o}function n(t){t.forEach(function(t){t.style.position="fixed",t.style.height="0px",document.body.appendChild(t),setTimeout(function(){return document.body.removeChild(t)},1e3)})}function r(t,e){return x(e).then(function(e){t.creepyFaceReachableImages=e,P&&n(e)})}function o(t){return function(e){var n;return n=/^data\-/.test(e.name),void 0===t?n:n&&t.test(e.name.slice(5))}}function u(t,e,n){return{coords:t,target:e,source:n}}function a(t){var e=[],n=function(t){return e.forEach(function(e){var n=e.apply;return e.nexts.forEach(k(n(t)))})};return{map:function(r){0===e.length&&t(n);var o=[];return e.push({apply:r,nexts:o}),a(o.push.bind(o))}}}function i(t,e,n){var r=t.length;return e=null==e?n||0:e<0?Math.max(r+e,0):Math.min(e,r)}function s(t){var e=j(t),n=e.src,r=e.fieldofvision,o=e.throttle,u=n||{},a=u.hover,i=u.look;return Y({fieldOfVision:isNaN(r)||d(parseFloat(r)),default:t.getAttribute("src"),hover:a,looks:q(i),throttle:parseFloat(o)},U)}function c(e,n){var o=Y({},n,s(e));return r(e,G(o)).then(function(){return o.points.map(H(function(n){e.src=t(n,e,o)},o.throttle))})}var f=function(t,e){return t.map(function(t,n){return t-e[n]})},l=function(t,e){return t.map(function(t,n){return t+e[n]})},h=function(t){return t?t<0?-1:1:0},d=function(t){return t*Math.PI/180},m=function(t,e){return(e+t%e)%e},p=function(t){return m(Math.atan2(t[1],t[0]),2*Math.PI)},y=function(t,e){return[t[0]*Math.cos(e)-t[1]*Math.sin(e),t[0]*Math.sin(e)+t[1]*Math.cos(e)]},b=function(t){var e=t.getBoundingClientRect();return{y:e.top+window.pageYOffset+e.height/2,x:e.left+window.pageXOffset+e.width/2}},v=function(){function t(t,e){var n=[],r=!0,o=!1,u=void 0;try{for(var a,i=t[Symbol.iterator]();!(r=(a=i.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,u=t}finally{try{!r&&i.return&&i.return()}finally{if(o)throw u}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),E=function(t){var e=b(t);return[e.x,e.y]},g=function(t){return Math.abs(t)>Math.PI?t-2*h(t)*Math.PI:t},N=function(t){return function(e,n){return Math.abs(g(e.angle-t))-Math.abs(g(n.angle-t))}},S=function(t,e){return e.slice(0).sort(N(t))[0]},W=function(t,e,n){return t>=e&&t<=n},w=function(t,e){var n=t.left,r=t.top,o=t.right,u=t.bottom,a=v(e,2),i=a[0],s=a[1];return W(i,n,o)&&W(s,r,u)},M=function(t,e){var n=v(e,2),r=n[0],o=n[1];return document.elementFromPoint?document.elementFromPoint(r,o)===t:w(t.getBoundingClientRect(),[r,o])},x=e,P="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),j=function(t,e){var n={};return void 0===(e=e||{}).separator&&(e.separator="-"),Array.prototype.slice.call(t.attributes).filter(o(e.pattern)).forEach(function(t){t.name.slice(5).split(e.separator).reduce(function(e,n,r,o){return"data"===n?e:(r===o.length-1?e[n]=t.value:e[n]=e[n]||{},e[n])},n)}),n},O=("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self,function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t,e){!function(e,n){t.exports=n()}(0,function(){var t=[90,45,22.5,11.25],e=[{symbol:"N",name:"North",depth:0},{symbol:"NbE",name:"North by East",depth:3},{symbol:"NNE",name:"North North East",depth:2},{symbol:"NEbN",name:"North East by North",depth:3},{symbol:"NE",name:"North East",depth:1},{symbol:"NEbE",name:"North East by East",depth:3},{symbol:"ENE",name:"East North East",depth:2},{symbol:"EbN",name:"East by North",depth:3},{symbol:"E",name:"East",depth:0},{symbol:"EbS",name:"East by South",depth:3},{symbol:"ESE",name:"East South East",depth:2},{symbol:"SEbE",name:"South East by East",depth:3},{symbol:"SE",name:"South East",depth:1},{symbol:"SEbS",name:"South East by South",depth:3},{symbol:"SSE",name:"South South East",depth:2},{symbol:"SbE",name:"South by East",depth:3},{symbol:"S",name:"South",depth:0},{symbol:"SbW",name:"South by West",depth:3},{symbol:"SSW",name:"South South West",depth:2},{symbol:"SWbS",name:"South West by South",depth:3},{symbol:"SW",name:"South West",depth:1},{symbol:"SWbW",name:"South West by West",depth:3},{symbol:"WSW",name:"West South West",depth:2},{symbol:"WbS",name:"West by South",depth:3},{symbol:"W",name:"West",depth:0},{symbol:"WbN",name:"West by North",depth:3},{symbol:"WNW",name:"West North West",depth:2},{symbol:"NWbW",name:"North West by West",depth:3},{symbol:"NW",name:"North West",depth:1},{symbol:"NWbN",name:"North West by North",depth:3},{symbol:"NNW",name:"North North West",depth:2},{symbol:"NbW",name:"North by West",depth:3}];return{getPoint:function(n,r){if(!(n<0||n>360)){(r=r||{}).depth=r.hasOwnProperty("depth")?r.depth:3;var o=Math.round(n/t[r.depth]),u=e.filter(function(t){return t.depth<=r.depth});return o===u.length&&(o=0),u[o]}},getDegrees:function(n,r){var o,u,a;if(r=r||{},r.depth=r.hasOwnProperty("depth")?r.depth:3,!(r.depth<0||r.depth>3)&&(e.forEach(function(e,r){n!==e.name&&n!==e.symbol||(o=r*t[3])}),u=o-t[r.depth]/2,a=o+t[r.depth]/2,void 0!==o))return{min:u>=0?u:360+u,value:o,max:a<=360?a:a-360}}}})})),k=function(t){return function(e){return e(t)}},I=function(t,e){return a(function(n){return t.addEventListener(e,n,!0)})},A=I(document,"mousemove").map(function(t){return u([t.clientX,t.clientY],t.target,"mouse")}),F=I(document,"touchmove").map(function(t){return u([].slice.call(t.touches).map(function(t){return[t.clientX,t.clientY]}).reduce(l,[0,0]),t.target,"finger")}),C=function(t,e,n){if(null!=t)for(var r=t.length,o=-1;++o<r;){var u=t[o];if(!1===e.call(n,u,o,t))break}},L=function(t,e,n){var r=t.length,o=[];for(e=i(t,e),n=i(t,n,r);e<n;)o.push(t[e++]);return o},D=function(t,e,n){for(var r in t)if(!1===e.call(n,t[r],r,t))break},T=Object.prototype.hasOwnProperty,R=function(t,e,n){D(t,function(r,o){if(T.call(t,o))return e.call(n,t[o],o,t)})},V=function(t){return null!=t&&"object"==typeof t&&!1===Array.isArray(t)},X=function(t,e){return null==t?{}:(C(L(arguments,1),function(e){V(e)&&R(e,function(e,n){null==t[n]&&(t[n]=e)})}),t)},Y=X;Y.immutable=function(){var t=L(arguments);return X.apply(null,[{}].concat(t))};var B=function(t){return d(isNaN(t)?O.getDegrees(t.toUpperCase()).value:parseFloat(t))},q=function(t){return Object.keys(t||{}).map(function(e){return{angle:B(e),src:t[e]}})},G=function(t){var e=t.looks.map(function(t){return t.src});return t.default&&e.push(t.default),t.hover&&e.push(t.hover),e},U={fieldOfVision:d(150),default:"",hover:"",looks:[],points:function(t){return a(function(e){return t.map(function(t){return t.map(e)})})}([A,F]),throttle:0},z=function(t){return!(!t||"object"!=typeof t)&&("object"==typeof window&&"object"==typeof window.Node?t instanceof window.Node:"number"==typeof t.nodeType&&"string"==typeof t.nodeName)},H=function(t,e){function n(){a=0,i=+new Date,u=t.apply(r,o),r=null,o=null}var r,o,u,a,i=0;return function(){r=this,o=arguments;var t=new Date-i;return a||(t>=e?n():a=setTimeout(n,e-t)),u}};return function(t){return z(t)?[t]:"string"==typeof t?[].slice.call(document.querySelectorAll(t)):void 0}("img[data-creepy]").forEach(function(t){return c(t)}),c});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.creepyFace=e()}(this,function(){"use strict";function t(t,e,n){var r=t.coords,o=n.looks,u=n.hover,a=n.fieldOfVision,i=p(y(f(r,E(e)),Math.PI/2)),s=n.default;if(u&&M(e,r))s=u;else{var c=S(i,o);c&&Math.abs(g(c.angle-i))<a/2&&(s=c.src)}return s}function e(t){if(!t)return Promise.reject();if("string"==typeof t){var n=t;(t=new Image).src=n}else{if(void 0!==t.length){var r=[].map.call(t,function(t){return e(t).catch(function(t){return t})});return Promise.all(r).then(function(t){var e=t.filter(function(t){return t.naturalWidth});return e.length===t.length?e:Promise.reject({loaded:e,errored:t.filter(function(t){return!t.naturalWidth})})})}if("IMG"!==t.tagName)return Promise.reject()}var o=new Promise(function(e,n){function r(){t.naturalWidth?e(t):n(t),t.removeEventListener("load",r),t.removeEventListener("error",r)}t.naturalWidth?e(t):t.complete?n(t):(t.addEventListener("load",r),t.addEventListener("error",r))});return o.image=t,o}function n(t){t.forEach(function(t){t.style.position="fixed",t.style.height="0px",document.body.appendChild(t),setTimeout(function(){return document.body.removeChild(t)},1e3)})}function r(t,e){return x(e).then(function(e){t.creepyFaceReachableImages=e,P&&n(e)})}function o(t){return function(e){var n;return n=/^data\-/.test(e.name),void 0===t?n:n&&t.test(e.name.slice(5))}}function u(t,e,n){return{coords:t,target:e,source:n}}function a(t){var e=[],n=function(t){return e.forEach(function(e){var n=e.apply;return e.nexts.forEach(k(n(t)))})};return{map:function(r){0===e.length&&t(n);var o=[];return e.push({apply:r,nexts:o}),a(o.push.bind(o))}}}function i(t,e,n){var r=t.length;return e=null==e?n||0:e<0?Math.max(r+e,0):Math.min(e,r)}function s(t){var e=j(t),n=e.src,r=e.fieldofvision,o=e.throttle,u=n||{},a=u.hover,i=u.look;return Y({fieldOfVision:isNaN(r)||d(parseFloat(r)),default:t.getAttribute("src"),hover:a,looks:q(i),throttle:parseFloat(o)},U)}function c(e,n){var o=Y({},n,s(e));return r(e,G(o)).then(function(){return o.points.map(H(function(n){e.src=t(n,e,o)},o.throttle))})}var f=function(t,e){return t.map(function(t,n){return t-e[n]})},l=function(t,e){return t.map(function(t,n){return t+e[n]})},h=function(t){return t?t<0?-1:1:0},d=function(t){return t*Math.PI/180},m=function(t,e){return(e+t%e)%e},p=function(t){return m(Math.atan2(t[1],t[0]),2*Math.PI)},y=function(t,e){return[t[0]*Math.cos(e)-t[1]*Math.sin(e),t[0]*Math.sin(e)+t[1]*Math.cos(e)]},b=function(t){var e=t.getBoundingClientRect();return{y:e.top+window.pageYOffset+e.height/2,x:e.left+window.pageXOffset+e.width/2}},v=function(){function t(t,e){var n=[],r=!0,o=!1,u=void 0;try{for(var a,i=t[Symbol.iterator]();!(r=(a=i.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,u=t}finally{try{!r&&i.return&&i.return()}finally{if(o)throw u}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),E=function(t){var e=b(t);return[e.x,e.y]},g=function(t){return Math.abs(t)>Math.PI?t-2*h(t)*Math.PI:t},N=function(t){return function(e,n){return Math.abs(g(e.angle-t))-Math.abs(g(n.angle-t))}},S=function(t,e){return e.slice(0).sort(N(t))[0]},W=function(t,e,n){return t>=e&&t<=n},w=function(t,e){var n=t.left,r=t.top,o=t.right,u=t.bottom,a=v(e,2),i=a[0],s=a[1];return W(i,n,o)&&W(s,r,u)},M=function(t,e){var n=v(e,2),r=n[0],o=n[1];return document.elementFromPoint?document.elementFromPoint(r,o)===t:w(t.getBoundingClientRect(),[r,o])},x=e,P="undefined"!=typeof navigator&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),j=function(t,e){var n={};return void 0===(e=e||{}).separator&&(e.separator="-"),Array.prototype.slice.call(t.attributes).filter(o(e.pattern)).forEach(function(t){t.name.slice(5).split(e.separator).reduce(function(e,n,r,o){return"data"===n?e:(r===o.length-1?e[n]=t.value:e[n]=e[n]||{},e[n])},n)}),n},O=("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self,function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t,e){!function(e,n){t.exports=n()}(0,function(){var t=[90,45,22.5,11.25],e=[{symbol:"N",name:"North",depth:0},{symbol:"NbE",name:"North by East",depth:3},{symbol:"NNE",name:"North North East",depth:2},{symbol:"NEbN",name:"North East by North",depth:3},{symbol:"NE",name:"North East",depth:1},{symbol:"NEbE",name:"North East by East",depth:3},{symbol:"ENE",name:"East North East",depth:2},{symbol:"EbN",name:"East by North",depth:3},{symbol:"E",name:"East",depth:0},{symbol:"EbS",name:"East by South",depth:3},{symbol:"ESE",name:"East South East",depth:2},{symbol:"SEbE",name:"South East by East",depth:3},{symbol:"SE",name:"South East",depth:1},{symbol:"SEbS",name:"South East by South",depth:3},{symbol:"SSE",name:"South South East",depth:2},{symbol:"SbE",name:"South by East",depth:3},{symbol:"S",name:"South",depth:0},{symbol:"SbW",name:"South by West",depth:3},{symbol:"SSW",name:"South South West",depth:2},{symbol:"SWbS",name:"South West by South",depth:3},{symbol:"SW",name:"South West",depth:1},{symbol:"SWbW",name:"South West by West",depth:3},{symbol:"WSW",name:"West South West",depth:2},{symbol:"WbS",name:"West by South",depth:3},{symbol:"W",name:"West",depth:0},{symbol:"WbN",name:"West by North",depth:3},{symbol:"WNW",name:"West North West",depth:2},{symbol:"NWbW",name:"North West by West",depth:3},{symbol:"NW",name:"North West",depth:1},{symbol:"NWbN",name:"North West by North",depth:3},{symbol:"NNW",name:"North North West",depth:2},{symbol:"NbW",name:"North by West",depth:3}];return{getPoint:function(n,r){if(!(n<0||n>360)){(r=r||{}).depth=r.hasOwnProperty("depth")?r.depth:3;var o=Math.round(n/t[r.depth]),u=e.filter(function(t){return t.depth<=r.depth});return o===u.length&&(o=0),u[o]}},getDegrees:function(n,r){var o,u,a;if(r=r||{},r.depth=r.hasOwnProperty("depth")?r.depth:3,!(r.depth<0||r.depth>3)&&(e.forEach(function(e,r){n!==e.name&&n!==e.symbol||(o=r*t[3])}),u=o-t[r.depth]/2,a=o+t[r.depth]/2,void 0!==o))return{min:u>=0?u:360+u,value:o,max:a<=360?a:a-360}}}})})),k=function(t){return function(e){return e(t)}},I=function(t,e){return a(function(n){return t.addEventListener(e,n,!0)})},A=I(document,"mousemove").map(function(t){return u([t.clientX,t.clientY],t.target,"mouse")}),F=I(document,"touchmove").map(function(t){return u([].slice.call(t.touches).map(function(t){return[t.clientX,t.clientY]}).reduce(l,[0,0]),t.target,"finger")}),C=function(t,e,n){if(null!=t)for(var r=t.length,o=-1;++o<r;){var u=t[o];if(!1===e.call(n,u,o,t))break}},L=function(t,e,n){var r=t.length,o=[];for(e=i(t,e),n=i(t,n,r);e<n;)o.push(t[e++]);return o},D=function(t,e,n){for(var r in t)if(!1===e.call(n,t[r],r,t))break},T=Object.prototype.hasOwnProperty,R=function(t,e,n){D(t,function(r,o){if(T.call(t,o))return e.call(n,t[o],o,t)})},V=function(t){return null!=t&&"object"==typeof t&&!1===Array.isArray(t)},X=function(t,e){return null==t?{}:(C(L(arguments,1),function(e){V(e)&&R(e,function(e,n){null==t[n]&&(t[n]=e)})}),t)},Y=X;Y.immutable=function(){var t=L(arguments);return X.apply(null,[{}].concat(t))};var B=function(t){return d(isNaN(t)?O.getDegrees(t.toUpperCase()).value:parseFloat(t))},q=function(t){return Object.keys(t||{}).map(function(e){return{angle:B(e),src:t[e]}})},G=function(t){var e=t.looks.map(function(t){return t.src});return t.default&&e.push(t.default),t.hover&&e.push(t.hover),e},U={fieldOfVision:d(150),default:"",hover:"",looks:[],points:function(t){return a(function(e){return t.map(function(t){return t.map(e)})})}([A,F]),throttle:0},z=function(t){return!(!t||"object"!=typeof t)&&("object"==typeof window&&"object"==typeof window.Node?t instanceof window.Node:"number"==typeof t.nodeType&&"string"==typeof t.nodeName)},H=function(t,e){function n(){a=0,i=+new Date,u=t.apply(r,o),r=null,o=null}var r,o,u,a,i=0;return function(){r=this,o=arguments;var t=new Date-i;return a||(t>=e?n():a=setTimeout(n,e-t)),u}};return function(t){return z(t)?[t]:"string"==typeof t?[].slice.call(document.querySelectorAll(t)):void 0}("img[data-creepy]").forEach(function(t){return c(t)}),c});
{
"name": "creepyface",
"version": "1.0.1",
"version": "1.0.2",
"author": "Alejandro Tardín <alejandro@tardin.com>",

@@ -5,0 +5,0 @@ "license": "MIT",

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