Skip to content

Commit bf8570f

Browse files
committed
remove a bunch of unneccessary vars
1 parent 4339bb1 commit bf8570f

3 files changed

Lines changed: 13 additions & 17 deletions

File tree

dist/script.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,23 @@
44
* (c) Dustin Diaz 2014 | License MIT
55
*/
66

7-
(function (name, context, definition) {
7+
(function (name, definition) {
88
if (typeof module != 'undefined' && module.exports) module.exports = definition()
99
else if (typeof define == 'function' && define.amd) define(definition)
10-
else context[name] = definition()
11-
})('$script', this, function () {
10+
else this[name] = definition()
11+
})('$script', function () {
1212
var doc = document
1313
, head = doc.getElementsByTagName('head')[0]
14-
, validBase = /^https?:\/\//
1514
, s = 'string'
1615
, f = false
1716
, push = 'push'
1817
, readyState = 'readyState'
1918
, onreadystatechange = 'onreadystatechange'
20-
, scriptpath
2119
, list = {}
2220
, ids = {}
2321
, delay = {}
2422
, scripts = {}
23+
, scriptpath
2524

2625
function every(ar, fn) {
2726
for (var i = 0, j = ar.length; i < j; ++i) if (!fn(ar[i])) return f
@@ -60,7 +59,7 @@
6059
}
6160
scripts[path] = 1
6261
id && (ids[id] = 1)
63-
create(!validBase.test(path) && scriptpath ? scriptpath + path + '.js' : path, callback)
62+
create(!/^https?:\/\//.test(path) && scriptpath ? scriptpath + path + '.js' : path, callback)
6463
})
6564
}, 0)
6665
return $script
@@ -86,8 +85,7 @@
8685
$script.order = function (scripts, id, done) {
8786
(function callback(s) {
8887
s = scripts.shift()
89-
if (!scripts.length) $script(s, id, done)
90-
else $script(s, callback)
88+
!scripts.length ? $script(s, id, done) : $script(s, callback)
9189
}())
9290
}
9391

dist/script.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/script.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
(function (name, context, definition) {
1+
(function (name, definition) {
22
if (typeof module != 'undefined' && module.exports) module.exports = definition()
33
else if (typeof define == 'function' && define.amd) define(definition)
4-
else context[name] = definition()
5-
})('$script', this, function () {
4+
else this[name] = definition()
5+
})('$script', function () {
66
var doc = document
77
, head = doc.getElementsByTagName('head')[0]
8-
, validBase = /^https?:\/\//
98
, s = 'string'
109
, f = false
1110
, push = 'push'
1211
, readyState = 'readyState'
1312
, onreadystatechange = 'onreadystatechange'
14-
, scriptpath
1513
, list = {}
1614
, ids = {}
1715
, delay = {}
1816
, scripts = {}
17+
, scriptpath
1918

2019
function every(ar, fn) {
2120
for (var i = 0, j = ar.length; i < j; ++i) if (!fn(ar[i])) return f
@@ -54,7 +53,7 @@
5453
}
5554
scripts[path] = 1
5655
id && (ids[id] = 1)
57-
create(!validBase.test(path) && scriptpath ? scriptpath + path + '.js' : path, callback)
56+
create(!/^https?:\/\//.test(path) && scriptpath ? scriptpath + path + '.js' : path, callback)
5857
})
5958
}, 0)
6059
return $script
@@ -80,8 +79,7 @@
8079
$script.order = function (scripts, id, done) {
8180
(function callback(s) {
8281
s = scripts.shift()
83-
if (!scripts.length) $script(s, id, done)
84-
else $script(s, callback)
82+
!scripts.length ? $script(s, id, done) : $script(s, callback)
8583
}())
8684
}
8785

0 commit comments

Comments
 (0)