Expose the fp version of lodash via the API

This commit is contained in:
JC Brand 2017-06-07 09:15:22 +02:00
parent a128a70d41
commit b5ecc1fc6a
4 changed files with 15 additions and 9 deletions

View File

@ -38,8 +38,7 @@ require.config({
"text": "node_modules/text/text",
"typeahead": "components/typeahead.js/index",
"lodash": "node_modules/lodash/lodash",
"lodash.fpConverter": "3rdparty/lodash.fp",
"lodash.fp": "src/lodash.fp",
"lodash.converter": "3rdparty/lodash.fp",
"lodash.noconflict": "src/lodash.noconflict",
"underscore": "src/underscore-shim",
"utils": "src/utils",

View File

@ -21,7 +21,6 @@
"tpl!login_tab",
"tpl!search_contact",
"tpl!status_option",
"lodash.fp",
"converse-chatview",
"converse-rosterview"
], factory);
@ -39,8 +38,7 @@
tpl_login_panel,
tpl_login_tab,
tpl_search_contact,
tpl_status_option,
fp
tpl_status_option
) {
"use strict";
@ -52,6 +50,7 @@
// Other necessary globals
var $ = converse.env.jQuery,
_ = converse.env._,
fp = converse.env.fp,
moment = converse.env.moment;

View File

@ -9,6 +9,7 @@
define(["sizzle",
"jquery.noconflict",
"lodash.noconflict",
"lodash.converter",
"polyfill",
"utils",
"moment_with_locales",
@ -19,12 +20,18 @@
"backbone.browserStorage",
"backbone.overview",
], factory);
}(this, function (sizzle, $, _, polyfill, utils, moment, Strophe, pluggable, Backbone) {
}(this, function (
sizzle, $, _, lodashConverter, polyfill,
utils, moment, Strophe, pluggable, Backbone) {
/* Cannot use this due to Safari bug.
* See https://github.com/jcbrand/converse.js/issues/196
*/
// "use strict";
// Create the FP (functional programming) version of lodash
var fp = lodashConverter(_.runInContext());
// Strophe globals
var $build = Strophe.$build;
var $iq = Strophe.$iq;
@ -2351,6 +2358,7 @@
'Backbone': Backbone,
'Strophe': Strophe,
'_': _,
'fp': fp,
'b64_sha1': b64_sha1,
'jQuery': $,
'moment': moment,

View File

@ -29,7 +29,6 @@
"tpl!room_description",
"tpl!room_item",
"tpl!room_panel",
"lodash.fp",
"awesomplete",
"converse-chatview"
], factory);
@ -52,7 +51,6 @@
tpl_room_description,
tpl_room_item,
tpl_room_panel,
fp,
Awesomplete
) {
@ -73,6 +71,7 @@
// Other necessary globals
var $ = converse.env.jQuery,
_ = converse.env._,
fp = converse.env.fp,
moment = converse.env.moment;
// Add Strophe Namespaces
@ -375,7 +374,8 @@
// _converse.ChatBox to indicate unread messages which
// mention the user and `num_unread_general` to indicate
// generally unread messages (which *includes* mentions!).
'type': CHATROOMS_TYPE,
// FIXME: figure out why this breaks tests.
// 'type': CHATROOMS_TYPE,
'num_unread_general': 0
}),