i18n-js 3.0.9 → 3.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39b2813fcbbec8bbb3dc23712043e5bbb9c34ad5a6a91c617f8fb7c43a6012df
4
- data.tar.gz: 209aed0138760420e27694a6b18747aaae0ba38cc81856cb25a5d00a1e88e100
3
+ metadata.gz: d881382110db91a98e8af030855cebf2636194145c9c67203391ecc6823d34ab
4
+ data.tar.gz: 4918d0712878f819a2c90a24e624ab1fe601fffbdd6abd5c6184c53838e2bef6
5
5
  SHA512:
6
- metadata.gz: 3a3e2a7b297f31c95064f81603623206f1e43b9d384858c56d8127243f121753ca0c441a6c5027a3e074f030211d737b8b34d15fe95c911c9367a9720b55d34e
7
- data.tar.gz: c94a433c6c4a720f454ff4fbd920d86c3605934c3b79c38d4e5935c60ae38a4f885e6b60cb338fb1a71d3cd93c1555af2df1d379daa8764607292d1ddbc5f2fa
6
+ metadata.gz: e6616ef9bf22c95974b742ce3f85177e50f13a4887d005865de1f8fe6f7e81f8bffc54c46df38311c6f22e8c37d0392d9ecf671185764edc6e87cc9b0f592503
7
+ data.tar.gz: cc7e6115c6fa710941512235e27fa241f9206bb366455cbc209a02ca587d3c9116ab2a67270591c408d8ac7f8136186487a200bb2d2bfa7a617a379374d96418
@@ -18,6 +18,16 @@ This project adheres to [Semantic Versioning](http://semver.org/).
18
18
  - Nothing
19
19
 
20
20
 
21
+ ## [3.0.10] - 2018-06-21
22
+
23
+ ### Fixed
24
+
25
+ - [JS] Fix extend method changing keys with `null` to empty objects
26
+ (PR: https://github.com/fnando/i18n-js/pull/503)
27
+ - [JS] Fix variable name in an internal method
28
+ (PR: https://github.com/fnando/i18n-js/pull/501)
29
+
30
+
21
31
  ## [3.0.9] - 2018-06-21
22
32
 
23
33
  ### Fixed
@@ -316,7 +326,8 @@ And today is not April Fools' Day
316
326
 
317
327
 
318
328
 
319
- [Unreleased]: https://github.com/fnando/i18n-js/compare/v3.0.9...HEAD
329
+ [Unreleased]: https://github.com/fnando/i18n-js/compare/v3.0.10...HEAD
330
+ [3.0.10]: https://github.com/fnando/i18n-js/compare/v3.0.9...v3.0.10
320
331
  [3.0.9]: https://github.com/fnando/i18n-js/compare/v3.0.8...v3.0.9
321
332
  [3.0.8]: https://github.com/fnando/i18n-js/compare/v3.0.7...v3.0.8
322
333
  [3.0.7]: https://github.com/fnando/i18n-js/compare/v3.0.6...v3.0.7
@@ -70,22 +70,26 @@
70
70
  var isArray = function(val) {
71
71
  if (Array.isArray) {
72
72
  return Array.isArray(val);
73
- };
73
+ }
74
74
  return Object.prototype.toString.call(val) === '[object Array]';
75
75
  };
76
76
 
77
77
  var isString = function(val) {
78
- return typeof value == 'string' || Object.prototype.toString.call(val) === '[object String]';
78
+ return typeof val === 'string' || Object.prototype.toString.call(val) === '[object String]';
79
79
  };
80
80
 
81
81
  var isNumber = function(val) {
82
- return typeof val == 'number' || Object.prototype.toString.call(val) === '[object Number]';
82
+ return typeof val === 'number' || Object.prototype.toString.call(val) === '[object Number]';
83
83
  };
84
84
 
85
85
  var isBoolean = function(val) {
86
86
  return val === true || val === false;
87
87
  };
88
88
 
89
+ var isNull = function(val) {
90
+ return val === null;
91
+ };
92
+
89
93
  var decimalAdjust = function(type, value, exp) {
90
94
  // If the exp is undefined or zero...
91
95
  if (typeof exp === 'undefined' || +exp === 0) {
@@ -117,7 +121,7 @@
117
121
  var key, value;
118
122
  for (key in obj) if (obj.hasOwnProperty(key)) {
119
123
  value = obj[key];
120
- if (isString(value) || isNumber(value) || isBoolean(value) || isArray(value)) {
124
+ if (isString(value) || isNumber(value) || isBoolean(value) || isArray(value) || isNull(value)) {
121
125
  dest[key] = value;
122
126
  } else {
123
127
  if (dest[key] == null) dest[key] = {};
@@ -2,6 +2,6 @@
2
2
 
3
3
  module I18n
4
4
  module JS
5
- VERSION = "3.0.9"
5
+ VERSION = "3.0.10"
6
6
  end
7
7
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18n-js",
3
- "version": "3.0.9",
3
+ "version": "3.0.10",
4
4
  "description": "A javascript library similar to Ruby on Rails i18n gem",
5
5
  "author": "Nando Vieira",
6
6
  "license": "MIT",
@@ -60,7 +60,7 @@ describe("Extend", function () {
60
60
  expect(I18n.extend(obj1, obj2)).toEqual(expected);
61
61
  });
62
62
 
63
- it("should correctly merge string, numberic and boolean values", function() {
63
+ it("should correctly merge string, numberic, boolean, and null values", function() {
64
64
  var obj1 = {
65
65
  test1: {
66
66
  test2: false
@@ -69,7 +69,8 @@ describe("Extend", function () {
69
69
  , obj2 = {
70
70
  test1: {
71
71
  test3: 23,
72
- test4: 'abc'
72
+ test4: 'abc',
73
+ test5: null
73
74
  }
74
75
  }
75
76
  , expected = {
@@ -77,6 +78,7 @@ describe("Extend", function () {
77
78
  test2: false
78
79
  , test3: 23
79
80
  , test4: 'abc'
81
+ , test5: null
80
82
  }
81
83
  }
82
84
 
@@ -18,6 +18,12 @@ describe("Translate", function(){
18
18
  expect(I18n.t("greetings")).toEqual(I18n.translations.en.greetings);
19
19
  });
20
20
 
21
+ it("returns missing message translation for valid scope with null", function(){
22
+ actual = I18n.t("null_key");
23
+ expected = '[missing "en.null_key" translation]';
24
+ expect(actual).toEqual(expected);
25
+ });
26
+
21
27
  it("returns missing message translation for invalid scope", function(){
22
28
  actual = I18n.t("invalid.scope");
23
29
  expected = '[missing "en.invalid.scope" translation]';
@@ -65,6 +65,8 @@ var DEBUG = false;
65
65
  "Another item with a param of {{value}}",
66
66
  "A last item with a param of {{value}}"
67
67
  ]
68
+
69
+ , null_key: null
68
70
  };
69
71
 
70
72
  Translations["en-US"] = {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-js
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.9
4
+ version: 3.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-21 00:00:00.000000000 Z
11
+ date: 2018-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n