Skip to content

Commit 715748e

Browse files
committed
FEAT: Extend to support global definition (no module loader)
1 parent 342a79f commit 715748e

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

IArray.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
/* global define */
22

3+
/*
4+
This Universal Module Definition (UMD) handles AMD, CommonJS, and Eki module loaders.
5+
If none of those is detected, it defines IArray on the global context.
6+
*/
37
(function(global, factory) {
48
if(typeof define === "function" && define.amd)
59
define(factory)
610
else if(typeof eki === "object" && eki.def)
711
eki.def("IArray", factory)
812
else if(typeof exports === "object")
913
module.exports = factory()
14+
else
15+
global.IArray = factory()
1016
}(this, function() {
1117

1218
"use strict"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "IArray",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "Immutable Array",
55
"main": "IArray.js",
66
"scripts": {

test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@
466466
assert.deepEqual(a1.toArray(), [5, 10, 20]) // unchanged
467467
assert.deepEqual(a2.toArray(), [5, 10, 20]) // unchanged
468468
assert.deepEqual(a3.toArray(), [6, 5, 10, 20]) // 6 prepended to start
469-
assert.deepEqual(a4, IArray([ "hello", "world", 5, 10, 20])) // prepended to start
469+
assert.deepEqual(a4.toArray(), [ "hello", "world", 5, 10, 20]) // prepended to start
470470

471471
})
472472
}

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
22
# yarn lockfile v1
3-
tarsy:
3+
tarsy@^0.5.1:
44
version "0.5.1"
55
resolved "https://registry.yarnpkg.com/tarsy/-/tarsy-0.5.1.tgz#21b2116c644ba5e595163add4cd49f705d8351c1"
66

0 commit comments

Comments
 (0)