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.0 to 2.0.0-beta.1

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"))})),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(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"))}))};

@@ -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"))})),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(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};

@@ -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"))})),u.src=i,f.appendChild(u)):r(new Error("No DOM element to append script"))}))}}));
!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"))}))}}));
{
"name": "simple-load-script",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "Very simple promise based script and JSONP",

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

"vite:build-and-preview": "vite build && vite preview",
"test:run": "vite build && vitest run",
"test:ui": "vite build && vitest --ui",
"test:watch": "vite build && vitest",
"test:run": "vite build && vitest run --reporter=verbose",
"test:ui": "vite build && vitest --reporter=verbose --ui",
"test:watch": "vite build && vitest --reporter=verbose",
"format-check": "prettier --check ./**/*.ts",

@@ -23,0 +23,0 @@ "format-write": "prettier --write ./**/*.ts",

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

## Installation
```bash
npm install --save simple-load-script
```
## Import

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