From 01b994ac95489b793d5b6cab1238f2f1891da7ee Mon Sep 17 00:00:00 2001 From: natlibfi-arlehiko Date: Fri, 25 Mar 2016 23:26:21 +0200 Subject: [PATCH] Add AMD support --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 42bd526..843c5e3 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,4 @@ +/* global define */ (function (global, module) { // Browser compatibility var simple = module.exports var mocks = [] @@ -208,7 +209,11 @@ var funcClass = '[object Function]' // Browser compatibility - if (typeof window !== 'undefined') { + if (typeof define === 'function' && define.amd) { + define(function () { + return simple + }) + } else if (typeof window !== 'undefined') { window.simple = simple }