1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Added linting for JavaScript tests.

This commit is contained in:
Nik Nyby
2015-08-26 00:24:55 -04:00
committed by Tim Graham
parent 0e925de245
commit 722bf23518
10 changed files with 58 additions and 15 deletions

View File

@@ -1,22 +1,30 @@
(function (globals) {
(function(globals) {
'use strict';
var django = globals.django || (globals.django = {});
django.pluralidx = function (count) { return (count == 1) ? 0 : 1; };
django.pluralidx = function(count) { return (count === 1) ? 0 : 1; };
/* gettext identity library */
django.gettext = function (msgid) { return msgid; };
django.ngettext = function (singular, plural, count) { return (count == 1) ? singular : plural; };
django.gettext_noop = function (msgid) { return msgid; };
django.pgettext = function (context, msgid) { return msgid; };
django.npgettext = function (context, singular, plural, count) { return (count == 1) ? singular : plural; };
django.gettext = function(msgid) { return msgid; };
django.ngettext = function(singular, plural, count) {
return (count === 1) ? singular : plural;
};
django.gettext_noop = function(msgid) { return msgid; };
django.pgettext = function(context, msgid) { return msgid; };
django.npgettext = function(context, singular, plural, count) {
return (count === 1) ? singular : plural;
};
django.interpolate = function (fmt, obj, named) {
django.interpolate = function(fmt, obj, named) {
if (named) {
return fmt.replace(/%\(\w+\)s/g, function(match){return String(obj[match.slice(2,-2)])});
return fmt.replace(/%\(\w+\)s/g, function(match) {
return String(obj[match.slice(2, -2)]);
});
} else {
return fmt.replace(/%s/g, function(match){return String(obj.shift())});
return fmt.replace(/%s/g, function(match) {
return String(obj.shift());
});
}
};
@@ -60,9 +68,9 @@
"YEAR_MONTH_FORMAT": "F Y"
};
django.get_format = function (format_type) {
django.get_format = function(format_type) {
var value = django.formats[format_type];
if (typeof(value) == 'undefined') {
if (typeof value === 'undefined') {
return format_type;
} else {
return value;