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

react-stripe-script-loader

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-stripe-script-loader - npm Package Compare versions

Comparing version 1.0.20 to 1.0.21

37

index.js

@@ -14,10 +14,2 @@ "use strict";

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }

@@ -124,25 +116,8 @@

if (scriptElement) {
var config = {
attributes: false,
childList: true,
subtree: false
};
var filterNodes = function filterNodes(nl) {
return Array.from(nl).filter(function (b) {
return b.nodeName === 'IFRAME';
}).filter(function (b) {
return b.name.match(/privateStripe/g);
});
};
var mutationCallback = function mutationCallback(a) {
return a.reduce(function (acc, curr) {
return curr.type === 'childList' ? [].concat(_toConsumableArray(acc), _toConsumableArray(filterNodes(curr.addedNodes))) : acc;
}, []).forEach(function (a) {
return a.remove();
});
};
new MutationObserver(mutationCallback).observe(document.body, config);
var iframesList = document.getElementsByTagName('iframe');
iframesList.filter(function (item) {
return item.name && item.name.indexOf('privateStripe') === 0;
}).map(function (filteredItem) {
return filteredItem.remove();
});
scriptElement.remove();

@@ -149,0 +124,0 @@ }

2

package.json
{
"name": "react-stripe-script-loader",
"version": "1.0.20",
"version": "1.0.21",
"description": "React component that lets load Stripe script and shows React Stripe Elements",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -42,20 +42,7 @@ import React, { useState, useEffect } from 'react'

if (scriptElement) {
const config = { attributes: false, childList: true, subtree: false }
const filterNodes = nl =>
Array.from(nl)
.filter(b => b.nodeName === 'IFRAME')
.filter(b => b.name.match(/privateStripe/g))
const iframesList = document.getElementsByTagName('iframe')
const mutationCallback = a =>
a
.reduce(
(acc, curr) =>
curr.type === 'childList'
? [...acc, ...filterNodes(curr.addedNodes)]
: acc,
[]
)
.forEach(a => a.remove())
new MutationObserver(mutationCallback).observe(document.body, config)
iframesList
.filter(item => item.name && item.name.indexOf('privateStripe') === 0)
.map(filteredItem => filteredItem.remove())
scriptElement.remove()

@@ -62,0 +49,0 @@ }

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