Socket
Socket
Sign inDemoInstall

baffle

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

4

dist/baffle.min.js
/*!
* baffle 0.2.1 - A tiny, dependency-free utility for obfuscating and revealing text.
* baffle 0.2.2 - A tiny, dependency-free utility for obfuscating and revealing text.
* Copyright (c) 2016 Cam Wiegert <cam@camwiegert.com> - https://camwiegert.github.io/baffle
* License: MIT
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.baffle=e():t.baffle=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var i=n(2),o=r(i);t.exports=o["default"]},function(t,e){"use strict";function n(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function r(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function i(t,e){return t.split("").map(e).join("")}function o(t){return t[Math.floor(Math.random()*t.length)]}function u(t,e){for(var n=0,r=t.length;n<r;n++)e(t[n],n)}function a(t){return t.map(function(t,e){return!!t&&e}).filter(function(t){return t!==!1})}function s(t){return"string"==typeof t?[].concat(n(document.querySelectorAll(t))):[NodeList,HTMLCollection].some(function(e){return t instanceof e})?[].concat(n(t)):t.nodeType?[t]:t}Object.defineProperty(e,"__esModule",{value:!0}),e.extend=r,e.mapString=i,e.sample=o,e.each=u,e.getTruthyIndices=a,e.getElements=s},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=n(3),a=r(u),s=n(1),c={characters:"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz~!@#$%^&*()-+=[]{}|;:,./<>?".split(""),speed:50},l=function(){function t(e,n){i(this,t),this.options=(0,s.extend)(Object.create(c),n),this.elements=(0,s.getElements)(e).map(a["default"]),this.running=!1}return o(t,[{key:"once",value:function(){var t=this;return(0,s.each)(this.elements,function(e){return e.write(t.options.characters)}),this}},{key:"start",value:function(){var t=this;return clearInterval(this.interval),(0,s.each)(this.elements,function(t){return t.init()}),this.interval=setInterval(function(){return t.once()},this.options.speed),this.running=!0,this}},{key:"stop",value:function(){return clearInterval(this.interval),this.running=!1,this}},{key:"set",value:function(t){return(0,s.extend)(this.options,t),this.running&&this.start(),this}},{key:"text",value:function(t){return(0,s.each)(this.elements,function(e){e.text(t(e.value))}),this}},{key:"reveal",value:function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?0:arguments[0],n=arguments.length<=1||void 0===arguments[1]?0:arguments[1],r=e/this.options.speed||1,i=function(){clearInterval(t.interval),t.interval=setInterval(function(){var e=t.elements.filter(function(t){return!t.bitmap.every(function(t){return!t})});(0,s.each)(e,function(e){var n=Math.ceil(e.value.length/r);e.decay(n).write(t.options.characters)}),e.length||(t.stop(),(0,s.each)(t.elements,function(t){return t.init()}))},t.options.speed)};return setTimeout(i,n),this}}]),t}();e["default"]=function(t,e){return new l(t,e)}},function(t,e,n){"use strict";function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=n(1),s=function(){function t(e){o(this,t),this.value=e,this.init()}return u(t,[{key:"init",value:function(){return this.bitmap=this.value.split("").map(function(){return 1}),this}},{key:"render",value:function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],n=arguments.length<=1||void 0===arguments[1]?[" "]:arguments[1];return e.length?(0,a.mapString)(this.value,function(r,i){return n.indexOf(r)>-1?r:t.bitmap[i]?(0,a.sample)(e):r}):this.value}},{key:"decay",value:function(){for(var t=arguments.length<=0||void 0===arguments[0]?1:arguments[0];t--;){var e=(0,a.getTruthyIndices)(this.bitmap);this.bitmap[(0,a.sample)(e)]=0}return this}},{key:"text",value:function(){var t=arguments.length<=0||void 0===arguments[0]?this.value:arguments[0];return this.value=t,this.init(),this}}]),t}(),c=function(t){function e(t){o(this,e);var n=r(this,Object.getPrototypeOf(e).call(this,t.textContent));return n.element=t,n}return i(e,t),u(e,[{key:"write",value:function(t){return this.element.textContent=this.render(t),this}}]),e}(s);e["default"]=function(t){return new c(t)}}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.baffle=e():t.baffle=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var i=n(2),o=r(i);t.exports=o["default"]},function(t,e){"use strict";function n(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function r(t,e){return t.split("").map(e).join("")}function i(t){return t[Math.floor(Math.random()*t.length)]}function o(t,e){for(var n=0,r=t.length;n<r;n++)e(t[n],n)}function u(t){return t.map(function(t,e){return!!t&&e}).filter(function(t){return t!==!1})}function a(t){return"string"==typeof t?[].slice.call(document.querySelectorAll(t)):[NodeList,HTMLCollection].some(function(e){return t instanceof e})?[].slice.call(t):t.nodeType?[t]:t}Object.defineProperty(e,"__esModule",{value:!0}),e.extend=n,e.mapString=r,e.sample=i,e.each=o,e.getTruthyIndices=u,e.getElements=a},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=n(3),a=r(u),s=n(1),c={characters:"AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz~!@#$%^&*()-+=[]{}|;:,./<>?".split(""),speed:50},l=function(){function t(e,n){i(this,t),this.options=(0,s.extend)(Object.create(c),n),this.elements=(0,s.getElements)(e).map(a["default"]),this.running=!1}return o(t,[{key:"once",value:function(){var t=this;return(0,s.each)(this.elements,function(e){return e.write(t.options.characters)}),this}},{key:"start",value:function(){var t=this;return clearInterval(this.interval),(0,s.each)(this.elements,function(t){return t.init()}),this.interval=setInterval(function(){return t.once()},this.options.speed),this.running=!0,this}},{key:"stop",value:function(){return clearInterval(this.interval),this.running=!1,this}},{key:"set",value:function(t){return(0,s.extend)(this.options,t),this.running&&this.start(),this}},{key:"text",value:function(t){return(0,s.each)(this.elements,function(e){e.text(t(e.value))}),this}},{key:"reveal",value:function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?0:arguments[0],n=arguments.length<=1||void 0===arguments[1]?0:arguments[1],r=e/this.options.speed||1,i=function(){clearInterval(t.interval),t.interval=setInterval(function(){var e=t.elements.filter(function(t){return!t.bitmap.every(function(t){return!t})});(0,s.each)(e,function(e){var n=Math.ceil(e.value.length/r);e.decay(n).write(t.options.characters)}),e.length||(t.stop(),(0,s.each)(t.elements,function(t){return t.init()}))},t.options.speed)};return setTimeout(i,n),this}}]),t}();e["default"]=function(t,e){return new l(t,e)}},function(t,e,n){"use strict";function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=n(1),s=function(){function t(e){o(this,t),this.value=e,this.init()}return u(t,[{key:"init",value:function(){return this.bitmap=this.value.split("").map(function(){return 1}),this}},{key:"render",value:function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],n=arguments.length<=1||void 0===arguments[1]?[" "]:arguments[1];return e.length?(0,a.mapString)(this.value,function(r,i){return n.indexOf(r)>-1?r:t.bitmap[i]?(0,a.sample)(e):r}):this.value}},{key:"decay",value:function(){for(var t=arguments.length<=0||void 0===arguments[0]?1:arguments[0];t--;){var e=(0,a.getTruthyIndices)(this.bitmap);this.bitmap[(0,a.sample)(e)]=0}return this}},{key:"text",value:function(){var t=arguments.length<=0||void 0===arguments[0]?this.value:arguments[0];return this.value=t,this.init(),this}}]),t}(),c=function(t){function e(t){o(this,e);var n=r(this,Object.getPrototypeOf(e).call(this,t.textContent));return n.element=t,n}return i(e,t),u(e,[{key:"write",value:function(t){return this.element.textContent=this.render(t),this}}]),e}(s);e["default"]=function(t){return new c(t)}}])});
{
"name": "baffle",
"version": "0.2.1",
"version": "0.2.2",
"description": "A tiny, dependency-free utility for obfuscating and revealing text.",

@@ -5,0 +5,0 @@ "main": "dist/baffle.min.js",

@@ -39,5 +39,5 @@ // Extend one object with another.

if (typeof obj === 'string')
return [...document.querySelectorAll(obj)];
return [].slice.call(document.querySelectorAll(obj));
if ([NodeList, HTMLCollection].some(collection => obj instanceof collection))
return [...obj];
return [].slice.call(obj);
if (obj.nodeType)

@@ -44,0 +44,0 @@ return [obj];

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc