8000 Attempt umdjs to resolve observed module export issues (ref #116, #11… · VirtualNetworks/parser@7c65e0a · GitHub
[go: up one dir, main page]

Skip to content

Commit 7c65e0a

Browse files
committed
Attempt umdjs to resolve observed module export issues (ref twilio#116, twilio#111, twilio#96, twilio#91, twilio#78 and others...)
1 parent 2bf1f74 commit 7c65e0a

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

Changelog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Intended v1.3.18
2+
+ Use umdjs to export store.js
3+
14
v1.3.17
25
+ Add store.has
36
+ Add store.get default value, e.g `store.get('foo', 1)`

store+json2.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.

store.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
1-
;(function(win){
1+
// Module export pattern from
2+
// https://github.com/umdjs/umd/blob/master/returnExports.js
3+
;(function (root, factory) {
4+
if (typeof define === 'function' && define.amd) {
5+
// AMD. Register as an anonymous module.
6+
define([], factory);
7+
} else if (typeof exports === 'object') {
8+
// Node. Does not work with strict CommonJS, but
9+
// only CommonJS-like environments that support module.exports,
10+
// like Node.
11+
module.exports = factory();
12+
} else {
13+
// Browser globals (root is window)
14+
root.store = factory();
15+
}
16+
}(this, function () {
17+
18+
// Store.js
219
var store = {},
20+
win = window,
321
doc = win.document,
422
localStorageName = 'localStorage',
523
scriptTag = 'script',
@@ -167,9 +185,6 @@
167185
store.disabled = true
168186
}
169187
store.enabled = !store.disabled
170-
171-
if (typeof module != 'undefined' && module.exports && this.module !== module) { module.exports = store }
172-
else if (typeof define === 'function' && define.amd) { define(store) }
173-
else { win.store = store }
174-
175-
})(Function('return this')());
188+
189+
return store
190+
}));

store.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.

0 commit comments

Comments
 (0)
0