simple-load-script
Advanced tools
+5
-1
| # changelog | ||
| ## x.x.x | ||
| ## 1.0.2 | ||
| * added `insertInto` config option | ||
| ## 1.0.1 | ||
| * rename index.js | ||
| * readme | ||
@@ -6,0 +10,0 @@ * changes in `all` method |
+1
-1
| The MIT License (MIT) | ||
| Copyright (c) 2016 Tomek Fijoł | ||
| Copyright (c) 2017 Tomek Fijoł | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
+2
-2
| { | ||
| "name": "simple-load-script", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "description": "Very simple promise based script and JSONP", | ||
@@ -15,5 +15,5 @@ "repository": "tomek-f/simple-load-script", | ||
| "main": "simpleLoadScript.js", | ||
| "author": "Tomek Fijoł", | ||
| "author": "Tomek Fijoł <tomekfijol@gmail.com> (http://tomekf.pl/)", | ||
| "license": "MIT", | ||
| "readmeFilename": "README.md" | ||
| } |
+1
-0
@@ -152,2 +152,3 @@ # simple-load-script | ||
| * `removeScript` (boolean) - after load (for JSONP, other reasons); it's always removed on error | ||
| * `insertInto` (string) - [CSS selector (an ID, class name, element name, etc.)](https://developer.mozilla.org/en/docs/Web/API/Document/querySelector) to insert the script into. Overrides `inBody` value. | ||
@@ -154,0 +155,0 @@ ## Returned values |
+10
-3
@@ -10,3 +10,2 @@ (function (root, factory) { | ||
| }(this, function () { | ||
| var undef; | ||
@@ -34,3 +33,12 @@ | ||
| var script = document.createElement('script'); | ||
| var where = options.inBody ? document.body : document.head; | ||
| var where = (function () { | ||
| if (options.insertInto) { | ||
| return document.querySelector(options.insertInto); | ||
| } | ||
| return options.inBody ? document.body : document.head; | ||
| }()); | ||
| if (!where) { | ||
| reject('Error: no DOM element to append script'); | ||
| return; | ||
| } | ||
| var attrs = options.attrs; | ||
@@ -78,3 +86,2 @@ var removeScript = options.removeScript; | ||
| return getScript; | ||
| })); |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
8961
6.63%79
12.86%204
0.49%1
Infinity%