From 34ed6cea0204e1e9d3f5cedc7f8a4fb26ec22aa7 Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Wed, 17 Dec 2014 13:00:59 -0800 Subject: [PATCH] Add Lo-Dash + loader --- lib/lodash.js | 21 +++++++++++++++++++++ package.json | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 lib/lodash.js diff --git a/lib/lodash.js b/lib/lodash.js new file mode 100644 index 0000000..72844f8 --- /dev/null +++ b/lib/lodash.js @@ -0,0 +1,21 @@ +"use strict"; + +// loader for Lo-Dash. +// +// will load the compatability version on JS implementations with less support +// for ES5 features (Tessel, etc) + +var isTessel = function() { + try { + require("tessel"); + return true; + } catch (e) { + return false; + } +}; + +if (isTessel()) { + module.exports = require("lodash/dist/lodash.compat"); +} else { + module.exports = require("lodash"); +} diff --git a/package.json b/package.json index 141fcca..8abfa04 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "async": "0.9.0", "express": "4.10.5", "body-parser": "1.10.0", - "robeaux": "0.3.0" + "robeaux": "0.3.0", + "lodash": "2.4.1" } }