From 5414b79562a10b9dee4513c759c38badd0f38e54 Mon Sep 17 00:00:00 2001 From: Marak Date: Tue, 7 Jul 2015 13:33:58 -0700 Subject: [PATCH] [fix] [api] Add title and separator properties to locales. Allow for mapping of string properties. Add missing categories property. --- index.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 49b39501a..5f784b44e 100644 --- a/index.js +++ b/index.js @@ -42,7 +42,6 @@ exports.localeFallback = "en"; exports.definitions = {}; -var _stringDefinitions = ["title", "separator"]; var _definitions = { "name": ["first_name", "last_name", "prefix", "suffix", "title", "male_first_name", "female_first_name", "male_middle_name", "female_middle_name", "male_last_name", "female_last_name"], @@ -53,22 +52,22 @@ var _definitions = { "phone_number": ["formats"], "finance": ["account_type", "transaction_type", "currency"], "internet": ["avatar_uri", "domain_suffix", "free_email", "password"], - "commerce": ["color", "department", "product_name", "price"] + "commerce": ["color", "department", "product_name", "price", "categories"], + "title": "", + "separator": "" }; -_stringDefinitions.forEach(function(d) { - if (typeof locales[exports.locale][d] === "undefined") { - exports.definitions[d] = locales[exports.localeFallback][d]; - } else { - exports.definitions[d] = locales[exports.locale][d]; - } -}); - // Create a Getter for all definitions.foo.bar propetries Object.keys(_definitions).forEach(function(d){ if (typeof exports.definitions[d] === "undefined") { exports.definitions[d] = {}; } + + if (typeof _definitions[d] === "string") { + exports.definitions[d] = locales[exports.locale][d]; + return; + } + _definitions[d].forEach(function(p){ Object.defineProperty(exports.definitions[d], p, { get: function () {