mirror of https://github.com/zulip/zulip.git
billing: Use underscore built in contains function.
This commit is contained in:
parent
37c78abe14
commit
b89a10676a
|
@ -2,9 +2,3 @@ set_global('$', global.make_zjquery());
|
|||
set_global('page_params', {});
|
||||
|
||||
zrequire('helpers', "js/billing/helpers");
|
||||
|
||||
run_test("is_in_array", () => {
|
||||
var good_houses_array = ["Gryffindor", "Hufflepuff", "Ravenclaw"];
|
||||
assert.equal(helpers.is_in_array("Hufflepuff", good_houses_array), true);
|
||||
assert.equal(helpers.is_in_array("Slytherin", good_houses_array), false);
|
||||
});
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
var helpers = (function () {
|
||||
var exports = {};
|
||||
|
||||
exports.is_in_array = function (value, array) {
|
||||
return array.indexOf(value) > -1;
|
||||
};
|
||||
|
||||
exports.create_ajax_request = function (url, form_name, stripe_token = null) {
|
||||
var form = $("#" + form_name + "-form");
|
||||
var form_loading_indicator = "#" + form_name + "_loading_indicator";
|
||||
|
@ -27,7 +23,7 @@ exports.create_ajax_request = function (url, form_name, stripe_token = null) {
|
|||
}
|
||||
|
||||
form.serializeArray().forEach(function (item) {
|
||||
if (exports.is_in_array(item.name, numeric_inputs)) {
|
||||
if (_.contains(numeric_inputs, item.name)) {
|
||||
data[item.name] = item.value;
|
||||
} else {
|
||||
data[item.name] = JSON.stringify(item.value);
|
||||
|
|
Loading…
Reference in New Issue