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

simple-load-script

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-load-script - npm Package Compare versions

Comparing version 2.0.0-beta.1 to 2.0.0-beta.2

changelog.md

2

dist/index.cjs.js

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

"use strict";const e={url:"",attrs:{},inBody:!1,insertInto:null,removeScript:!1};module.exports=function r(o){return Array.isArray(o)?Promise.all(o.map(r)):new Promise(((r,t)=>{if(!("object"==typeof o&&o.url||"string"==typeof o))return console.log({config:o}),void t(new Error("Object with url or url string needed"));const n=Object.assign({},e,"string"==typeof o?{url:o}:o),{url:i,attrs:s,inBody:c,insertInto:l,removeScript:d}=n,u=document.createElement("script"),a=l?document.querySelector(l):c?document.body:document.head;if(s&&"object"==typeof s)for(const e of Object.keys(s))u.setAttribute(e,s[e]);console.log({config:o,configProcessed:n}),null!=a?(u.addEventListener("load",(()=>{d&&a.removeChild(u),r(d?void 0:u)})),u.addEventListener("error",(e=>{console.log(e),d&&a.removeChild(u),t(new Error("Loading script error"))})),u.src=i,a.appendChild(u)):t(new Error("No DOM element to append script"))}))};
"use strict";const e={url:"",attrs:{},inBody:!1,insertInto:null,removeScript:!1};module.exports=function r(t){return Array.isArray(t)?Promise.all(t.map(r)):new Promise(((r,o)=>{if(!("object"==typeof t&&t.url||"string"==typeof t))return console.log({config:t}),void o(new Error("Object with url or url string needed"));const n=Object.assign({},e,"string"==typeof t?{url:t}:t),{url:i,attrs:s,inBody:c,insertInto:d,removeScript:l}=n,u=document.createElement("script"),a=d?document.querySelector(d):c?document.body:document.head;if(s&&"object"==typeof s)for(const e of Object.keys(s))u.setAttribute(e,s[e]);null!=a?(u.addEventListener("load",(()=>{l&&a.removeChild(u),r(l?void 0:u)})),u.addEventListener("error",(()=>{l&&a.removeChild(u),o(new Error("Loading script error"))})),u.src=i,a.appendChild(u)):o(new Error("No DOM element to append script"))}))};

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

const e={url:"",attrs:{},inBody:!1,insertInto:null,removeScript:!1};function r(o){return Array.isArray(o)?Promise.all(o.map(r)):new Promise(((r,t)=>{if(!("object"==typeof o&&o.url||"string"==typeof o))return console.log({config:o}),void t(new Error("Object with url or url string needed"));const n=Object.assign({},e,"string"==typeof o?{url:o}:o),{url:i,attrs:s,inBody:c,insertInto:l,removeScript:d}=n,u=document.createElement("script"),a=l?document.querySelector(l):c?document.body:document.head;if(s&&"object"==typeof s)for(const e of Object.keys(s))u.setAttribute(e,s[e]);console.log({config:o,configProcessed:n}),null!=a?(u.addEventListener("load",(()=>{d&&a.removeChild(u),r(d?void 0:u)})),u.addEventListener("error",(e=>{console.log(e),d&&a.removeChild(u),t(new Error("Loading script error"))})),u.src=i,a.appendChild(u)):t(new Error("No DOM element to append script"))}))}export{r as default};
const e={url:"",attrs:{},inBody:!1,insertInto:null,removeScript:!1};function r(t){return Array.isArray(t)?Promise.all(t.map(r)):new Promise(((r,o)=>{if(!("object"==typeof t&&t.url||"string"==typeof t))return console.log({config:t}),void o(new Error("Object with url or url string needed"));const n=Object.assign({},e,"string"==typeof t?{url:t}:t),{url:i,attrs:s,inBody:d,insertInto:c,removeScript:l}=n,u=document.createElement("script"),a=c?document.querySelector(c):d?document.body:document.head;if(s&&"object"==typeof s)for(const e of Object.keys(s))u.setAttribute(e,s[e]);null!=a?(u.addEventListener("load",(()=>{l&&a.removeChild(u),r(l?void 0:u)})),u.addEventListener("error",(()=>{l&&a.removeChild(u),o(new Error("Loading script error"))})),u.src=i,a.appendChild(u)):o(new Error("No DOM element to append script"))}))}export{r as default};

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

!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).simpleLoadScript=o()}(this,(function(){"use strict";const e={url:"",attrs:{},inBody:!1,insertInto:null,removeScript:!1};return function o(t){return Array.isArray(t)?Promise.all(t.map(o)):new Promise(((o,r)=>{if(!("object"==typeof t&&t.url||"string"==typeof t))return console.log({config:t}),void r(new Error("Object with url or url string needed"));const n=Object.assign({},e,"string"==typeof t?{url:t}:t),{url:i,attrs:s,inBody:d,insertInto:c,removeScript:l}=n,u=document.createElement("script"),f=c?document.querySelector(c):d?document.body:document.head;if(s&&"object"==typeof s)for(const e of Object.keys(s))u.setAttribute(e,s[e]);console.log({config:t,configProcessed:n}),null!=f?(u.addEventListener("load",(()=>{l&&f.removeChild(u),o(l?void 0:u)})),u.addEventListener("error",(e=>{console.log(e),l&&f.removeChild(u),r(new Error("Loading script error"))})),u.src=i,f.appendChild(u)):r(new Error("No DOM element to append script"))}))}}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).simpleLoadScript=t()}(this,(function(){"use strict";const e={url:"",attrs:{},inBody:!1,insertInto:null,removeScript:!1};return function t(r){return Array.isArray(r)?Promise.all(r.map(t)):new Promise(((t,o)=>{if(!("object"==typeof r&&r.url||"string"==typeof r))return console.log({config:r}),void o(new Error("Object with url or url string needed"));const n=Object.assign({},e,"string"==typeof r?{url:r}:r),{url:i,attrs:d,inBody:s,insertInto:c,removeScript:l}=n,u=document.createElement("script"),f=c?document.querySelector(c):s?document.body:document.head;if(d&&"object"==typeof d)for(const e of Object.keys(d))u.setAttribute(e,d[e]);null!=f?(u.addEventListener("load",(()=>{l&&f.removeChild(u),t(l?void 0:u)})),u.addEventListener("error",(()=>{l&&f.removeChild(u),o(new Error("Loading script error"))})),u.src=i,f.appendChild(u)):o(new Error("No DOM element to append script"))}))}}));
{
"name": "simple-load-script",
"version": "2.0.0-beta.1",
"version": "2.0.0-beta.2",
"description": "Very simple promise based script and JSONP",

@@ -26,3 +26,5 @@ "repository": "tomek-f/simple-load-script",

"files": [
"dist"
"src",
"dist",
"changelog.md"
],

@@ -29,0 +31,0 @@ "main": "./dist/index.umd.js",

@@ -5,6 +5,2 @@ # simple-load-script

## Import
[Check dist folder](https://www.npmjs.com/package/simple-load-script?activeTab=code) or package.json
## Usage

@@ -150,2 +146,6 @@

## Specific import
[Check files](https://www.npmjs.com/package/simple-load-script?activeTab=code) or package.json
## Changelog

@@ -152,0 +152,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