{"action":"created","issue":{"url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/issues/51","labels_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/issues/51/comments","events_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/issues/51/events","html_url":"https://github.com/bazaarvoice/bv-ui-core/pull/51","id":127755066,"number":51,"title":"JST-7: Add region module","user":{"login":"taylormck","id":2374670,"avatar_url":"https://avatars.githubusercontent.com/u/2374670?v=3","gravatar_id":"","url":"https://api.github.com/users/taylormck","html_url":"https://github.com/taylormck","followers_url":"https://api.github.com/users/taylormck/followers","following_url":"https://api.github.com/users/taylormck/following{/other_user}","gists_url":"https://api.github.com/users/taylormck/gists{/gist_id}","starred_url":"https://api.github.com/users/taylormck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taylormck/subscriptions","organizations_url":"https://api.github.com/users/taylormck/orgs","repos_url":"https://api.github.com/users/taylormck/repos","events_url":"https://api.github.com/users/taylormck/events{/privacy}","received_events_url":"https://api.github.com/users/taylormck/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2016-01-20T18:39:14Z","updated_at":"2016-01-22T20:19:33Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/pulls/51","html_url":"https://github.com/bazaarvoice/bv-ui-core/pull/51","diff_url":"https://github.com/bazaarvoice/bv-ui-core/pull/51.diff","patch_url":"https://github.com/bazaarvoice/bv-ui-core/pull/51.patch"},"body":"## What's in this PR ?\r\n\r\nNew laws in the EU require that identifying information stay physically located in the EU. In order to comply with this, we'll need to be able to tell when we're running in the EU. It has been determined that the onus of providing the correct locale is on the client, so we can safely rely on the base locale of an implementation.\r\n\r\nThis PR adds a module that UI projects can use to determine if it's in EU or not. It has been designed with extensibility in mind, in case we want to add support for detecting other regions in the future.\r\n\r\n## How to verify\r\n\r\n1. Check out this PR\r\n1. In the `bv-ui-core` repo, run `node`.\r\n1. Run `var region = require('./lib/region');` to get a reference to the root module.\r\n1. Run `region.isEULocale('en_US');`. Should return `false`.\r\n1. Run `region.isEULocale('en_GB');`. Should return `true`.\r\n1. If you prefer, instead of the \"generic\" module, you can run `var isEULocale = require('./lib/region/EU');` to load the EU specific module. Useful if you're trying to keep file size down and aren't worried about detecting other regions in the future.\r\n1. Feel free to try it out with a bunch of different locales. The list of country codes provided in this PR is intended to be the official EU list.\r\n\r\n## Unit tests\r\n\r\nSo long as you have the npm modules installed, you can run the unit tests with a simple `npm test`."},"comment":{"url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/issues/comments/174035656","html_url":"https://github.com/bazaarvoice/bv-ui-core/pull/51#issuecomment-174035656","issue_url":"https://api.github.com/repos/bazaarvoice/bv-ui-core/issues/51","id":174035656,"user":{"login":"danheberden","id":307962,"avatar_url":"https://avatars.githubusercontent.com/u/307962?v=3","gravatar_id":"","url":"https://api.github.com/users/danheberden","html_url":"https://github.com/danheberden","followers_url":"https://api.github.com/users/danheberden/followers","following_url":"https://api.github.com/users/danheberden/following{/other_user}","gists_url":"https://api.github.com/users/danheberden/gists{/gist_id}","starred_url":"https://api.github.com/users/danheberden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danheberden/subscriptions","organizations_url":"https://api.github.com/users/danheberden/orgs","repos_url":"https://api.github.com/users/danheberden/repos","events_url":"https://api.github.com/users/danheberden/events{/privacy}","received_events_url":"https://api.github.com/users/danheberden/received_events","type":"User","site_admin":false},"created_at":"2016-01-22T20:19:33Z","updated_at":"2016-01-22T20:19:33Z","body":"```js\r\nvar apac = require('./lib/region/apac');\r\napac.contains('ja_JP');\r\n\r\nvar europe = require('./lib/region/europe');\r\neurope.contains('en_GB');\r\n```\r\n\r\ni'd argue about file size, though, because i'd want a comprehensive list. E.g., \r\n\r\n```js\r\nvar region = require('bv-ui-core/lib/region'); \r\nregion.lookup('en_GB'); // prints out what region it is\r\nregion('europe'); // returns europe locales\r\nregion('europe').contains('en_GB'); // boolean for presence\r\n```\r\n\r\n"}}