├── README.md ├── LICENSE └── ChanceDynamicValue.js /README.md: -------------------------------------------------------------------------------- 1 | #Chance Dynamic Value (Paw Extension) 2 | 3 | A Paw Extension that generates random strings, numbers, etc. based on [Chance.js](http://chancejs.com) 4 | 5 | ![](http://i.imgur.com/Bn0ItrY.png "Preview") 6 | ![](http://i.imgur.com/RAeMuBx.png "Preview") 7 | ![](http://i.imgur.com/3jqqqNM.png "Preview") 8 | 9 | 10 | ##License 11 | 12 | This Paw Extension is released under the [MIT License](LICENSE). Feel free to fork, and modify! 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 atan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /ChanceDynamicValue.js: -------------------------------------------------------------------------------- 1 | // Chance.js 1.0.3 2 | // http://chancejs.com 3 | // (c) 2013 Victor Quinn 4 | // Chance may be freely distributed or modified under the MIT license. 5 | // Constants 6 | var MAX_INT = 9007199254740992; 7 | var MIN_INT = -MAX_INT; 8 | var NUMBERS = '0123456789'; 9 | var CHARS_LOWER = 'abcdefghijklmnopqrstuvwxyz'; 10 | var CHARS_UPPER = CHARS_LOWER.toUpperCase(); 11 | var HEX_POOL = NUMBERS + "abcdef"; 12 | 13 | // Cached array helpers 14 | var slice = Array.prototype.slice; 15 | 16 | // Constructor 17 | function Chance (seed) { 18 | if (!(this instanceof Chance)) { 19 | return seed == null ? new Chance() : new Chance(seed); 20 | } 21 | 22 | // if user has provided a function, use that as the generator 23 | if (typeof seed === 'function') { 24 | this.random = seed; 25 | return this; 26 | } 27 | 28 | if (arguments.length) { 29 | // set a starting value of zero so we can add to it 30 | this.seed = 0; 31 | } 32 | 33 | // otherwise, leave this.seed blank so that MT will receive a blank 34 | 35 | for (var i = 0; i < arguments.length; i++) { 36 | var seedling = 0; 37 | if (Object.prototype.toString.call(arguments[i]) === '[object String]') { 38 | for (var j = 0; j < arguments[i].length; j++) { 39 | // create a numeric hash for each argument, add to seedling 40 | var hash = 0; 41 | for (var k = 0; k < arguments[i].length; k++) { 42 | hash = arguments[i].charCodeAt(k) + (hash << 6) + (hash << 16) - hash; 43 | } 44 | seedling += hash; 45 | } 46 | } else { 47 | seedling = arguments[i]; 48 | } 49 | this.seed += (arguments.length - i) * seedling; 50 | } 51 | 52 | // If no generator function was provided, use our MT 53 | this.mt = this.mersenne_twister(this.seed); 54 | this.bimd5 = this.blueimp_md5(); 55 | this.random = function () { 56 | return this.mt.random(this.seed); 57 | }; 58 | 59 | return this; 60 | } 61 | 62 | Chance.prototype.VERSION = "1.0.3"; 63 | 64 | // Random helper functions 65 | function initOptions(options, defaults) { 66 | options || (options = {}); 67 | 68 | if (defaults) { 69 | for (var i in defaults) { 70 | if (typeof options[i] === 'undefined') { 71 | options[i] = defaults[i]; 72 | } 73 | } 74 | } 75 | 76 | return options; 77 | } 78 | 79 | function testRange(test, errorMessage) { 80 | if (test) { 81 | throw new RangeError(errorMessage); 82 | } 83 | } 84 | 85 | /** 86 | * Encode the input string with Base64. 87 | */ 88 | var base64 = function() { 89 | throw new Error('No Base64 encoder available.'); 90 | }; 91 | 92 | // Select proper Base64 encoder. 93 | (function determineBase64Encoder() { 94 | if (typeof btoa === 'function') { 95 | base64 = btoa; 96 | } else if (typeof Buffer === 'function') { 97 | base64 = function(input) { 98 | return new Buffer(input).toString('base64'); 99 | }; 100 | } 101 | })(); 102 | 103 | // -- Basics -- 104 | 105 | /** 106 | * Return a random bool, either true or false 107 | * 108 | * @param {Object} [options={ likelihood: 50 }] alter the likelihood of 109 | * receiving a true or false value back. 110 | * @throws {RangeError} if the likelihood is out of bounds 111 | * @returns {Bool} either true or false 112 | */ 113 | Chance.prototype.bool = function (options) { 114 | // likelihood of success (true) 115 | options = initOptions(options, {likelihood : 50}); 116 | 117 | // Note, we could get some minor perf optimizations by checking range 118 | // prior to initializing defaults, but that makes code a bit messier 119 | // and the check more complicated as we have to check existence of 120 | // the object then existence of the key before checking constraints. 121 | // Since the options initialization should be minor computationally, 122 | // decision made for code cleanliness intentionally. This is mentioned 123 | // here as it's the first occurrence, will not be mentioned again. 124 | testRange( 125 | options.likelihood < 0 || options.likelihood > 100, 126 | "Chance: Likelihood accepts values from 0 to 100." 127 | ); 128 | 129 | return this.random() * 100 < options.likelihood; 130 | }; 131 | 132 | /** 133 | * Return a random character. 134 | * 135 | * @param {Object} [options={}] can specify a character pool, only alpha, 136 | * only symbols, and casing (lower or upper) 137 | * @returns {String} a single random character 138 | * @throws {RangeError} Can only specify alpha or symbols, not both 139 | */ 140 | Chance.prototype.character = function (options) { 141 | options = initOptions(options); 142 | testRange( 143 | options.alpha && options.symbols, 144 | "Chance: Cannot specify both alpha and symbols." 145 | ); 146 | 147 | var symbols = "!@#$%^&*()[]", 148 | letters, pool; 149 | 150 | if (options.casing === 'lower') { 151 | letters = CHARS_LOWER; 152 | } else if (options.casing === 'upper') { 153 | letters = CHARS_UPPER; 154 | } else { 155 | letters = CHARS_LOWER + CHARS_UPPER; 156 | } 157 | 158 | if (options.pool) { 159 | pool = options.pool; 160 | } else if (options.alpha) { 161 | pool = letters; 162 | } else if (options.symbols) { 163 | pool = symbols; 164 | } else { 165 | pool = letters + NUMBERS + symbols; 166 | } 167 | 168 | return pool.charAt(this.natural({max: (pool.length - 1)})); 169 | }; 170 | 171 | // Note, wanted to use "float" or "double" but those are both JS reserved words. 172 | 173 | // Note, fixed means N OR LESS digits after the decimal. This because 174 | // It could be 14.9000 but in JavaScript, when this is cast as a number, 175 | // the trailing zeroes are dropped. Left to the consumer if trailing zeroes are 176 | // needed 177 | /** 178 | * Return a random floating point number 179 | * 180 | * @param {Object} [options={}] can specify a fixed precision, min, max 181 | * @returns {Number} a single floating point number 182 | * @throws {RangeError} Can only specify fixed or precision, not both. Also 183 | * min cannot be greater than max 184 | */ 185 | Chance.prototype.floating = function (options) { 186 | options = initOptions(options, {fixed : 4}); 187 | testRange( 188 | options.fixed && options.precision, 189 | "Chance: Cannot specify both fixed and precision." 190 | ); 191 | 192 | var num; 193 | var fixed = Math.pow(10, options.fixed); 194 | 195 | var max = MAX_INT / fixed; 196 | var min = -max; 197 | 198 | testRange( 199 | options.min && options.fixed && options.min < min, 200 | "Chance: Min specified is out of range with fixed. Min should be, at least, " + min 201 | ); 202 | testRange( 203 | options.max && options.fixed && options.max > max, 204 | "Chance: Max specified is out of range with fixed. Max should be, at most, " + max 205 | ); 206 | 207 | options = initOptions(options, { min : min, max : max }); 208 | 209 | // Todo - Make this work! 210 | // options.precision = (typeof options.precision !== "undefined") ? options.precision : false; 211 | 212 | num = this.integer({min: options.min * fixed, max: options.max * fixed}); 213 | var num_fixed = (num / fixed).toFixed(options.fixed); 214 | 215 | return parseFloat(num_fixed); 216 | }; 217 | 218 | /** 219 | * Return a random integer 220 | * 221 | * NOTE the max and min are INCLUDED in the range. So: 222 | * chance.integer({min: 1, max: 3}); 223 | * would return either 1, 2, or 3. 224 | * 225 | * @param {Object} [options={}] can specify a min and/or max 226 | * @returns {Number} a single random integer number 227 | * @throws {RangeError} min cannot be greater than max 228 | */ 229 | Chance.prototype.integer = function (options) { 230 | // 9007199254740992 (2^53) is the max integer number in JavaScript 231 | // See: http://vq.io/132sa2j 232 | options = initOptions(options, {min: MIN_INT, max: MAX_INT}); 233 | testRange(options.min > options.max, "Chance: Min cannot be greater than Max."); 234 | 235 | return Math.floor(this.random() * (options.max - options.min + 1) + options.min); 236 | }; 237 | 238 | /** 239 | * Return a random natural 240 | * 241 | * NOTE the max and min are INCLUDED in the range. So: 242 | * chance.natural({min: 1, max: 3}); 243 | * would return either 1, 2, or 3. 244 | * 245 | * @param {Object} [options={}] can specify a min and/or max 246 | * @returns {Number} a single random integer number 247 | * @throws {RangeError} min cannot be greater than max 248 | */ 249 | Chance.prototype.natural = function (options) { 250 | options = initOptions(options, {min: 0, max: MAX_INT}); 251 | testRange(options.min < 0, "Chance: Min cannot be less than zero."); 252 | return this.integer(options); 253 | }; 254 | 255 | /** 256 | * Return a random string 257 | * 258 | * @param {Object} [options={}] can specify a length 259 | * @returns {String} a string of random length 260 | * @throws {RangeError} length cannot be less than zero 261 | */ 262 | Chance.prototype.string = function (options) { 263 | options = initOptions(options, { length: this.natural({min: 5, max: 20}) }); 264 | testRange(options.length < 0, "Chance: Length cannot be less than zero."); 265 | var length = options.length, 266 | text = this.n(this.character, length, options); 267 | 268 | return text.join(""); 269 | }; 270 | 271 | // -- End Basics -- 272 | 273 | // -- Helpers -- 274 | 275 | Chance.prototype.capitalize = function (word) { 276 | return word.charAt(0).toUpperCase() + word.substr(1); 277 | }; 278 | 279 | Chance.prototype.mixin = function (obj) { 280 | for (var func_name in obj) { 281 | Chance.prototype[func_name] = obj[func_name]; 282 | } 283 | return this; 284 | }; 285 | 286 | /** 287 | * Given a function that generates something random and a number of items to generate, 288 | * return an array of items where none repeat. 289 | * 290 | * @param {Function} fn the function that generates something random 291 | * @param {Number} num number of terms to generate 292 | * @param {Object} options any options to pass on to the generator function 293 | * @returns {Array} an array of length `num` with every item generated by `fn` and unique 294 | * 295 | * There can be more parameters after these. All additional parameters are provided to the given function 296 | */ 297 | Chance.prototype.unique = function(fn, num, options) { 298 | testRange( 299 | typeof fn !== "function", 300 | "Chance: The first argument must be a function." 301 | ); 302 | 303 | var comparator = function(arr, val) { return arr.indexOf(val) !== -1; }; 304 | 305 | if (options) { 306 | comparator = options.comparator || comparator; 307 | } 308 | 309 | var arr = [], count = 0, result, MAX_DUPLICATES = num * 50, params = slice.call(arguments, 2); 310 | 311 | while (arr.length < num) { 312 | var clonedParams = JSON.parse(JSON.stringify(params)); 313 | result = fn.apply(this, clonedParams); 314 | if (!comparator(arr, result)) { 315 | arr.push(result); 316 | // reset count when unique found 317 | count = 0; 318 | } 319 | 320 | if (++count > MAX_DUPLICATES) { 321 | throw new RangeError("Chance: num is likely too large for sample set"); 322 | } 323 | } 324 | return arr; 325 | }; 326 | 327 | /** 328 | * Gives an array of n random terms 329 | * 330 | * @param {Function} fn the function that generates something random 331 | * @param {Number} n number of terms to generate 332 | * @returns {Array} an array of length `n` with items generated by `fn` 333 | * 334 | * There can be more parameters after these. All additional parameters are provided to the given function 335 | */ 336 | Chance.prototype.n = function(fn, n) { 337 | testRange( 338 | typeof fn !== "function", 339 | "Chance: The first argument must be a function." 340 | ); 341 | 342 | if (typeof n === 'undefined') { 343 | n = 1; 344 | } 345 | var i = n, arr = [], params = slice.call(arguments, 2); 346 | 347 | // Providing a negative count should result in a noop. 348 | i = Math.max( 0, i ); 349 | 350 | for (null; i--; null) { 351 | arr.push(fn.apply(this, params)); 352 | } 353 | 354 | return arr; 355 | }; 356 | 357 | // H/T to SO for this one: http://vq.io/OtUrZ5 358 | Chance.prototype.pad = function (number, width, pad) { 359 | // Default pad to 0 if none provided 360 | pad = pad || '0'; 361 | // Convert number to a string 362 | number = number + ''; 363 | return number.length >= width ? number : new Array(width - number.length + 1).join(pad) + number; 364 | }; 365 | 366 | // DEPRECATED on 2015-10-01 367 | Chance.prototype.pick = function (arr, count) { 368 | if (arr.length === 0) { 369 | throw new RangeError("Chance: Cannot pick() from an empty array"); 370 | } 371 | if (!count || count === 1) { 372 | return arr[this.natural({max: arr.length - 1})]; 373 | } else { 374 | return this.shuffle(arr).slice(0, count); 375 | } 376 | }; 377 | 378 | // Given an array, returns a single random element 379 | Chance.prototype.pickone = function (arr) { 380 | if (arr.length === 0) { 381 | throw new RangeError("Chance: Cannot pickone() from an empty array"); 382 | } 383 | return arr[this.natural({max: arr.length - 1})]; 384 | }; 385 | 386 | // Given an array, returns a random set with 'count' elements 387 | Chance.prototype.pickset = function (arr, count) { 388 | if (count === 0) { 389 | return []; 390 | } 391 | if (arr.length === 0) { 392 | throw new RangeError("Chance: Cannot pickset() from an empty array"); 393 | } 394 | if (count < 0) { 395 | throw new RangeError("Chance: count must be positive number"); 396 | } 397 | if (!count || count === 1) { 398 | return [ this.pickone(arr) ]; 399 | } else { 400 | return this.shuffle(arr).slice(0, count); 401 | } 402 | }; 403 | 404 | Chance.prototype.shuffle = function (arr) { 405 | var old_array = arr.slice(0), 406 | new_array = [], 407 | j = 0, 408 | length = Number(old_array.length); 409 | 410 | for (var i = 0; i < length; i++) { 411 | // Pick a random index from the array 412 | j = this.natural({max: old_array.length - 1}); 413 | // Add it to the new array 414 | new_array[i] = old_array[j]; 415 | // Remove that element from the original array 416 | old_array.splice(j, 1); 417 | } 418 | 419 | return new_array; 420 | }; 421 | 422 | // Returns a single item from an array with relative weighting of odds 423 | Chance.prototype.weighted = function (arr, weights, trim) { 424 | if (arr.length !== weights.length) { 425 | throw new RangeError("Chance: length of array and weights must match"); 426 | } 427 | 428 | // scan weights array and sum valid entries 429 | var sum = 0; 430 | var val; 431 | for (var weightIndex = 0; weightIndex < weights.length; ++weightIndex) { 432 | val = weights[weightIndex]; 433 | if (val > 0) { 434 | sum += val; 435 | } 436 | } 437 | 438 | if (sum === 0) { 439 | throw new RangeError("Chance: no valid entries in array weights"); 440 | } 441 | 442 | // select a value within range 443 | var selected = this.random() * sum; 444 | 445 | // find array entry corresponding to selected value 446 | var total = 0; 447 | var lastGoodIdx = -1; 448 | var chosenIdx; 449 | for (weightIndex = 0; weightIndex < weights.length; ++weightIndex) { 450 | val = weights[weightIndex]; 451 | total += val; 452 | if (val > 0) { 453 | if (selected <= total) { 454 | chosenIdx = weightIndex; 455 | break; 456 | } 457 | lastGoodIdx = weightIndex; 458 | } 459 | 460 | // handle any possible rounding error comparison to ensure something is picked 461 | if (weightIndex === (weights.length - 1)) { 462 | chosenIdx = lastGoodIdx; 463 | } 464 | } 465 | 466 | var chosen = arr[chosenIdx]; 467 | trim = (typeof trim === 'undefined') ? false : trim; 468 | if (trim) { 469 | arr.splice(chosenIdx, 1); 470 | weights.splice(chosenIdx, 1); 471 | } 472 | 473 | return chosen; 474 | }; 475 | 476 | // -- End Helpers -- 477 | 478 | // -- Text -- 479 | 480 | Chance.prototype.paragraph = function (options) { 481 | options = initOptions(options); 482 | 483 | var sentences = options.sentences || this.natural({min: 3, max: 7}), 484 | sentence_array = this.n(this.sentence, sentences); 485 | 486 | return sentence_array.join(' '); 487 | }; 488 | 489 | // Could get smarter about this than generating random words and 490 | // chaining them together. Such as: http://vq.io/1a5ceOh 491 | Chance.prototype.sentence = function (options) { 492 | options = initOptions(options); 493 | 494 | var words = options.words || this.natural({min: 12, max: 18}), 495 | punctuation = options.punctuation, 496 | text, word_array = this.n(this.word, words); 497 | 498 | text = word_array.join(' '); 499 | 500 | // Capitalize first letter of sentence 501 | text = this.capitalize(text); 502 | 503 | // Make sure punctuation has a usable value 504 | if (punctuation !== false && !/^[\.\?;!:]$/.test(punctuation)) { 505 | punctuation = '.'; 506 | } 507 | 508 | // Add punctuation mark 509 | if (punctuation) { 510 | text += punctuation; 511 | } 512 | 513 | return text; 514 | }; 515 | 516 | Chance.prototype.syllable = function (options) { 517 | options = initOptions(options); 518 | 519 | var length = options.length || this.natural({min: 2, max: 3}), 520 | consonants = 'bcdfghjklmnprstvwz', // consonants except hard to speak ones 521 | vowels = 'aeiou', // vowels 522 | all = consonants + vowels, // all 523 | text = '', 524 | chr; 525 | 526 | // I'm sure there's a more elegant way to do this, but this works 527 | // decently well. 528 | for (var i = 0; i < length; i++) { 529 | if (i === 0) { 530 | // First character can be anything 531 | chr = this.character({pool: all}); 532 | } else if (consonants.indexOf(chr) === -1) { 533 | // Last character was a vowel, now we want a consonant 534 | chr = this.character({pool: consonants}); 535 | } else { 536 | // Last character was a consonant, now we want a vowel 537 | chr = this.character({pool: vowels}); 538 | } 539 | 540 | text += chr; 541 | } 542 | 543 | if (options.capitalize) { 544 | text = this.capitalize(text); 545 | } 546 | 547 | return text; 548 | }; 549 | 550 | Chance.prototype.word = function (options) { 551 | options = initOptions(options); 552 | 553 | testRange( 554 | options.syllables && options.length, 555 | "Chance: Cannot specify both syllables AND length." 556 | ); 557 | 558 | var syllables = options.syllables || this.natural({min: 1, max: 3}), 559 | text = ''; 560 | 561 | if (options.length) { 562 | // Either bound word by length 563 | do { 564 | text += this.syllable(); 565 | } while (text.length < options.length); 566 | text = text.substring(0, options.length); 567 | } else { 568 | // Or by number of syllables 569 | for (var i = 0; i < syllables; i++) { 570 | text += this.syllable(); 571 | } 572 | } 573 | 574 | if (options.capitalize) { 575 | text = this.capitalize(text); 576 | } 577 | 578 | return text; 579 | }; 580 | 581 | // -- End Text -- 582 | 583 | // -- Person -- 584 | 585 | Chance.prototype.age = function (options) { 586 | options = initOptions(options); 587 | var ageRange; 588 | 589 | switch (options.type) { 590 | case 'child': 591 | ageRange = {min: 1, max: 12}; 592 | break; 593 | case 'teen': 594 | ageRange = {min: 13, max: 19}; 595 | break; 596 | case 'adult': 597 | ageRange = {min: 18, max: 65}; 598 | break; 599 | case 'senior': 600 | ageRange = {min: 65, max: 100}; 601 | break; 602 | case 'all': 603 | ageRange = {min: 1, max: 100}; 604 | break; 605 | default: 606 | ageRange = {min: 18, max: 65}; 607 | break; 608 | } 609 | 610 | return this.natural(ageRange); 611 | }; 612 | 613 | Chance.prototype.birthday = function (options) { 614 | options = initOptions(options, { 615 | year: (new Date().getFullYear() - this.age(options)) 616 | }); 617 | 618 | return this.date(options); 619 | }; 620 | 621 | // CPF; ID to identify taxpayers in Brazil 622 | Chance.prototype.cpf = function () { 623 | var n = this.n(this.natural, 9, { max: 9 }); 624 | var d1 = n[8]*2+n[7]*3+n[6]*4+n[5]*5+n[4]*6+n[3]*7+n[2]*8+n[1]*9+n[0]*10; 625 | d1 = 11 - (d1 % 11); 626 | if (d1>=10) { 627 | d1 = 0; 628 | } 629 | var d2 = d1*2+n[8]*3+n[7]*4+n[6]*5+n[5]*6+n[4]*7+n[3]*8+n[2]*9+n[1]*10+n[0]*11; 630 | d2 = 11 - (d2 % 11); 631 | if (d2>=10) { 632 | d2 = 0; 633 | } 634 | return ''+n[0]+n[1]+n[2]+'.'+n[3]+n[4]+n[5]+'.'+n[6]+n[7]+n[8]+'-'+d1+d2; 635 | }; 636 | 637 | // CNPJ: ID to identify companies in Brazil 638 | Chance.prototype.cnpj = function () { 639 | var n = this.n(this.natural, 12, { max: 12 }); 640 | var d1 = n[11]*2+n[10]*3+n[9]*4+n[8]*5+n[7]*6+n[6]*7+n[5]*8+n[4]*9+n[3]*2+n[2]*3+n[1]*4+n[0]*5; 641 | d1 = 11 - (d1 % 11); 642 | if (d1<2) { 643 | d1 = 0; 644 | } 645 | var d2 = d1*2+n[11]*3+n[10]*4+n[9]*5+n[8]*6+n[7]*7+n[6]*8+n[5]*9+n[4]*2+n[3]*3+n[2]*4+n[1]*5+n[0]*6; 646 | d2 = 11 - (d2 % 11); 647 | if (d2<2) { 648 | d2 = 0; 649 | } 650 | return ''+n[0]+n[1]+'.'+n[2]+n[3]+n[4]+'.'+n[5]+n[6]+n[7]+'/'+n[8]+n[9]+n[10]+n[11]+'-'+d1+d2; 651 | }; 652 | 653 | Chance.prototype.first = function (options) { 654 | options = initOptions(options, {gender: this.gender(), nationality: 'en'}); 655 | return this.pick(this.get("firstNames")[options.gender.toLowerCase()][options.nationality.toLowerCase()]); 656 | }; 657 | 658 | Chance.prototype.gender = function () { 659 | return this.pick(['Male', 'Female']); 660 | }; 661 | 662 | Chance.prototype.last = function (options) { 663 | options = initOptions(options, {nationality: 'en'}); 664 | return this.pick(this.get("lastNames")[options.nationality.toLowerCase()]); 665 | }; 666 | 667 | Chance.prototype.israelId=function(){ 668 | var x=this.string({pool: '0123456789',length:8}); 669 | var y=0; 670 | for (var i=0;i hex 992 | * -> rgb 993 | * -> rgba 994 | * -> 0x 995 | * -> named color 996 | * 997 | * #Examples: 998 | * =============================================== 999 | * * Geerate random hex color 1000 | * chance.color() => '#79c157' / 'rgb(110,52,164)' / '0x67ae0b' / '#e2e2e2' / '#29CFA7' 1001 | * 1002 | * * Generate Hex based color value 1003 | * chance.color({format: 'hex'}) => '#d67118' 1004 | * 1005 | * * Generate simple rgb value 1006 | * chance.color({format: 'rgb'}) => 'rgb(110,52,164)' 1007 | * 1008 | * * Generate Ox based color value 1009 | * chance.color({format: '0x'}) => '0x67ae0b' 1010 | * 1011 | * * Generate graiscale based value 1012 | * chance.color({grayscale: true}) => '#e2e2e2' 1013 | * 1014 | * * Return valide color name 1015 | * chance.color({format: 'name'}) => 'red' 1016 | * 1017 | * * Make color uppercase 1018 | * chance.color({casing: 'upper'}) => '#29CFA7' 1019 | * 1020 | * @param [object] options 1021 | * @return [string] color value 1022 | */ 1023 | Chance.prototype.color = function (options) { 1024 | 1025 | function gray(value, delimiter) { 1026 | return [value, value, value].join(delimiter || ''); 1027 | } 1028 | 1029 | function rgb(hasAlpha) { 1030 | 1031 | var rgbValue = (hasAlpha) ? 'rgba' : 'rgb'; 1032 | var alphaChanal = (hasAlpha) ? (',' + this.floating({min:0, max:1})) : ""; 1033 | var colorValue = (isGrayscale) ? (gray(this.natural({max: 255}), ',')) : (this.natural({max: 255}) + ',' + this.natural({max: 255}) + ',' + this.natural({max: 255})); 1034 | 1035 | return rgbValue + '(' + colorValue + alphaChanal + ')'; 1036 | } 1037 | 1038 | function hex(start, end, withHash) { 1039 | 1040 | var simbol = (withHash) ? "#" : ""; 1041 | var expression = (isGrayscale ? gray(this.hash({length: start})) : this.hash({length: end})); 1042 | return simbol + expression; 1043 | } 1044 | 1045 | options = initOptions(options, { 1046 | format: this.pick(['hex', 'shorthex', 'rgb', 'rgba', '0x', 'name']), 1047 | grayscale: false, 1048 | casing: 'lower' 1049 | }); 1050 | 1051 | var isGrayscale = options.grayscale; 1052 | var colorValue; 1053 | 1054 | if (options.format === 'hex') { 1055 | colorValue = hex.call(this, 2, 6, true); 1056 | } 1057 | else if (options.format === 'shorthex') { 1058 | colorValue = hex.call(this, 1, 3, true); 1059 | } 1060 | else if (options.format === 'rgb') { 1061 | colorValue = rgb.call(this, false); 1062 | } 1063 | else if (options.format === 'rgba') { 1064 | colorValue = rgb.call(this, true); 1065 | } 1066 | else if (options.format === '0x') { 1067 | colorValue = '0x' + hex.call(this, 2, 6); 1068 | } 1069 | else if(options.format === 'name') { 1070 | return this.pick(this.get("colorNames")); 1071 | } 1072 | else { 1073 | throw new RangeError('Invalid format provided. Please provide one of "hex", "shorthex", "rgb", "rgba", "0x" or "name".'); 1074 | } 1075 | 1076 | if (options.casing === 'upper' ) { 1077 | colorValue = colorValue.toUpperCase(); 1078 | } 1079 | 1080 | return colorValue; 1081 | }; 1082 | 1083 | Chance.prototype.domain = function (options) { 1084 | options = initOptions(options); 1085 | return this.word() + '.' + (options.tld || this.tld()); 1086 | }; 1087 | 1088 | Chance.prototype.email = function (options) { 1089 | options = initOptions(options); 1090 | return this.word({length: options.length}) + '@' + (options.domain || this.domain()); 1091 | }; 1092 | 1093 | Chance.prototype.fbid = function () { 1094 | return parseInt('10000' + this.natural({max: 100000000000}), 10); 1095 | }; 1096 | 1097 | Chance.prototype.google_analytics = function () { 1098 | var account = this.pad(this.natural({max: 999999}), 6); 1099 | var property = this.pad(this.natural({max: 99}), 2); 1100 | 1101 | return 'UA-' + account + '-' + property; 1102 | }; 1103 | 1104 | Chance.prototype.hashtag = function () { 1105 | return '#' + this.word(); 1106 | }; 1107 | 1108 | Chance.prototype.ip = function () { 1109 | // Todo: This could return some reserved IPs. See http://vq.io/137dgYy 1110 | // this should probably be updated to account for that rare as it may be 1111 | return this.natural({min: 1, max: 254}) + '.' + 1112 | this.natural({max: 255}) + '.' + 1113 | this.natural({max: 255}) + '.' + 1114 | this.natural({min: 1, max: 254}); 1115 | }; 1116 | 1117 | Chance.prototype.ipv6 = function () { 1118 | var ip_addr = this.n(this.hash, 8, {length: 4}); 1119 | 1120 | return ip_addr.join(":"); 1121 | }; 1122 | 1123 | Chance.prototype.klout = function () { 1124 | return this.natural({min: 1, max: 99}); 1125 | }; 1126 | 1127 | Chance.prototype.semver = function (options) { 1128 | options = initOptions(options, { include_prerelease: true }); 1129 | 1130 | var range = this.pickone(["^", "~", "<", ">", "<=", ">=", "="]); 1131 | if (options.range) { 1132 | range = options.range; 1133 | } 1134 | 1135 | var prerelease = ""; 1136 | if (options.include_prerelease) { 1137 | prerelease = this.weighted(["", "-dev", "-beta", "-alpha"], [50, 10, 5, 1]); 1138 | } 1139 | return range + this.rpg('3d10').join('.') + prerelease; 1140 | }; 1141 | 1142 | Chance.prototype.tlds = function () { 1143 | return ['com', 'org', 'edu', 'gov', 'co.uk', 'net', 'io', 'ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al', 'am', 'an', 'ao', 'aq', 'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', 'bj', 'bm', 'bn', 'bo', 'bq', 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cu', 'cv', 'cw', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg', 'eh', 'er', 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'ss', 'st', 'su', 'sv', 'sx', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr', 'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt', 'za', 'zm', 'zw']; 1144 | }; 1145 | 1146 | Chance.prototype.tld = function () { 1147 | return this.pick(this.tlds()); 1148 | }; 1149 | 1150 | Chance.prototype.twitter = function () { 1151 | return '@' + this.word(); 1152 | }; 1153 | 1154 | Chance.prototype.url = function (options) { 1155 | options = initOptions(options, { protocol: "http", domain: this.domain(options), domain_prefix: "", path: this.word(), extensions: []}); 1156 | 1157 | var extension = options.extensions.length > 0 ? "." + this.pick(options.extensions) : ""; 1158 | var domain = options.domain_prefix ? options.domain_prefix + "." + options.domain : options.domain; 1159 | 1160 | return options.protocol + "://" + domain + "/" + options.path + extension; 1161 | }; 1162 | 1163 | // -- End Web -- 1164 | 1165 | // -- Location -- 1166 | 1167 | Chance.prototype.address = function (options) { 1168 | options = initOptions(options); 1169 | return this.natural({min: 5, max: 2000}) + ' ' + this.street(options); 1170 | }; 1171 | 1172 | Chance.prototype.altitude = function (options) { 1173 | options = initOptions(options, {fixed: 5, min: 0, max: 8848}); 1174 | return this.floating({ 1175 | min: options.min, 1176 | max: options.max, 1177 | fixed: options.fixed 1178 | }); 1179 | }; 1180 | 1181 | Chance.prototype.areacode = function (options) { 1182 | options = initOptions(options, {parens : true}); 1183 | // Don't want area codes to start with 1, or have a 9 as the second digit 1184 | var areacode = this.natural({min: 2, max: 9}).toString() + 1185 | this.natural({min: 0, max: 8}).toString() + 1186 | this.natural({min: 0, max: 9}).toString(); 1187 | 1188 | return options.parens ? '(' + areacode + ')' : areacode; 1189 | }; 1190 | 1191 | Chance.prototype.city = function () { 1192 | return this.capitalize(this.word({syllables: 3})); 1193 | }; 1194 | 1195 | Chance.prototype.coordinates = function (options) { 1196 | return this.latitude(options) + ', ' + this.longitude(options); 1197 | }; 1198 | 1199 | Chance.prototype.countries = function () { 1200 | return this.get("countries"); 1201 | }; 1202 | 1203 | Chance.prototype.country = function (options) { 1204 | options = initOptions(options); 1205 | var country = this.pick(this.countries()); 1206 | return options.full ? country.name : country.abbreviation; 1207 | }; 1208 | 1209 | Chance.prototype.depth = function (options) { 1210 | options = initOptions(options, {fixed: 5, min: -10994, max: 0}); 1211 | return this.floating({ 1212 | min: options.min, 1213 | max: options.max, 1214 | fixed: options.fixed 1215 | }); 1216 | }; 1217 | 1218 | Chance.prototype.geohash = function (options) { 1219 | options = initOptions(options, { length: 7 }); 1220 | return this.string({ length: options.length, pool: '0123456789bcdefghjkmnpqrstuvwxyz' }); 1221 | }; 1222 | 1223 | Chance.prototype.geojson = function (options) { 1224 | return this.latitude(options) + ', ' + this.longitude(options) + ', ' + this.altitude(options); 1225 | }; 1226 | 1227 | Chance.prototype.latitude = function (options) { 1228 | options = initOptions(options, {fixed: 5, min: -90, max: 90}); 1229 | return this.floating({min: options.min, max: options.max, fixed: options.fixed}); 1230 | }; 1231 | 1232 | Chance.prototype.longitude = function (options) { 1233 | options = initOptions(options, {fixed: 5, min: -180, max: 180}); 1234 | return this.floating({min: options.min, max: options.max, fixed: options.fixed}); 1235 | }; 1236 | 1237 | Chance.prototype.phone = function (options) { 1238 | var self = this, 1239 | numPick, 1240 | ukNum = function (parts) { 1241 | var section = []; 1242 | //fills the section part of the phone number with random numbers. 1243 | parts.sections.forEach(function(n) { 1244 | section.push(self.string({ pool: '0123456789', length: n})); 1245 | }); 1246 | return parts.area + section.join(' '); 1247 | }; 1248 | options = initOptions(options, { 1249 | formatted: true, 1250 | country: 'us', 1251 | mobile: false 1252 | }); 1253 | if (!options.formatted) { 1254 | options.parens = false; 1255 | } 1256 | var phone; 1257 | switch (options.country) { 1258 | case 'fr': 1259 | if (!options.mobile) { 1260 | numPick = this.pick([ 1261 | // Valid zone and département codes. 1262 | '01' + this.pick(['30', '34', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '53', '55', '56', '58', '60', '64', '69', '70', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83']) + self.string({ pool: '0123456789', length: 6}), 1263 | '02' + this.pick(['14', '18', '22', '23', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '40', '41', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '56', '57', '61', '62', '69', '72', '76', '77', '78', '85', '90', '96', '97', '98', '99']) + self.string({ pool: '0123456789', length: 6}), 1264 | '03' + this.pick(['10', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '39', '44', '45', '51', '52', '54', '55', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90']) + self.string({ pool: '0123456789', length: 6}), 1265 | '04' + this.pick(['11', '13', '15', '20', '22', '26', '27', '30', '32', '34', '37', '42', '43', '44', '50', '56', '57', '63', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '88', '89', '90', '91', '92', '93', '94', '95', '97', '98']) + self.string({ pool: '0123456789', length: 6}), 1266 | '05' + this.pick(['08', '16', '17', '19', '24', '31', '32', '33', '34', '35', '40', '45', '46', '47', '49', '53', '55', '56', '57', '58', '59', '61', '62', '63', '64', '65', '67', '79', '81', '82', '86', '87', '90', '94']) + self.string({ pool: '0123456789', length: 6}), 1267 | '09' + self.string({ pool: '0123456789', length: 8}), 1268 | ]); 1269 | phone = options.formatted ? numPick.match(/../g).join(' ') : numPick; 1270 | } else { 1271 | numPick = this.pick(['06', '07']) + self.string({ pool: '0123456789', length: 8}); 1272 | phone = options.formatted ? numPick.match(/../g).join(' ') : numPick; 1273 | } 1274 | break; 1275 | case 'uk': 1276 | if (!options.mobile) { 1277 | numPick = this.pick([ 1278 | //valid area codes of major cities/counties followed by random numbers in required format. 1279 | { area: '01' + this.character({ pool: '234569' }) + '1 ', sections: [3,4] }, 1280 | { area: '020 ' + this.character({ pool: '378' }), sections: [3,4] }, 1281 | { area: '023 ' + this.character({ pool: '89' }), sections: [3,4] }, 1282 | { area: '024 7', sections: [3,4] }, 1283 | { area: '028 ' + this.pick(['25','28','37','71','82','90','92','95']), sections: [2,4] }, 1284 | { area: '012' + this.pick(['04','08','54','76','97','98']) + ' ', sections: [5] }, 1285 | { area: '013' + this.pick(['63','64','84','86']) + ' ', sections: [5] }, 1286 | { area: '014' + this.pick(['04','20','60','61','80','88']) + ' ', sections: [5] }, 1287 | { area: '015' + this.pick(['24','27','62','66']) + ' ', sections: [5] }, 1288 | { area: '016' + this.pick(['06','29','35','47','59','95']) + ' ', sections: [5] }, 1289 | { area: '017' + this.pick(['26','44','50','68']) + ' ', sections: [5] }, 1290 | { area: '018' + this.pick(['27','37','84','97']) + ' ', sections: [5] }, 1291 | { area: '019' + this.pick(['00','05','35','46','49','63','95']) + ' ', sections: [5] } 1292 | ]); 1293 | phone = options.formatted ? ukNum(numPick) : ukNum(numPick).replace(' ', '', 'g'); 1294 | } else { 1295 | numPick = this.pick([ 1296 | { area: '07' + this.pick(['4','5','7','8','9']), sections: [2,6] }, 1297 | { area: '07624 ', sections: [6] } 1298 | ]); 1299 | phone = options.formatted ? ukNum(numPick) : ukNum(numPick).replace(' ', ''); 1300 | } 1301 | break; 1302 | case 'us': 1303 | var areacode = this.areacode(options).toString(); 1304 | var exchange = this.natural({ min: 2, max: 9 }).toString() + 1305 | this.natural({ min: 0, max: 9 }).toString() + 1306 | this.natural({ min: 0, max: 9 }).toString(); 1307 | var subscriber = this.natural({ min: 1000, max: 9999 }).toString(); // this could be random [0-9]{4} 1308 | phone = options.formatted ? areacode + ' ' + exchange + '-' + subscriber : areacode + exchange + subscriber; 1309 | } 1310 | return phone; 1311 | }; 1312 | 1313 | Chance.prototype.postal = function () { 1314 | // Postal District 1315 | var pd = this.character({pool: "XVTSRPNKLMHJGECBA"}); 1316 | // Forward Sortation Area (FSA) 1317 | var fsa = pd + this.natural({max: 9}) + this.character({alpha: true, casing: "upper"}); 1318 | // Local Delivery Unut (LDU) 1319 | var ldu = this.natural({max: 9}) + this.character({alpha: true, casing: "upper"}) + this.natural({max: 9}); 1320 | 1321 | return fsa + " " + ldu; 1322 | }; 1323 | 1324 | Chance.prototype.provinces = function (options) { 1325 | options = initOptions(options, { country: 'ca' }); 1326 | return this.get("provinces")[options.country.toLowerCase()]; 1327 | }; 1328 | 1329 | Chance.prototype.province = function (options) { 1330 | return (options && options.full) ? 1331 | this.pick(this.provinces(options)).name : 1332 | this.pick(this.provinces(options)).abbreviation; 1333 | }; 1334 | 1335 | Chance.prototype.state = function (options) { 1336 | return (options && options.full) ? 1337 | this.pick(this.states(options)).name : 1338 | this.pick(this.states(options)).abbreviation; 1339 | }; 1340 | 1341 | Chance.prototype.states = function (options) { 1342 | options = initOptions(options, { country: 'us', us_states_and_dc: true } ); 1343 | 1344 | var states; 1345 | 1346 | switch (options.country.toLowerCase()) { 1347 | case 'us': 1348 | var us_states_and_dc = this.get("us_states_and_dc"), 1349 | territories = this.get("territories"), 1350 | armed_forces = this.get("armed_forces"); 1351 | 1352 | states = []; 1353 | 1354 | if (options.us_states_and_dc) { 1355 | states = states.concat(us_states_and_dc); 1356 | } 1357 | if (options.territories) { 1358 | states = states.concat(territories); 1359 | } 1360 | if (options.armed_forces) { 1361 | states = states.concat(armed_forces); 1362 | } 1363 | break; 1364 | case 'it': 1365 | states = this.get("country_regions")[options.country.toLowerCase()]; 1366 | } 1367 | 1368 | return states; 1369 | }; 1370 | 1371 | Chance.prototype.street = function (options) { 1372 | options = initOptions(options, { country: 'us', syllables: 2 }); 1373 | var street; 1374 | 1375 | switch (options.country.toLowerCase()) { 1376 | case 'us': 1377 | street = this.word({ syllables: options.syllables }); 1378 | street = this.capitalize(street); 1379 | street += ' '; 1380 | street += options.short_suffix ? 1381 | this.street_suffix(options).abbreviation : 1382 | this.street_suffix(options).name; 1383 | break; 1384 | case 'it': 1385 | street = this.word({ syllables: options.syllables }); 1386 | street = this.capitalize(street); 1387 | street = (options.short_suffix ? 1388 | this.street_suffix(options).abbreviation : 1389 | this.street_suffix(options).name) + " " + street; 1390 | break; 1391 | } 1392 | return street; 1393 | }; 1394 | 1395 | Chance.prototype.street_suffix = function (options) { 1396 | options = initOptions(options, { country: 'us' }); 1397 | return this.pick(this.street_suffixes(options)); 1398 | }; 1399 | 1400 | Chance.prototype.street_suffixes = function (options) { 1401 | options = initOptions(options, { country: 'us' }); 1402 | // These are the most common suffixes. 1403 | return this.get("street_suffixes")[options.country.toLowerCase()]; 1404 | }; 1405 | 1406 | // Note: only returning US zip codes, internationalization will be a whole 1407 | // other beast to tackle at some point. 1408 | Chance.prototype.zip = function (options) { 1409 | var zip = this.n(this.natural, 5, {max: 9}); 1410 | 1411 | if (options && options.plusfour === true) { 1412 | zip.push('-'); 1413 | zip = zip.concat(this.n(this.natural, 4, {max: 9})); 1414 | } 1415 | 1416 | return zip.join(""); 1417 | }; 1418 | 1419 | // -- End Location -- 1420 | 1421 | // -- Time 1422 | 1423 | Chance.prototype.ampm = function () { 1424 | return this.bool() ? 'am' : 'pm'; 1425 | }; 1426 | 1427 | Chance.prototype.date = function (options) { 1428 | var date_string, date; 1429 | 1430 | // If interval is specified we ignore preset 1431 | if(options && (options.min || options.max)) { 1432 | options = initOptions(options, { 1433 | american: true, 1434 | string: false 1435 | }); 1436 | var min = typeof options.min !== "undefined" ? options.min.getTime() : 1; 1437 | // 100,000,000 days measured relative to midnight at the beginning of 01 January, 1970 UTC. http://es5.github.io/#x15.9.1.1 1438 | var max = typeof options.max !== "undefined" ? options.max.getTime() : 8640000000000000; 1439 | 1440 | date = new Date(this.natural({min: min, max: max})); 1441 | } else { 1442 | var m = this.month({raw: true}); 1443 | var daysInMonth = m.days; 1444 | 1445 | if(options && options.month) { 1446 | // Mod 12 to allow months outside range of 0-11 (not encouraged, but also not prevented). 1447 | daysInMonth = this.get('months')[((options.month % 12) + 12) % 12].days; 1448 | } 1449 | 1450 | options = initOptions(options, { 1451 | year: parseInt(this.year(), 10), 1452 | // Necessary to subtract 1 because Date() 0-indexes month but not day or year 1453 | // for some reason. 1454 | month: m.numeric - 1, 1455 | day: this.natural({min: 1, max: daysInMonth}), 1456 | hour: this.hour(), 1457 | minute: this.minute(), 1458 | second: this.second(), 1459 | millisecond: this.millisecond(), 1460 | american: true, 1461 | string: false 1462 | }); 1463 | 1464 | date = new Date(options.year, options.month, options.day, options.hour, options.minute, options.second, options.millisecond); 1465 | } 1466 | 1467 | if (options.american) { 1468 | // Adding 1 to the month is necessary because Date() 0-indexes 1469 | // months but not day for some odd reason. 1470 | date_string = (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear(); 1471 | } else { 1472 | date_string = date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear(); 1473 | } 1474 | 1475 | return options.string ? date_string : date; 1476 | }; 1477 | 1478 | Chance.prototype.hammertime = function (options) { 1479 | return this.date(options).getTime(); 1480 | }; 1481 | 1482 | Chance.prototype.hour = function (options) { 1483 | options = initOptions(options, { 1484 | min: options && options.twentyfour ? 0 : 1, 1485 | max: options && options.twentyfour ? 23 : 12 1486 | }); 1487 | 1488 | testRange(options.min < 0, "Chance: Min cannot be less than 0."); 1489 | testRange(options.twentyfour && options.max > 23, "Chance: Max cannot be greater than 23 for twentyfour option."); 1490 | testRange(!options.twentyfour && options.max > 12, "Chance: Max cannot be greater than 12."); 1491 | testRange(options.min > options.max, "Chance: Min cannot be greater than Max."); 1492 | 1493 | return this.natural({min: options.min, max: options.max}); 1494 | }; 1495 | 1496 | Chance.prototype.millisecond = function () { 1497 | return this.natural({max: 999}); 1498 | }; 1499 | 1500 | Chance.prototype.minute = Chance.prototype.second = function (options) { 1501 | options = initOptions(options, {min: 0, max: 59}); 1502 | 1503 | testRange(options.min < 0, "Chance: Min cannot be less than 0."); 1504 | testRange(options.max > 59, "Chance: Max cannot be greater than 59."); 1505 | testRange(options.min > options.max, "Chance: Min cannot be greater than Max."); 1506 | 1507 | return this.natural({min: options.min, max: options.max}); 1508 | }; 1509 | 1510 | Chance.prototype.month = function (options) { 1511 | options = initOptions(options, {min: 1, max: 12}); 1512 | 1513 | testRange(options.min < 1, "Chance: Min cannot be less than 1."); 1514 | testRange(options.max > 12, "Chance: Max cannot be greater than 12."); 1515 | testRange(options.min > options.max, "Chance: Min cannot be greater than Max."); 1516 | 1517 | var month = this.pick(this.months().slice(options.min - 1, options.max)); 1518 | return options.raw ? month : month.name; 1519 | }; 1520 | 1521 | Chance.prototype.months = function () { 1522 | return this.get("months"); 1523 | }; 1524 | 1525 | Chance.prototype.second = function () { 1526 | return this.natural({max: 59}); 1527 | }; 1528 | 1529 | Chance.prototype.timestamp = function () { 1530 | return this.natural({min: 1, max: parseInt(new Date().getTime() / 1000, 10)}); 1531 | }; 1532 | 1533 | Chance.prototype.weekday = function (options) { 1534 | options = initOptions(options, {weekday_only: false}); 1535 | var weekdays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]; 1536 | if (!options.weekday_only) { 1537 | weekdays.push("Saturday"); 1538 | weekdays.push("Sunday"); 1539 | } 1540 | return this.pickone(weekdays); 1541 | }; 1542 | 1543 | Chance.prototype.year = function (options) { 1544 | // Default to current year as min if none specified 1545 | options = initOptions(options, {min: new Date().getFullYear()}); 1546 | 1547 | // Default to one century after current year as max if none specified 1548 | options.max = (typeof options.max !== "undefined") ? options.max : options.min + 100; 1549 | 1550 | return this.natural(options).toString(); 1551 | }; 1552 | 1553 | // -- End Time 1554 | 1555 | // -- Finance -- 1556 | 1557 | Chance.prototype.cc = function (options) { 1558 | options = initOptions(options); 1559 | 1560 | var type, number, to_generate; 1561 | 1562 | type = (options.type) ? 1563 | this.cc_type({ name: options.type, raw: true }) : 1564 | this.cc_type({ raw: true }); 1565 | 1566 | number = type.prefix.split(""); 1567 | to_generate = type.length - type.prefix.length - 1; 1568 | 1569 | // Generates n - 1 digits 1570 | number = number.concat(this.n(this.integer, to_generate, {min: 0, max: 9})); 1571 | 1572 | // Generates the last digit according to Luhn algorithm 1573 | number.push(this.luhn_calculate(number.join(""))); 1574 | 1575 | return number.join(""); 1576 | }; 1577 | 1578 | Chance.prototype.cc_types = function () { 1579 | // http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29 1580 | return this.get("cc_types"); 1581 | }; 1582 | 1583 | Chance.prototype.cc_type = function (options) { 1584 | options = initOptions(options); 1585 | var types = this.cc_types(), 1586 | type = null; 1587 | 1588 | if (options.name) { 1589 | for (var i = 0; i < types.length; i++) { 1590 | // Accept either name or short_name to specify card type 1591 | if (types[i].name === options.name || types[i].short_name === options.name) { 1592 | type = types[i]; 1593 | break; 1594 | } 1595 | } 1596 | if (type === null) { 1597 | throw new RangeError("Credit card type '" + options.name + "'' is not supported"); 1598 | } 1599 | } else { 1600 | type = this.pick(types); 1601 | } 1602 | 1603 | return options.raw ? type : type.name; 1604 | }; 1605 | 1606 | //return all world currency by ISO 4217 1607 | Chance.prototype.currency_types = function () { 1608 | return this.get("currency_types"); 1609 | }; 1610 | 1611 | //return random world currency by ISO 4217 1612 | Chance.prototype.currency = function () { 1613 | return this.pick(this.currency_types()); 1614 | }; 1615 | 1616 | //Return random correct currency exchange pair (e.g. EUR/USD) or array of currency code 1617 | Chance.prototype.currency_pair = function (returnAsString) { 1618 | var currencies = this.unique(this.currency, 2, { 1619 | comparator: function(arr, val) { 1620 | 1621 | return arr.reduce(function(acc, item) { 1622 | // If a match has been found, short circuit check and just return 1623 | return acc || (item.code === val.code); 1624 | }, false); 1625 | } 1626 | }); 1627 | 1628 | if (returnAsString) { 1629 | return currencies[0].code + '/' + currencies[1].code; 1630 | } else { 1631 | return currencies; 1632 | } 1633 | }; 1634 | 1635 | Chance.prototype.dollar = function (options) { 1636 | // By default, a somewhat more sane max for dollar than all available numbers 1637 | options = initOptions(options, {max : 10000, min : 0}); 1638 | 1639 | var dollar = this.floating({min: options.min, max: options.max, fixed: 2}).toString(), 1640 | cents = dollar.split('.')[1]; 1641 | 1642 | if (cents === undefined) { 1643 | dollar += '.00'; 1644 | } else if (cents.length < 2) { 1645 | dollar = dollar + '0'; 1646 | } 1647 | 1648 | if (dollar < 0) { 1649 | return '-$' + dollar.replace('-', ''); 1650 | } else { 1651 | return '$' + dollar; 1652 | } 1653 | }; 1654 | 1655 | Chance.prototype.euro = function (options) { 1656 | return Number(this.dollar(options).replace("$", "")).toLocaleString() + "€"; 1657 | }; 1658 | 1659 | Chance.prototype.exp = function (options) { 1660 | options = initOptions(options); 1661 | var exp = {}; 1662 | 1663 | exp.year = this.exp_year(); 1664 | 1665 | // If the year is this year, need to ensure month is greater than the 1666 | // current month or this expiration will not be valid 1667 | if (exp.year === (new Date().getFullYear()).toString()) { 1668 | exp.month = this.exp_month({future: true}); 1669 | } else { 1670 | exp.month = this.exp_month(); 1671 | } 1672 | 1673 | return options.raw ? exp : exp.month + '/' + exp.year; 1674 | }; 1675 | 1676 | Chance.prototype.exp_month = function (options) { 1677 | options = initOptions(options); 1678 | var month, month_int, 1679 | // Date object months are 0 indexed 1680 | curMonth = new Date().getMonth() + 1; 1681 | 1682 | if (options.future && (curMonth !== 12)) { 1683 | do { 1684 | month = this.month({raw: true}).numeric; 1685 | month_int = parseInt(month, 10); 1686 | } while (month_int <= curMonth); 1687 | } else { 1688 | month = this.month({raw: true}).numeric; 1689 | } 1690 | 1691 | return month; 1692 | }; 1693 | 1694 | Chance.prototype.exp_year = function () { 1695 | var curMonth = new Date().getMonth() + 1, 1696 | curYear = new Date().getFullYear(); 1697 | 1698 | return this.year({min: ((curMonth === 12) ? (curYear + 1) : curYear), max: (curYear + 10)}); 1699 | }; 1700 | 1701 | Chance.prototype.vat = function (options) { 1702 | options = initOptions(options, { country: 'it' }); 1703 | switch (options.country.toLowerCase()) { 1704 | case 'it': 1705 | return this.it_vat(); 1706 | } 1707 | }; 1708 | 1709 | // -- End Finance 1710 | 1711 | // -- Regional 1712 | 1713 | Chance.prototype.it_vat = function () { 1714 | var it_vat = this.natural({min: 1, max: 1800000}); 1715 | 1716 | it_vat = this.pad(it_vat, 7) + this.pad(this.pick(this.provinces({ country: 'it' })).code, 3); 1717 | return it_vat + this.luhn_calculate(it_vat); 1718 | }; 1719 | 1720 | /* 1721 | * this generator is written following the official algorithm 1722 | * all data can be passed explicitely or randomized by calling chance.cf() without options 1723 | * the code does not check that the input data is valid (it goes beyond the scope of the generator) 1724 | * 1725 | * @param [Object] options = { first: first name, 1726 | * last: last name, 1727 | * gender: female|male, 1728 | birthday: JavaScript date object, 1729 | city: string(4), 1 letter + 3 numbers 1730 | } 1731 | * @return [string] codice fiscale 1732 | * 1733 | */ 1734 | Chance.prototype.cf = function (options) { 1735 | options = options || {}; 1736 | var gender = !!options.gender ? options.gender : this.gender(), 1737 | first = !!options.first ? options.first : this.first( { gender: gender, nationality: 'it'} ), 1738 | last = !!options.last ? options.last : this.last( { nationality: 'it'} ), 1739 | birthday = !!options.birthday ? options.birthday : this.birthday(), 1740 | city = !!options.city ? options.city : this.pickone(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'L', 'M', 'Z']) + this.pad(this.natural({max:999}), 3), 1741 | cf = [], 1742 | name_generator = function(name, isLast) { 1743 | var temp, 1744 | return_value = []; 1745 | 1746 | if (name.length < 3) { 1747 | return_value = name.split("").concat("XXX".split("")).splice(0,3); 1748 | } 1749 | else { 1750 | temp = name.toUpperCase().split('').map(function(c){ 1751 | return ("BCDFGHJKLMNPRSTVWZ".indexOf(c) !== -1) ? c : undefined; 1752 | }).join(''); 1753 | if (temp.length > 3) { 1754 | if (isLast) { 1755 | temp = temp.substr(0,3); 1756 | } else { 1757 | temp = temp[0] + temp.substr(2,2); 1758 | } 1759 | } 1760 | if (temp.length < 3) { 1761 | return_value = temp; 1762 | temp = name.toUpperCase().split('').map(function(c){ 1763 | return ("AEIOU".indexOf(c) !== -1) ? c : undefined; 1764 | }).join('').substr(0, 3 - return_value.length); 1765 | } 1766 | return_value = return_value + temp; 1767 | } 1768 | 1769 | return return_value; 1770 | }, 1771 | date_generator = function(birthday, gender, that) { 1772 | var lettermonths = ['A', 'B', 'C', 'D', 'E', 'H', 'L', 'M', 'P', 'R', 'S', 'T']; 1773 | 1774 | return birthday.getFullYear().toString().substr(2) + 1775 | lettermonths[birthday.getMonth()] + 1776 | that.pad(birthday.getDate() + ((gender.toLowerCase() === "female") ? 40 : 0), 2); 1777 | }, 1778 | checkdigit_generator = function(cf) { 1779 | var range1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 1780 | range2 = "ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ", 1781 | evens = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 1782 | odds = "BAKPLCQDREVOSFTGUHMINJWZYX", 1783 | digit = 0; 1784 | 1785 | 1786 | for(var i = 0; i < 15; i++) { 1787 | if (i % 2 !== 0) { 1788 | digit += evens.indexOf(range2[range1.indexOf(cf[i])]); 1789 | } 1790 | else { 1791 | digit += odds.indexOf(range2[range1.indexOf(cf[i])]); 1792 | } 1793 | } 1794 | return evens[digit % 26]; 1795 | }; 1796 | 1797 | cf = cf.concat(name_generator(last, true), name_generator(first), date_generator(birthday, gender, this), city.toUpperCase().split("")).join(""); 1798 | cf += checkdigit_generator(cf.toUpperCase(), this); 1799 | 1800 | return cf.toUpperCase(); 1801 | }; 1802 | 1803 | Chance.prototype.pl_pesel = function () { 1804 | var number = this.natural({min: 1, max: 9999999999}); 1805 | var arr = this.pad(number, 10).split(''); 1806 | for (var i = 0; i < arr.length; i++) { 1807 | arr[i] = parseInt(arr[i]); 1808 | } 1809 | 1810 | var controlNumber = (1 * arr[0] + 3 * arr[1] + 7 * arr[2] + 9 * arr[3] + 1 * arr[4] + 3 * arr[5] + 7 * arr[6] + 9 * arr[7] + 1 * arr[8] + 3 * arr[9]) % 10; 1811 | if(controlNumber !== 0) { 1812 | controlNumber = 10 - controlNumber; 1813 | } 1814 | 1815 | return arr.join('') + controlNumber; 1816 | }; 1817 | 1818 | Chance.prototype.pl_nip = function () { 1819 | var number = this.natural({min: 1, max: 999999999}); 1820 | var arr = this.pad(number, 9).split(''); 1821 | for (var i = 0; i < arr.length; i++) { 1822 | arr[i] = parseInt(arr[i]); 1823 | } 1824 | 1825 | var controlNumber = (6 * arr[0] + 5 * arr[1] + 7 * arr[2] + 2 * arr[3] + 3 * arr[4] + 4 * arr[5] + 5 * arr[6] + 6 * arr[7] + 7 * arr[8]) % 11; 1826 | if(controlNumber === 10) { 1827 | return this.pl_nip(); 1828 | } 1829 | 1830 | return arr.join('') + controlNumber; 1831 | }; 1832 | 1833 | Chance.prototype.pl_regon = function () { 1834 | var number = this.natural({min: 1, max: 99999999}); 1835 | var arr = this.pad(number, 8).split(''); 1836 | for (var i = 0; i < arr.length; i++) { 1837 | arr[i] = parseInt(arr[i]); 1838 | } 1839 | 1840 | var controlNumber = (8 * arr[0] + 9 * arr[1] + 2 * arr[2] + 3 * arr[3] + 4 * arr[4] + 5 * arr[5] + 6 * arr[6] + 7 * arr[7]) % 11; 1841 | if(controlNumber === 10) { 1842 | controlNumber = 0; 1843 | } 1844 | 1845 | return arr.join('') + controlNumber; 1846 | }; 1847 | 1848 | // -- End Regional 1849 | 1850 | // -- Miscellaneous -- 1851 | 1852 | // Dice - For all the board game geeks out there, myself included ;) 1853 | function diceFn (range) { 1854 | return function () { 1855 | return this.natural(range); 1856 | }; 1857 | } 1858 | Chance.prototype.d4 = diceFn({min: 1, max: 4}); 1859 | Chance.prototype.d6 = diceFn({min: 1, max: 6}); 1860 | Chance.prototype.d8 = diceFn({min: 1, max: 8}); 1861 | Chance.prototype.d10 = diceFn({min: 1, max: 10}); 1862 | Chance.prototype.d12 = diceFn({min: 1, max: 12}); 1863 | Chance.prototype.d20 = diceFn({min: 1, max: 20}); 1864 | Chance.prototype.d30 = diceFn({min: 1, max: 30}); 1865 | Chance.prototype.d100 = diceFn({min: 1, max: 100}); 1866 | 1867 | Chance.prototype.rpg = function (thrown, options) { 1868 | options = initOptions(options); 1869 | if (!thrown) { 1870 | throw new RangeError("A type of die roll must be included"); 1871 | } else { 1872 | var bits = thrown.toLowerCase().split("d"), 1873 | rolls = []; 1874 | 1875 | if (bits.length !== 2 || !parseInt(bits[0], 10) || !parseInt(bits[1], 10)) { 1876 | throw new Error("Invalid format provided. Please provide #d# where the first # is the number of dice to roll, the second # is the max of each die"); 1877 | } 1878 | for (var i = bits[0]; i > 0; i--) { 1879 | rolls[i - 1] = this.natural({min: 1, max: bits[1]}); 1880 | } 1881 | return (typeof options.sum !== 'undefined' && options.sum) ? rolls.reduce(function (p, c) { return p + c; }) : rolls; 1882 | } 1883 | }; 1884 | 1885 | // Guid 1886 | Chance.prototype.guid = function (options) { 1887 | options = initOptions(options, { version: 5 }); 1888 | 1889 | var guid_pool = "abcdef1234567890", 1890 | variant_pool = "ab89", 1891 | guid = this.string({ pool: guid_pool, length: 8 }) + '-' + 1892 | this.string({ pool: guid_pool, length: 4 }) + '-' + 1893 | // The Version 1894 | options.version + 1895 | this.string({ pool: guid_pool, length: 3 }) + '-' + 1896 | // The Variant 1897 | this.string({ pool: variant_pool, length: 1 }) + 1898 | this.string({ pool: guid_pool, length: 3 }) + '-' + 1899 | this.string({ pool: guid_pool, length: 12 }); 1900 | return guid; 1901 | }; 1902 | 1903 | // Hash 1904 | Chance.prototype.hash = function (options) { 1905 | options = initOptions(options, {length : 40, casing: 'lower'}); 1906 | var pool = options.casing === 'upper' ? HEX_POOL.toUpperCase() : HEX_POOL; 1907 | return this.string({pool: pool, length: options.length}); 1908 | }; 1909 | 1910 | Chance.prototype.luhn_check = function (num) { 1911 | var str = num.toString(); 1912 | var checkDigit = +str.substring(str.length - 1); 1913 | return checkDigit === this.luhn_calculate(+str.substring(0, str.length - 1)); 1914 | }; 1915 | 1916 | Chance.prototype.luhn_calculate = function (num) { 1917 | var digits = num.toString().split("").reverse(); 1918 | var sum = 0; 1919 | var digit; 1920 | 1921 | for (var i = 0, l = digits.length; l > i; ++i) { 1922 | digit = +digits[i]; 1923 | if (i % 2 === 0) { 1924 | digit *= 2; 1925 | if (digit > 9) { 1926 | digit -= 9; 1927 | } 1928 | } 1929 | sum += digit; 1930 | } 1931 | return (sum * 9) % 10; 1932 | }; 1933 | 1934 | // MD5 Hash 1935 | Chance.prototype.md5 = function(options) { 1936 | var opts = { str: '', key: null, raw: false }; 1937 | 1938 | if (!options) { 1939 | opts.str = this.string(); 1940 | options = {}; 1941 | } 1942 | else if (typeof options === 'string') { 1943 | opts.str = options; 1944 | options = {}; 1945 | } 1946 | else if (typeof options !== 'object') { 1947 | return null; 1948 | } 1949 | else if(options.constructor === 'Array') { 1950 | return null; 1951 | } 1952 | 1953 | opts = initOptions(options, opts); 1954 | 1955 | if(!opts.str){ 1956 | throw new Error('A parameter is required to return an md5 hash.'); 1957 | } 1958 | 1959 | return this.bimd5.md5(opts.str, opts.key, opts.raw); 1960 | }; 1961 | 1962 | /** 1963 | * #Description: 1964 | * ===================================================== 1965 | * Generate random file name with extention 1966 | * 1967 | * The argument provide extention type 1968 | * -> raster 1969 | * -> vector 1970 | * -> 3d 1971 | * -> document 1972 | * 1973 | * If noting is provided the function return random file name with random 1974 | * extention type of any kind 1975 | * 1976 | * The user can validate the file name length range 1977 | * If noting provided the generated file name is radom 1978 | * 1979 | * #Extention Pool : 1980 | * * Currently the supported extentions are 1981 | * -> some of the most popular raster image extentions 1982 | * -> some of the most popular vector image extentions 1983 | * -> some of the most popular 3d image extentions 1984 | * -> some of the most popular document extentions 1985 | * 1986 | * #Examples : 1987 | * ===================================================== 1988 | * 1989 | * Return random file name with random extention. The file extention 1990 | * is provided by a predifined collection of extentions. More abouth the extention 1991 | * pool can be fond in #Extention Pool section 1992 | * 1993 | * chance.file() 1994 | * => dsfsdhjf.xml 1995 | * 1996 | * In order to generate a file name with sspecific length, specify the 1997 | * length property and integer value. The extention is going to be random 1998 | * 1999 | * chance.file({length : 10}) 2000 | * => asrtineqos.pdf 2001 | * 2002 | * In order to geerate file with extention form some of the predifined groups 2003 | * of the extention pool just specify the extenton pool category in fileType property 2004 | * 2005 | * chance.file({fileType : 'raster'}) 2006 | * => dshgssds.psd 2007 | * 2008 | * You can provide specific extention for your files 2009 | * chance.file({extention : 'html'}) 2010 | * => djfsd.html 2011 | * 2012 | * Or you could pass custom collection of extentons bt array or by object 2013 | * chance.file({extentions : [...]}) 2014 | * => dhgsdsd.psd 2015 | * 2016 | * chance.file({extentions : { key : [...], key : [...]}}) 2017 | * => djsfksdjsd.xml 2018 | * 2019 | * @param [collection] options 2020 | * @return [string] 2021 | * 2022 | */ 2023 | Chance.prototype.file = function(options) { 2024 | 2025 | var fileOptions = options || {}; 2026 | var poolCollectionKey = "fileExtension"; 2027 | var typeRange = Object.keys(this.get("fileExtension"));//['raster', 'vector', '3d', 'document']; 2028 | var fileName; 2029 | var fileExtention; 2030 | 2031 | // Generate random file name 2032 | fileName = this.word({length : fileOptions.length}); 2033 | 2034 | // Generate file by specific extention provided by the user 2035 | if(fileOptions.extention) { 2036 | 2037 | fileExtention = fileOptions.extention; 2038 | return (fileName + '.' + fileExtention); 2039 | } 2040 | 2041 | // Generate file by specific axtention collection 2042 | if(fileOptions.extentions) { 2043 | 2044 | if(Array.isArray(fileOptions.extentions)) { 2045 | 2046 | fileExtention = this.pickone(fileOptions.extentions); 2047 | return (fileName + '.' + fileExtention); 2048 | } 2049 | else if(fileOptions.extentions.constructor === Object) { 2050 | 2051 | var extentionObjectCollection = fileOptions.extentions; 2052 | var keys = Object.keys(extentionObjectCollection); 2053 | 2054 | fileExtention = this.pickone(extentionObjectCollection[this.pickone(keys)]); 2055 | return (fileName + '.' + fileExtention); 2056 | } 2057 | 2058 | throw new Error("Expect collection of type Array or Object to be passed as an argument "); 2059 | } 2060 | 2061 | // Generate file extention based on specific file type 2062 | if(fileOptions.fileType) { 2063 | 2064 | var fileType = fileOptions.fileType; 2065 | if(typeRange.indexOf(fileType) !== -1) { 2066 | 2067 | fileExtention = this.pickone(this.get(poolCollectionKey)[fileType]); 2068 | return (fileName + '.' + fileExtention); 2069 | } 2070 | 2071 | throw new Error("Expect file type value to be 'raster', 'vector', '3d' or 'document' "); 2072 | } 2073 | 2074 | // Generate random file name if no extenton options are passed 2075 | fileExtention = this.pickone(this.get(poolCollectionKey)[this.pickone(typeRange)]); 2076 | return (fileName + '.' + fileExtention); 2077 | }; 2078 | 2079 | var data = { 2080 | 2081 | firstNames: { 2082 | "male": { 2083 | "en": ["James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph", "Charles", "Thomas", "Christopher", "Daniel", "Matthew", "George", "Donald", "Anthony", "Paul", "Mark", "Edward", "Steven", "Kenneth", "Andrew", "Brian", "Joshua", "Kevin", "Ronald", "Timothy", "Jason", "Jeffrey", "Frank", "Gary", "Ryan", "Nicholas", "Eric", "Stephen", "Jacob", "Larry", "Jonathan", "Scott", "Raymond", "Justin", "Brandon", "Gregory", "Samuel", "Benjamin", "Patrick", "Jack", "Henry", "Walter", "Dennis", "Jerry", "Alexander", "Peter", "Tyler", "Douglas", "Harold", "Aaron", "Jose", "Adam", "Arthur", "Zachary", "Carl", "Nathan", "Albert", "Kyle", "Lawrence", "Joe", "Willie", "Gerald", "Roger", "Keith", "Jeremy", "Terry", "Harry", "Ralph", "Sean", "Jesse", "Roy", "Louis", "Billy", "Austin", "Bruce", "Eugene", "Christian", "Bryan", "Wayne", "Russell", "Howard", "Fred", "Ethan", "Jordan", "Philip", "Alan", "Juan", "Randy", "Vincent", "Bobby", "Dylan", "Johnny", "Phillip", "Victor", "Clarence", "Ernest", "Martin", "Craig", "Stanley", "Shawn", "Travis", "Bradley", "Leonard", "Earl", "Gabriel", "Jimmy", "Francis", "Todd", "Noah", "Danny", "Dale", "Cody", "Carlos", "Allen", "Frederick", "Logan", "Curtis", "Alex", "Joel", "Luis", "Norman", "Marvin", "Glenn", "Tony", "Nathaniel", "Rodney", "Melvin", "Alfred", "Steve", "Cameron", "Chad", "Edwin", "Caleb", "Evan", "Antonio", "Lee", "Herbert", "Jeffery", "Isaac", "Derek", "Ricky", "Marcus", "Theodore", "Elijah", "Luke", "Jesus", "Eddie", "Troy", "Mike", "Dustin", "Ray", "Adrian", "Bernard", "Leroy", "Angel", "Randall", "Wesley", "Ian", "Jared", "Mason", "Hunter", "Calvin", "Oscar", "Clifford", "Jay", "Shane", "Ronnie", "Barry", "Lucas", "Corey", "Manuel", "Leo", "Tommy", "Warren", "Jackson", "Isaiah", "Connor", "Don", "Dean", "Jon", "Julian", "Miguel", "Bill", "Lloyd", "Charlie", "Mitchell", "Leon", "Jerome", "Darrell", "Jeremiah", "Alvin", "Brett", "Seth", "Floyd", "Jim", "Blake", "Micheal", "Gordon", "Trevor", "Lewis", "Erik", "Edgar", "Vernon", "Devin", "Gavin", "Jayden", "Chris", "Clyde", "Tom", "Derrick", "Mario", "Brent", "Marc", "Herman", "Chase", "Dominic", "Ricardo", "Franklin", "Maurice", "Max", "Aiden", "Owen", "Lester", "Gilbert", "Elmer", "Gene", "Francisco", "Glen", "Cory", "Garrett", "Clayton", "Sam", "Jorge", "Chester", "Alejandro", "Jeff", "Harvey", "Milton", "Cole", "Ivan", "Andre", "Duane", "Landon"], 2084 | // Data taken from http://www.dati.gov.it/dataset/comune-di-firenze_0163 2085 | "it": ["Adolfo", "Alberto", "Aldo", "Alessandro", "Alessio", "Alfredo", "Alvaro", "Andrea", "Angelo", "Angiolo", "Antonino", "Antonio", "Attilio", "Benito", "Bernardo", "Bruno", "Carlo", "Cesare", "Christian", "Claudio", "Corrado", "Cosimo", "Cristian", "Cristiano", "Daniele", "Dario", "David", "Davide", "Diego", "Dino", "Domenico", "Duccio", "Edoardo", "Elia", "Elio", "Emanuele", "Emiliano", "Emilio", "Enrico", "Enzo", "Ettore", "Fabio", "Fabrizio", "Federico", "Ferdinando", "Fernando", "Filippo", "Francesco", "Franco", "Gabriele", "Giacomo", "Giampaolo", "Giampiero", "Giancarlo", "Gianfranco", "Gianluca", "Gianmarco", "Gianni", "Gino", "Giorgio", "Giovanni", "Giuliano", "Giulio", "Giuseppe", "Graziano", "Gregorio", "Guido", "Iacopo", "Jacopo", "Lapo", "Leonardo", "Lorenzo", "Luca", "Luciano", "Luigi", "Manuel", "Marcello", "Marco", "Marino", "Mario", "Massimiliano", "Massimo", "Matteo", "Mattia", "Maurizio", "Mauro", "Michele", "Mirko", "Mohamed", "Nello", "Neri", "Niccolò", "Nicola", "Osvaldo", "Otello", "Paolo", "Pier Luigi", "Piero", "Pietro", "Raffaele", "Remo", "Renato", "Renzo", "Riccardo", "Roberto", "Rolando", "Romano", "Salvatore", "Samuele", "Sandro", "Sergio", "Silvano", "Simone", "Stefano", "Thomas", "Tommaso", "Ubaldo", "Ugo", "Umberto", "Valerio", "Valter", "Vasco", "Vincenzo", "Vittorio"] 2086 | }, 2087 | "female": { 2088 | "en": ["Mary", "Emma", "Elizabeth", "Minnie", "Margaret", "Ida", "Alice", "Bertha", "Sarah", "Annie", "Clara", "Ella", "Florence", "Cora", "Martha", "Laura", "Nellie", "Grace", "Carrie", "Maude", "Mabel", "Bessie", "Jennie", "Gertrude", "Julia", "Hattie", "Edith", "Mattie", "Rose", "Catherine", "Lillian", "Ada", "Lillie", "Helen", "Jessie", "Louise", "Ethel", "Lula", "Myrtle", "Eva", "Frances", "Lena", "Lucy", "Edna", "Maggie", "Pearl", "Daisy", "Fannie", "Josephine", "Dora", "Rosa", "Katherine", "Agnes", "Marie", "Nora", "May", "Mamie", "Blanche", "Stella", "Ellen", "Nancy", "Effie", "Sallie", "Nettie", "Della", "Lizzie", "Flora", "Susie", "Maud", "Mae", "Etta", "Harriet", "Sadie", "Caroline", "Katie", "Lydia", "Elsie", "Kate", "Susan", "Mollie", "Alma", "Addie", "Georgia", "Eliza", "Lulu", "Nannie", "Lottie", "Amanda", "Belle", "Charlotte", "Rebecca", "Ruth", "Viola", "Olive", "Amelia", "Hannah", "Jane", "Virginia", "Emily", "Matilda", "Irene", "Kathryn", "Esther", "Willie", "Henrietta", "Ollie", "Amy", "Rachel", "Sara", "Estella", "Theresa", "Augusta", "Ora", "Pauline", "Josie", "Lola", "Sophia", "Leona", "Anne", "Mildred", "Ann", "Beulah", "Callie", "Lou", "Delia", "Eleanor", "Barbara", "Iva", "Louisa", "Maria", "Mayme", "Evelyn", "Estelle", "Nina", "Betty", "Marion", "Bettie", "Dorothy", "Luella", "Inez", "Lela", "Rosie", "Allie", "Millie", "Janie", "Cornelia", "Victoria", "Ruby", "Winifred", "Alta", "Celia", "Christine", "Beatrice", "Birdie", "Harriett", "Mable", "Myra", "Sophie", "Tillie", "Isabel", "Sylvia", "Carolyn", "Isabelle", "Leila", "Sally", "Ina", "Essie", "Bertie", "Nell", "Alberta", "Katharine", "Lora", "Rena", "Mina", "Rhoda", "Mathilda", "Abbie", "Eula", "Dollie", "Hettie", "Eunice", "Fanny", "Ola", "Lenora", "Adelaide", "Christina", "Lelia", "Nelle", "Sue", "Johanna", "Lilly", "Lucinda", "Minerva", "Lettie", "Roxie", "Cynthia", "Helena", "Hilda", "Hulda", "Bernice", "Genevieve", "Jean", "Cordelia", "Marian", "Francis", "Jeanette", "Adeline", "Gussie", "Leah", "Lois", "Lura", "Mittie", "Hallie", "Isabella", "Olga", "Phoebe", "Teresa", "Hester", "Lida", "Lina", "Winnie", "Claudia", "Marguerite", "Vera", "Cecelia", "Bess", "Emilie", "John", "Rosetta", "Verna", "Myrtie", "Cecilia", "Elva", "Olivia", "Ophelia", "Georgie", "Elnora", "Violet", "Adele", "Lily", "Linnie", "Loretta", "Madge", "Polly", "Virgie", "Eugenia", "Lucile", "Lucille", "Mabelle", "Rosalie"], 2089 | // Data taken from http://www.dati.gov.it/dataset/comune-di-firenze_0162 2090 | "it": ["Ada", "Adriana", "Alessandra", "Alessia", "Alice", "Angela", "Anna", "Anna Maria", "Annalisa", "Annita", "Annunziata", "Antonella", "Arianna", "Asia", "Assunta", "Aurora", "Barbara", "Beatrice", "Benedetta", "Bianca", "Bruna", "Camilla", "Carla", "Carlotta", "Carmela", "Carolina", "Caterina", "Catia", "Cecilia", "Chiara", "Cinzia", "Clara", "Claudia", "Costanza", "Cristina", "Daniela", "Debora", "Diletta", "Dina", "Donatella", "Elena", "Eleonora", "Elisa", "Elisabetta", "Emanuela", "Emma", "Eva", "Federica", "Fernanda", "Fiorella", "Fiorenza", "Flora", "Franca", "Francesca", "Gabriella", "Gaia", "Gemma", "Giada", "Gianna", "Gina", "Ginevra", "Giorgia", "Giovanna", "Giulia", "Giuliana", "Giuseppa", "Giuseppina", "Grazia", "Graziella", "Greta", "Ida", "Ilaria", "Ines", "Iolanda", "Irene", "Irma", "Isabella", "Jessica", "Laura", "Leda", "Letizia", "Licia", "Lidia", "Liliana", "Lina", "Linda", "Lisa", "Livia", "Loretta", "Luana", "Lucia", "Luciana", "Lucrezia", "Luisa", "Manuela", "Mara", "Marcella", "Margherita", "Maria", "Maria Cristina", "Maria Grazia", "Maria Luisa", "Maria Pia", "Maria Teresa", "Marina", "Marisa", "Marta", "Martina", "Marzia", "Matilde", "Melissa", "Michela", "Milena", "Mirella", "Monica", "Natalina", "Nella", "Nicoletta", "Noemi", "Olga", "Paola", "Patrizia", "Piera", "Pierina", "Raffaella", "Rebecca", "Renata", "Rina", "Rita", "Roberta", "Rosa", "Rosanna", "Rossana", "Rossella", "Sabrina", "Sandra", "Sara", "Serena", "Silvana", "Silvia", "Simona", "Simonetta", "Sofia", "Sonia", "Stefania", "Susanna", "Teresa", "Tina", "Tiziana", "Tosca", "Valentina", "Valeria", "Vanda", "Vanessa", "Vanna", "Vera", "Veronica", "Vilma", "Viola", "Virginia", "Vittoria"] 2091 | } 2092 | }, 2093 | 2094 | lastNames: { 2095 | "en": ['Smith', 'Johnson', 'Williams', 'Jones', 'Brown', 'Davis', 'Miller', 'Wilson', 'Moore', 'Taylor', 'Anderson', 'Thomas', 'Jackson', 'White', 'Harris', 'Martin', 'Thompson', 'Garcia', 'Martinez', 'Robinson', 'Clark', 'Rodriguez', 'Lewis', 'Lee', 'Walker', 'Hall', 'Allen', 'Young', 'Hernandez', 'King', 'Wright', 'Lopez', 'Hill', 'Scott', 'Green', 'Adams', 'Baker', 'Gonzalez', 'Nelson', 'Carter', 'Mitchell', 'Perez', 'Roberts', 'Turner', 'Phillips', 'Campbell', 'Parker', 'Evans', 'Edwards', 'Collins', 'Stewart', 'Sanchez', 'Morris', 'Rogers', 'Reed', 'Cook', 'Morgan', 'Bell', 'Murphy', 'Bailey', 'Rivera', 'Cooper', 'Richardson', 'Cox', 'Howard', 'Ward', 'Torres', 'Peterson', 'Gray', 'Ramirez', 'James', 'Watson', 'Brooks', 'Kelly', 'Sanders', 'Price', 'Bennett', 'Wood', 'Barnes', 'Ross', 'Henderson', 'Coleman', 'Jenkins', 'Perry', 'Powell', 'Long', 'Patterson', 'Hughes', 'Flores', 'Washington', 'Butler', 'Simmons', 'Foster', 'Gonzales', 'Bryant', 'Alexander', 'Russell', 'Griffin', 'Diaz', 'Hayes', 'Myers', 'Ford', 'Hamilton', 'Graham', 'Sullivan', 'Wallace', 'Woods', 'Cole', 'West', 'Jordan', 'Owens', 'Reynolds', 'Fisher', 'Ellis', 'Harrison', 'Gibson', 'McDonald', 'Cruz', 'Marshall', 'Ortiz', 'Gomez', 'Murray', 'Freeman', 'Wells', 'Webb', 'Simpson', 'Stevens', 'Tucker', 'Porter', 'Hunter', 'Hicks', 'Crawford', 'Henry', 'Boyd', 'Mason', 'Morales', 'Kennedy', 'Warren', 'Dixon', 'Ramos', 'Reyes', 'Burns', 'Gordon', 'Shaw', 'Holmes', 'Rice', 'Robertson', 'Hunt', 'Black', 'Daniels', 'Palmer', 'Mills', 'Nichols', 'Grant', 'Knight', 'Ferguson', 'Rose', 'Stone', 'Hawkins', 'Dunn', 'Perkins', 'Hudson', 'Spencer', 'Gardner', 'Stephens', 'Payne', 'Pierce', 'Berry', 'Matthews', 'Arnold', 'Wagner', 'Willis', 'Ray', 'Watkins', 'Olson', 'Carroll', 'Duncan', 'Snyder', 'Hart', 'Cunningham', 'Bradley', 'Lane', 'Andrews', 'Ruiz', 'Harper', 'Fox', 'Riley', 'Armstrong', 'Carpenter', 'Weaver', 'Greene', 'Lawrence', 'Elliott', 'Chavez', 'Sims', 'Austin', 'Peters', 'Kelley', 'Franklin', 'Lawson', 'Fields', 'Gutierrez', 'Ryan', 'Schmidt', 'Carr', 'Vasquez', 'Castillo', 'Wheeler', 'Chapman', 'Oliver', 'Montgomery', 'Richards', 'Williamson', 'Johnston', 'Banks', 'Meyer', 'Bishop', 'McCoy', 'Howell', 'Alvarez', 'Morrison', 'Hansen', 'Fernandez', 'Garza', 'Harvey', 'Little', 'Burton', 'Stanley', 'Nguyen', 'George', 'Jacobs', 'Reid', 'Kim', 'Fuller', 'Lynch', 'Dean', 'Gilbert', 'Garrett', 'Romero', 'Welch', 'Larson', 'Frazier', 'Burke', 'Hanson', 'Day', 'Mendoza', 'Moreno', 'Bowman', 'Medina', 'Fowler', 'Brewer', 'Hoffman', 'Carlson', 'Silva', 'Pearson', 'Holland', 'Douglas', 'Fleming', 'Jensen', 'Vargas', 'Byrd', 'Davidson', 'Hopkins', 'May', 'Terry', 'Herrera', 'Wade', 'Soto', 'Walters', 'Curtis', 'Neal', 'Caldwell', 'Lowe', 'Jennings', 'Barnett', 'Graves', 'Jimenez', 'Horton', 'Shelton', 'Barrett', 'Obrien', 'Castro', 'Sutton', 'Gregory', 'McKinney', 'Lucas', 'Miles', 'Craig', 'Rodriquez', 'Chambers', 'Holt', 'Lambert', 'Fletcher', 'Watts', 'Bates', 'Hale', 'Rhodes', 'Pena', 'Beck', 'Newman', 'Haynes', 'McDaniel', 'Mendez', 'Bush', 'Vaughn', 'Parks', 'Dawson', 'Santiago', 'Norris', 'Hardy', 'Love', 'Steele', 'Curry', 'Powers', 'Schultz', 'Barker', 'Guzman', 'Page', 'Munoz', 'Ball', 'Keller', 'Chandler', 'Weber', 'Leonard', 'Walsh', 'Lyons', 'Ramsey', 'Wolfe', 'Schneider', 'Mullins', 'Benson', 'Sharp', 'Bowen', 'Daniel', 'Barber', 'Cummings', 'Hines', 'Baldwin', 'Griffith', 'Valdez', 'Hubbard', 'Salazar', 'Reeves', 'Warner', 'Stevenson', 'Burgess', 'Santos', 'Tate', 'Cross', 'Garner', 'Mann', 'Mack', 'Moss', 'Thornton', 'Dennis', 'McGee', 'Farmer', 'Delgado', 'Aguilar', 'Vega', 'Glover', 'Manning', 'Cohen', 'Harmon', 'Rodgers', 'Robbins', 'Newton', 'Todd', 'Blair', 'Higgins', 'Ingram', 'Reese', 'Cannon', 'Strickland', 'Townsend', 'Potter', 'Goodwin', 'Walton', 'Rowe', 'Hampton', 'Ortega', 'Patton', 'Swanson', 'Joseph', 'Francis', 'Goodman', 'Maldonado', 'Yates', 'Becker', 'Erickson', 'Hodges', 'Rios', 'Conner', 'Adkins', 'Webster', 'Norman', 'Malone', 'Hammond', 'Flowers', 'Cobb', 'Moody', 'Quinn', 'Blake', 'Maxwell', 'Pope', 'Floyd', 'Osborne', 'Paul', 'McCarthy', 'Guerrero', 'Lindsey', 'Estrada', 'Sandoval', 'Gibbs', 'Tyler', 'Gross', 'Fitzgerald', 'Stokes', 'Doyle', 'Sherman', 'Saunders', 'Wise', 'Colon', 'Gill', 'Alvarado', 'Greer', 'Padilla', 'Simon', 'Waters', 'Nunez', 'Ballard', 'Schwartz', 'McBride', 'Houston', 'Christensen', 'Klein', 'Pratt', 'Briggs', 'Parsons', 'McLaughlin', 'Zimmerman', 'French', 'Buchanan', 'Moran', 'Copeland', 'Roy', 'Pittman', 'Brady', 'McCormick', 'Holloway', 'Brock', 'Poole', 'Frank', 'Logan', 'Owen', 'Bass', 'Marsh', 'Drake', 'Wong', 'Jefferson', 'Park', 'Morton', 'Abbott', 'Sparks', 'Patrick', 'Norton', 'Huff', 'Clayton', 'Massey', 'Lloyd', 'Figueroa', 'Carson', 'Bowers', 'Roberson', 'Barton', 'Tran', 'Lamb', 'Harrington', 'Casey', 'Boone', 'Cortez', 'Clarke', 'Mathis', 'Singleton', 'Wilkins', 'Cain', 'Bryan', 'Underwood', 'Hogan', 'McKenzie', 'Collier', 'Luna', 'Phelps', 'McGuire', 'Allison', 'Bridges', 'Wilkerson', 'Nash', 'Summers', 'Atkins'], 2096 | // Data taken from http://www.dati.gov.it/dataset/comune-di-firenze_0164 (first 1000) 2097 | "it": ["Acciai", "Aglietti", "Agostini", "Agresti", "Ahmed", "Aiazzi", "Albanese", "Alberti", "Alessi", "Alfani", "Alinari", "Alterini", "Amato", "Ammannati", "Ancillotti", "Andrei", "Andreini", "Andreoni", "Angeli", "Anichini", "Antonelli", "Antonini", "Arena", "Ariani", "Arnetoli", "Arrighi", "Baccani", "Baccetti", "Bacci", "Bacherini", "Badii", "Baggiani", "Baglioni", "Bagni", "Bagnoli", "Baldassini", "Baldi", "Baldini", "Ballerini", "Balli", "Ballini", "Balloni", "Bambi", "Banchi", "Bandinelli", "Bandini", "Bani", "Barbetti", "Barbieri", "Barchielli", "Bardazzi", "Bardelli", "Bardi", "Barducci", "Bargellini", "Bargiacchi", "Barni", "Baroncelli", "Baroncini", "Barone", "Baroni", "Baronti", "Bartalesi", "Bartoletti", "Bartoli", "Bartolini", "Bartoloni", "Bartolozzi", "Basagni", "Basile", "Bassi", "Batacchi", "Battaglia", "Battaglini", "Bausi", "Becagli", "Becattini", "Becchi", "Becucci", "Bellandi", "Bellesi", "Belli", "Bellini", "Bellucci", "Bencini", "Benedetti", "Benelli", "Beni", "Benini", "Bensi", "Benucci", "Benvenuti", "Berlincioni", "Bernacchioni", "Bernardi", "Bernardini", "Berni", "Bernini", "Bertelli", "Berti", "Bertini", "Bessi", "Betti", "Bettini", "Biagi", "Biagini", "Biagioni", "Biagiotti", "Biancalani", "Bianchi", "Bianchini", "Bianco", "Biffoli", "Bigazzi", "Bigi", "Biliotti", "Billi", "Binazzi", "Bindi", "Bini", "Biondi", "Bizzarri", "Bocci", "Bogani", "Bolognesi", "Bonaiuti", "Bonanni", "Bonciani", "Boncinelli", "Bondi", "Bonechi", "Bongini", "Boni", "Bonini", "Borchi", "Boretti", "Borghi", "Borghini", "Borgioli", "Borri", "Borselli", "Boschi", "Bottai", "Bracci", "Braccini", "Brandi", "Braschi", "Bravi", "Brazzini", "Breschi", "Brilli", "Brizzi", "Brogelli", "Brogi", "Brogioni", "Brunelli", "Brunetti", "Bruni", "Bruno", "Brunori", "Bruschi", "Bucci", "Bucciarelli", "Buccioni", "Bucelli", "Bulli", "Burberi", "Burchi", "Burgassi", "Burroni", "Bussotti", "Buti", "Caciolli", "Caiani", "Calabrese", "Calamai", "Calamandrei", "Caldini", "Calo'", "Calonaci", "Calosi", "Calvelli", "Cambi", "Camiciottoli", "Cammelli", "Cammilli", "Campolmi", "Cantini", "Capanni", "Capecchi", "Caponi", "Cappelletti", "Cappelli", "Cappellini", "Cappugi", "Capretti", "Caputo", "Carbone", "Carboni", "Cardini", "Carlesi", "Carletti", "Carli", "Caroti", "Carotti", "Carrai", "Carraresi", "Carta", "Caruso", "Casalini", "Casati", "Caselli", "Casini", "Castagnoli", "Castellani", "Castelli", "Castellucci", "Catalano", "Catarzi", "Catelani", "Cavaciocchi", "Cavallaro", "Cavallini", "Cavicchi", "Cavini", "Ceccarelli", "Ceccatelli", "Ceccherelli", "Ceccherini", "Cecchi", "Cecchini", "Cecconi", "Cei", "Cellai", "Celli", "Cellini", "Cencetti", "Ceni", "Cenni", "Cerbai", "Cesari", "Ceseri", "Checcacci", "Checchi", "Checcucci", "Cheli", "Chellini", "Chen", "Cheng", "Cherici", "Cherubini", "Chiaramonti", "Chiarantini", "Chiarelli", "Chiari", "Chiarini", "Chiarugi", "Chiavacci", "Chiesi", "Chimenti", "Chini", "Chirici", "Chiti", "Ciabatti", "Ciampi", "Cianchi", "Cianfanelli", "Cianferoni", "Ciani", "Ciapetti", "Ciappi", "Ciardi", "Ciatti", "Cicali", "Ciccone", "Cinelli", "Cini", "Ciobanu", "Ciolli", "Cioni", "Cipriani", "Cirillo", "Cirri", "Ciucchi", "Ciuffi", "Ciulli", "Ciullini", "Clemente", "Cocchi", "Cognome", "Coli", "Collini", "Colombo", "Colzi", "Comparini", "Conforti", "Consigli", "Conte", "Conti", "Contini", "Coppini", "Coppola", "Corsi", "Corsini", "Corti", "Cortini", "Cosi", "Costa", "Costantini", "Costantino", "Cozzi", "Cresci", "Crescioli", "Cresti", "Crini", "Curradi", "D'Agostino", "D'Alessandro", "D'Amico", "D'Angelo", "Daddi", "Dainelli", "Dallai", "Danti", "Davitti", "De Angelis", "De Luca", "De Marco", "De Rosa", "De Santis", "De Simone", "De Vita", "Degl'Innocenti", "Degli Innocenti", "Dei", "Del Lungo", "Del Re", "Di Marco", "Di Stefano", "Dini", "Diop", "Dobre", "Dolfi", "Donati", "Dondoli", "Dong", "Donnini", "Ducci", "Dumitru", "Ermini", "Esposito", "Evangelisti", "Fabbri", "Fabbrini", "Fabbrizzi", "Fabbroni", "Fabbrucci", "Fabiani", "Facchini", "Faggi", "Fagioli", "Failli", "Faini", "Falciani", "Falcini", "Falcone", "Fallani", "Falorni", "Falsini", "Falugiani", "Fancelli", "Fanelli", "Fanetti", "Fanfani", "Fani", "Fantappie'", "Fantechi", "Fanti", "Fantini", "Fantoni", "Farina", "Fattori", "Favilli", "Fedi", "Fei", "Ferrante", "Ferrara", "Ferrari", "Ferraro", "Ferretti", "Ferri", "Ferrini", "Ferroni", "Fiaschi", "Fibbi", "Fiesoli", "Filippi", "Filippini", "Fini", "Fioravanti", "Fiore", "Fiorentini", "Fiorini", "Fissi", "Focardi", "Foggi", "Fontana", "Fontanelli", "Fontani", "Forconi", "Formigli", "Forte", "Forti", "Fortini", "Fossati", "Fossi", "Francalanci", "Franceschi", "Franceschini", "Franchi", "Franchini", "Franci", "Francini", "Francioni", "Franco", "Frassineti", "Frati", "Fratini", "Frilli", "Frizzi", "Frosali", "Frosini", "Frullini", "Fusco", "Fusi", "Gabbrielli", "Gabellini", "Gagliardi", "Galanti", "Galardi", "Galeotti", "Galletti", "Galli", "Gallo", "Gallori", "Gambacciani", "Gargani", "Garofalo", "Garuglieri", "Gashi", "Gasperini", "Gatti", "Gelli", "Gensini", "Gentile", "Gentili", "Geri", "Gerini", "Gheri", "Ghini", "Giachetti", "Giachi", "Giacomelli", "Gianassi", "Giani", "Giannelli", "Giannetti", "Gianni", "Giannini", "Giannoni", "Giannotti", "Giannozzi", "Gigli", "Giordano", "Giorgetti", "Giorgi", "Giovacchini", "Giovannelli", "Giovannetti", "Giovannini", "Giovannoni", "Giuliani", "Giunti", "Giuntini", "Giusti", "Gonnelli", "Goretti", "Gori", "Gradi", "Gramigni", "Grassi", "Grasso", "Graziani", "Grazzini", "Greco", "Grifoni", "Grillo", "Grimaldi", "Grossi", "Gualtieri", "Guarducci", "Guarino", "Guarnieri", "Guasti", "Guerra", "Guerri", "Guerrini", "Guidi", "Guidotti", "He", "Hoxha", "Hu", "Huang", "Iandelli", "Ignesti", "Innocenti", "Jin", "La Rosa", "Lai", "Landi", "Landini", "Lanini", "Lapi", "Lapini", "Lari", "Lascialfari", "Lastrucci", "Latini", "Lazzeri", "Lazzerini", "Lelli", "Lenzi", "Leonardi", "Leoncini", "Leone", "Leoni", "Lepri", "Li", "Liao", "Lin", "Linari", "Lippi", "Lisi", "Livi", "Lombardi", "Lombardini", "Lombardo", "Longo", "Lopez", "Lorenzi", "Lorenzini", "Lorini", "Lotti", "Lu", "Lucchesi", "Lucherini", "Lunghi", "Lupi", "Madiai", "Maestrini", "Maffei", "Maggi", "Maggini", "Magherini", "Magini", "Magnani", "Magnelli", "Magni", "Magnolfi", "Magrini", "Malavolti", "Malevolti", "Manca", "Mancini", "Manetti", "Manfredi", "Mangani", "Mannelli", "Manni", "Mannini", "Mannucci", "Manuelli", "Manzini", "Marcelli", "Marchese", "Marchetti", "Marchi", "Marchiani", "Marchionni", "Marconi", "Marcucci", "Margheri", "Mari", "Mariani", "Marilli", "Marinai", "Marinari", "Marinelli", "Marini", "Marino", "Mariotti", "Marsili", "Martelli", "Martinelli", "Martini", "Martino", "Marzi", "Masi", "Masini", "Masoni", "Massai", "Materassi", "Mattei", "Matteini", "Matteucci", "Matteuzzi", "Mattioli", "Mattolini", "Matucci", "Mauro", "Mazzanti", "Mazzei", "Mazzetti", "Mazzi", "Mazzini", "Mazzocchi", "Mazzoli", "Mazzoni", "Mazzuoli", "Meacci", "Mecocci", "Meini", "Melani", "Mele", "Meli", "Mengoni", "Menichetti", "Meoni", "Merlini", "Messeri", "Messina", "Meucci", "Miccinesi", "Miceli", "Micheli", "Michelini", "Michelozzi", "Migliori", "Migliorini", "Milani", "Miniati", "Misuri", "Monaco", "Montagnani", "Montagni", "Montanari", "Montelatici", "Monti", "Montigiani", "Montini", "Morandi", "Morandini", "Morelli", "Moretti", "Morganti", "Mori", "Morini", "Moroni", "Morozzi", "Mugnai", "Mugnaini", "Mustafa", "Naldi", "Naldini", "Nannelli", "Nanni", "Nannini", "Nannucci", "Nardi", "Nardini", "Nardoni", "Natali", "Ndiaye", "Nencetti", "Nencini", "Nencioni", "Neri", "Nesi", "Nesti", "Niccolai", "Niccoli", "Niccolini", "Nigi", "Nistri", "Nocentini", "Noferini", "Novelli", "Nucci", "Nuti", "Nutini", "Oliva", "Olivieri", "Olmi", "Orlandi", "Orlandini", "Orlando", "Orsini", "Ortolani", "Ottanelli", "Pacciani", "Pace", "Paci", "Pacini", "Pagani", "Pagano", "Paggetti", "Pagliai", "Pagni", "Pagnini", "Paladini", "Palagi", "Palchetti", "Palloni", "Palmieri", "Palumbo", "Pampaloni", "Pancani", "Pandolfi", "Pandolfini", "Panerai", "Panichi", "Paoletti", "Paoli", "Paolini", "Papi", "Papini", "Papucci", "Parenti", "Parigi", "Parisi", "Parri", "Parrini", "Pasquini", "Passeri", "Pecchioli", "Pecorini", "Pellegrini", "Pepi", "Perini", "Perrone", "Peruzzi", "Pesci", "Pestelli", "Petri", "Petrini", "Petrucci", "Pettini", "Pezzati", "Pezzatini", "Piani", "Piazza", "Piazzesi", "Piazzini", "Piccardi", "Picchi", "Piccini", "Piccioli", "Pieraccini", "Pieraccioni", "Pieralli", "Pierattini", "Pieri", "Pierini", "Pieroni", "Pietrini", "Pini", "Pinna", "Pinto", "Pinzani", "Pinzauti", "Piras", "Pisani", "Pistolesi", "Poggesi", "Poggi", "Poggiali", "Poggiolini", "Poli", "Pollastri", "Porciani", "Pozzi", "Pratellesi", "Pratesi", "Prosperi", "Pruneti", "Pucci", "Puccini", "Puccioni", "Pugi", "Pugliese", "Puliti", "Querci", "Quercioli", "Raddi", "Radu", "Raffaelli", "Ragazzini", "Ranfagni", "Ranieri", "Rastrelli", "Raugei", "Raveggi", "Renai", "Renzi", "Rettori", "Ricci", "Ricciardi", "Ridi", "Ridolfi", "Rigacci", "Righi", "Righini", "Rinaldi", "Risaliti", "Ristori", "Rizzo", "Rocchi", "Rocchini", "Rogai", "Romagnoli", "Romanelli", "Romani", "Romano", "Romei", "Romeo", "Romiti", "Romoli", "Romolini", "Rontini", "Rosati", "Roselli", "Rosi", "Rossetti", "Rossi", "Rossini", "Rovai", "Ruggeri", "Ruggiero", "Russo", "Sabatini", "Saccardi", "Sacchetti", "Sacchi", "Sacco", "Salerno", "Salimbeni", "Salucci", "Salvadori", "Salvestrini", "Salvi", "Salvini", "Sanesi", "Sani", "Sanna", "Santi", "Santini", "Santoni", "Santoro", "Santucci", "Sardi", "Sarri", "Sarti", "Sassi", "Sbolci", "Scali", "Scarpelli", "Scarselli", "Scopetani", "Secci", "Selvi", "Senatori", "Senesi", "Serafini", "Sereni", "Serra", "Sestini", "Sguanci", "Sieni", "Signorini", "Silvestri", "Simoncini", "Simonetti", "Simoni", "Singh", "Sodi", "Soldi", "Somigli", "Sorbi", "Sorelli", "Sorrentino", "Sottili", "Spina", "Spinelli", "Staccioli", "Staderini", "Stefanelli", "Stefani", "Stefanini", "Stella", "Susini", "Tacchi", "Tacconi", "Taddei", "Tagliaferri", "Tamburini", "Tanganelli", "Tani", "Tanini", "Tapinassi", "Tarchi", "Tarchiani", "Targioni", "Tassi", "Tassini", "Tempesti", "Terzani", "Tesi", "Testa", "Testi", "Tilli", "Tinti", "Tirinnanzi", "Toccafondi", "Tofanari", "Tofani", "Tognaccini", "Tonelli", "Tonini", "Torelli", "Torrini", "Tosi", "Toti", "Tozzi", "Trambusti", "Trapani", "Tucci", "Turchi", "Ugolini", "Ulivi", "Valente", "Valenti", "Valentini", "Vangelisti", "Vanni", "Vannini", "Vannoni", "Vannozzi", "Vannucchi", "Vannucci", "Ventura", "Venturi", "Venturini", "Vestri", "Vettori", "Vichi", "Viciani", "Vieri", "Vigiani", "Vignoli", "Vignolini", "Vignozzi", "Villani", "Vinci", "Visani", "Vitale", "Vitali", "Viti", "Viviani", "Vivoli", "Volpe", "Volpi", "Wang", "Wu", "Xu", "Yang", "Ye", "Zagli", "Zani", "Zanieri", "Zanobini", "Zecchi", "Zetti", "Zhang", "Zheng", "Zhou", "Zhu", "Zingoni", "Zini", "Zoppi"] 2098 | }, 2099 | 2100 | // Data taken from https://github.com/umpirsky/country-list/blob/master/country/cldr/en_US/country.json 2101 | countries: [{"name":"Afghanistan","abbreviation":"AF"},{"name":"Albania","abbreviation":"AL"},{"name":"Algeria","abbreviation":"DZ"},{"name":"American Samoa","abbreviation":"AS"},{"name":"Andorra","abbreviation":"AD"},{"name":"Angola","abbreviation":"AO"},{"name":"Anguilla","abbreviation":"AI"},{"name":"Antarctica","abbreviation":"AQ"},{"name":"Antigua and Barbuda","abbreviation":"AG"},{"name":"Argentina","abbreviation":"AR"},{"name":"Armenia","abbreviation":"AM"},{"name":"Aruba","abbreviation":"AW"},{"name":"Australia","abbreviation":"AU"},{"name":"Austria","abbreviation":"AT"},{"name":"Azerbaijan","abbreviation":"AZ"},{"name":"Bahamas","abbreviation":"BS"},{"name":"Bahrain","abbreviation":"BH"},{"name":"Bangladesh","abbreviation":"BD"},{"name":"Barbados","abbreviation":"BB"},{"name":"Belarus","abbreviation":"BY"},{"name":"Belgium","abbreviation":"BE"},{"name":"Belize","abbreviation":"BZ"},{"name":"Benin","abbreviation":"BJ"},{"name":"Bermuda","abbreviation":"BM"},{"name":"Bhutan","abbreviation":"BT"},{"name":"Bolivia","abbreviation":"BO"},{"name":"Bosnia and Herzegovina","abbreviation":"BA"},{"name":"Botswana","abbreviation":"BW"},{"name":"Bouvet Island","abbreviation":"BV"},{"name":"Brazil","abbreviation":"BR"},{"name":"British Antarctic Territory","abbreviation":"BQ"},{"name":"British Indian Ocean Territory","abbreviation":"IO"},{"name":"British Virgin Islands","abbreviation":"VG"},{"name":"Brunei","abbreviation":"BN"},{"name":"Bulgaria","abbreviation":"BG"},{"name":"Burkina Faso","abbreviation":"BF"},{"name":"Burundi","abbreviation":"BI"},{"name":"Cambodia","abbreviation":"KH"},{"name":"Cameroon","abbreviation":"CM"},{"name":"Canada","abbreviation":"CA"},{"name":"Canton and Enderbury Islands","abbreviation":"CT"},{"name":"Cape Verde","abbreviation":"CV"},{"name":"Cayman Islands","abbreviation":"KY"},{"name":"Central African Republic","abbreviation":"CF"},{"name":"Chad","abbreviation":"TD"},{"name":"Chile","abbreviation":"CL"},{"name":"China","abbreviation":"CN"},{"name":"Christmas Island","abbreviation":"CX"},{"name":"Cocos [Keeling] Islands","abbreviation":"CC"},{"name":"Colombia","abbreviation":"CO"},{"name":"Comoros","abbreviation":"KM"},{"name":"Congo - Brazzaville","abbreviation":"CG"},{"name":"Congo - Kinshasa","abbreviation":"CD"},{"name":"Cook Islands","abbreviation":"CK"},{"name":"Costa Rica","abbreviation":"CR"},{"name":"Croatia","abbreviation":"HR"},{"name":"Cuba","abbreviation":"CU"},{"name":"Cyprus","abbreviation":"CY"},{"name":"Czech Republic","abbreviation":"CZ"},{"name":"Côte d’Ivoire","abbreviation":"CI"},{"name":"Denmark","abbreviation":"DK"},{"name":"Djibouti","abbreviation":"DJ"},{"name":"Dominica","abbreviation":"DM"},{"name":"Dominican Republic","abbreviation":"DO"},{"name":"Dronning Maud Land","abbreviation":"NQ"},{"name":"East Germany","abbreviation":"DD"},{"name":"Ecuador","abbreviation":"EC"},{"name":"Egypt","abbreviation":"EG"},{"name":"El Salvador","abbreviation":"SV"},{"name":"Equatorial Guinea","abbreviation":"GQ"},{"name":"Eritrea","abbreviation":"ER"},{"name":"Estonia","abbreviation":"EE"},{"name":"Ethiopia","abbreviation":"ET"},{"name":"Falkland Islands","abbreviation":"FK"},{"name":"Faroe Islands","abbreviation":"FO"},{"name":"Fiji","abbreviation":"FJ"},{"name":"Finland","abbreviation":"FI"},{"name":"France","abbreviation":"FR"},{"name":"French Guiana","abbreviation":"GF"},{"name":"French Polynesia","abbreviation":"PF"},{"name":"French Southern Territories","abbreviation":"TF"},{"name":"French Southern and Antarctic Territories","abbreviation":"FQ"},{"name":"Gabon","abbreviation":"GA"},{"name":"Gambia","abbreviation":"GM"},{"name":"Georgia","abbreviation":"GE"},{"name":"Germany","abbreviation":"DE"},{"name":"Ghana","abbreviation":"GH"},{"name":"Gibraltar","abbreviation":"GI"},{"name":"Greece","abbreviation":"GR"},{"name":"Greenland","abbreviation":"GL"},{"name":"Grenada","abbreviation":"GD"},{"name":"Guadeloupe","abbreviation":"GP"},{"name":"Guam","abbreviation":"GU"},{"name":"Guatemala","abbreviation":"GT"},{"name":"Guernsey","abbreviation":"GG"},{"name":"Guinea","abbreviation":"GN"},{"name":"Guinea-Bissau","abbreviation":"GW"},{"name":"Guyana","abbreviation":"GY"},{"name":"Haiti","abbreviation":"HT"},{"name":"Heard Island and McDonald Islands","abbreviation":"HM"},{"name":"Honduras","abbreviation":"HN"},{"name":"Hong Kong SAR China","abbreviation":"HK"},{"name":"Hungary","abbreviation":"HU"},{"name":"Iceland","abbreviation":"IS"},{"name":"India","abbreviation":"IN"},{"name":"Indonesia","abbreviation":"ID"},{"name":"Iran","abbreviation":"IR"},{"name":"Iraq","abbreviation":"IQ"},{"name":"Ireland","abbreviation":"IE"},{"name":"Isle of Man","abbreviation":"IM"},{"name":"Israel","abbreviation":"IL"},{"name":"Italy","abbreviation":"IT"},{"name":"Jamaica","abbreviation":"JM"},{"name":"Japan","abbreviation":"JP"},{"name":"Jersey","abbreviation":"JE"},{"name":"Johnston Island","abbreviation":"JT"},{"name":"Jordan","abbreviation":"JO"},{"name":"Kazakhstan","abbreviation":"KZ"},{"name":"Kenya","abbreviation":"KE"},{"name":"Kiribati","abbreviation":"KI"},{"name":"Kuwait","abbreviation":"KW"},{"name":"Kyrgyzstan","abbreviation":"KG"},{"name":"Laos","abbreviation":"LA"},{"name":"Latvia","abbreviation":"LV"},{"name":"Lebanon","abbreviation":"LB"},{"name":"Lesotho","abbreviation":"LS"},{"name":"Liberia","abbreviation":"LR"},{"name":"Libya","abbreviation":"LY"},{"name":"Liechtenstein","abbreviation":"LI"},{"name":"Lithuania","abbreviation":"LT"},{"name":"Luxembourg","abbreviation":"LU"},{"name":"Macau SAR China","abbreviation":"MO"},{"name":"Macedonia","abbreviation":"MK"},{"name":"Madagascar","abbreviation":"MG"},{"name":"Malawi","abbreviation":"MW"},{"name":"Malaysia","abbreviation":"MY"},{"name":"Maldives","abbreviation":"MV"},{"name":"Mali","abbreviation":"ML"},{"name":"Malta","abbreviation":"MT"},{"name":"Marshall Islands","abbreviation":"MH"},{"name":"Martinique","abbreviation":"MQ"},{"name":"Mauritania","abbreviation":"MR"},{"name":"Mauritius","abbreviation":"MU"},{"name":"Mayotte","abbreviation":"YT"},{"name":"Metropolitan France","abbreviation":"FX"},{"name":"Mexico","abbreviation":"MX"},{"name":"Micronesia","abbreviation":"FM"},{"name":"Midway Islands","abbreviation":"MI"},{"name":"Moldova","abbreviation":"MD"},{"name":"Monaco","abbreviation":"MC"},{"name":"Mongolia","abbreviation":"MN"},{"name":"Montenegro","abbreviation":"ME"},{"name":"Montserrat","abbreviation":"MS"},{"name":"Morocco","abbreviation":"MA"},{"name":"Mozambique","abbreviation":"MZ"},{"name":"Myanmar [Burma]","abbreviation":"MM"},{"name":"Namibia","abbreviation":"NA"},{"name":"Nauru","abbreviation":"NR"},{"name":"Nepal","abbreviation":"NP"},{"name":"Netherlands","abbreviation":"NL"},{"name":"Netherlands Antilles","abbreviation":"AN"},{"name":"Neutral Zone","abbreviation":"NT"},{"name":"New Caledonia","abbreviation":"NC"},{"name":"New Zealand","abbreviation":"NZ"},{"name":"Nicaragua","abbreviation":"NI"},{"name":"Niger","abbreviation":"NE"},{"name":"Nigeria","abbreviation":"NG"},{"name":"Niue","abbreviation":"NU"},{"name":"Norfolk Island","abbreviation":"NF"},{"name":"North Korea","abbreviation":"KP"},{"name":"North Vietnam","abbreviation":"VD"},{"name":"Northern Mariana Islands","abbreviation":"MP"},{"name":"Norway","abbreviation":"NO"},{"name":"Oman","abbreviation":"OM"},{"name":"Pacific Islands Trust Territory","abbreviation":"PC"},{"name":"Pakistan","abbreviation":"PK"},{"name":"Palau","abbreviation":"PW"},{"name":"Palestinian Territories","abbreviation":"PS"},{"name":"Panama","abbreviation":"PA"},{"name":"Panama Canal Zone","abbreviation":"PZ"},{"name":"Papua New Guinea","abbreviation":"PG"},{"name":"Paraguay","abbreviation":"PY"},{"name":"People's Democratic Republic of Yemen","abbreviation":"YD"},{"name":"Peru","abbreviation":"PE"},{"name":"Philippines","abbreviation":"PH"},{"name":"Pitcairn Islands","abbreviation":"PN"},{"name":"Poland","abbreviation":"PL"},{"name":"Portugal","abbreviation":"PT"},{"name":"Puerto Rico","abbreviation":"PR"},{"name":"Qatar","abbreviation":"QA"},{"name":"Romania","abbreviation":"RO"},{"name":"Russia","abbreviation":"RU"},{"name":"Rwanda","abbreviation":"RW"},{"name":"Réunion","abbreviation":"RE"},{"name":"Saint Barthélemy","abbreviation":"BL"},{"name":"Saint Helena","abbreviation":"SH"},{"name":"Saint Kitts and Nevis","abbreviation":"KN"},{"name":"Saint Lucia","abbreviation":"LC"},{"name":"Saint Martin","abbreviation":"MF"},{"name":"Saint Pierre and Miquelon","abbreviation":"PM"},{"name":"Saint Vincent and the Grenadines","abbreviation":"VC"},{"name":"Samoa","abbreviation":"WS"},{"name":"San Marino","abbreviation":"SM"},{"name":"Saudi Arabia","abbreviation":"SA"},{"name":"Senegal","abbreviation":"SN"},{"name":"Serbia","abbreviation":"RS"},{"name":"Serbia and Montenegro","abbreviation":"CS"},{"name":"Seychelles","abbreviation":"SC"},{"name":"Sierra Leone","abbreviation":"SL"},{"name":"Singapore","abbreviation":"SG"},{"name":"Slovakia","abbreviation":"SK"},{"name":"Slovenia","abbreviation":"SI"},{"name":"Solomon Islands","abbreviation":"SB"},{"name":"Somalia","abbreviation":"SO"},{"name":"South Africa","abbreviation":"ZA"},{"name":"South Georgia and the South Sandwich Islands","abbreviation":"GS"},{"name":"South Korea","abbreviation":"KR"},{"name":"Spain","abbreviation":"ES"},{"name":"Sri Lanka","abbreviation":"LK"},{"name":"Sudan","abbreviation":"SD"},{"name":"Suriname","abbreviation":"SR"},{"name":"Svalbard and Jan Mayen","abbreviation":"SJ"},{"name":"Swaziland","abbreviation":"SZ"},{"name":"Sweden","abbreviation":"SE"},{"name":"Switzerland","abbreviation":"CH"},{"name":"Syria","abbreviation":"SY"},{"name":"São Tomé and Príncipe","abbreviation":"ST"},{"name":"Taiwan","abbreviation":"TW"},{"name":"Tajikistan","abbreviation":"TJ"},{"name":"Tanzania","abbreviation":"TZ"},{"name":"Thailand","abbreviation":"TH"},{"name":"Timor-Leste","abbreviation":"TL"},{"name":"Togo","abbreviation":"TG"},{"name":"Tokelau","abbreviation":"TK"},{"name":"Tonga","abbreviation":"TO"},{"name":"Trinidad and Tobago","abbreviation":"TT"},{"name":"Tunisia","abbreviation":"TN"},{"name":"Turkey","abbreviation":"TR"},{"name":"Turkmenistan","abbreviation":"TM"},{"name":"Turks and Caicos Islands","abbreviation":"TC"},{"name":"Tuvalu","abbreviation":"TV"},{"name":"U.S. Minor Outlying Islands","abbreviation":"UM"},{"name":"U.S. Miscellaneous Pacific Islands","abbreviation":"PU"},{"name":"U.S. Virgin Islands","abbreviation":"VI"},{"name":"Uganda","abbreviation":"UG"},{"name":"Ukraine","abbreviation":"UA"},{"name":"Union of Soviet Socialist Republics","abbreviation":"SU"},{"name":"United Arab Emirates","abbreviation":"AE"},{"name":"United Kingdom","abbreviation":"GB"},{"name":"United States","abbreviation":"US"},{"name":"Unknown or Invalid Region","abbreviation":"ZZ"},{"name":"Uruguay","abbreviation":"UY"},{"name":"Uzbekistan","abbreviation":"UZ"},{"name":"Vanuatu","abbreviation":"VU"},{"name":"Vatican City","abbreviation":"VA"},{"name":"Venezuela","abbreviation":"VE"},{"name":"Vietnam","abbreviation":"VN"},{"name":"Wake Island","abbreviation":"WK"},{"name":"Wallis and Futuna","abbreviation":"WF"},{"name":"Western Sahara","abbreviation":"EH"},{"name":"Yemen","abbreviation":"YE"},{"name":"Zambia","abbreviation":"ZM"},{"name":"Zimbabwe","abbreviation":"ZW"},{"name":"Åland Islands","abbreviation":"AX"}], 2102 | 2103 | provinces: { 2104 | "ca": [ 2105 | {name: 'Alberta', abbreviation: 'AB'}, 2106 | {name: 'British Columbia', abbreviation: 'BC'}, 2107 | {name: 'Manitoba', abbreviation: 'MB'}, 2108 | {name: 'New Brunswick', abbreviation: 'NB'}, 2109 | {name: 'Newfoundland and Labrador', abbreviation: 'NL'}, 2110 | {name: 'Nova Scotia', abbreviation: 'NS'}, 2111 | {name: 'Ontario', abbreviation: 'ON'}, 2112 | {name: 'Prince Edward Island', abbreviation: 'PE'}, 2113 | {name: 'Quebec', abbreviation: 'QC'}, 2114 | {name: 'Saskatchewan', abbreviation: 'SK'}, 2115 | 2116 | // The case could be made that the following are not actually provinces 2117 | // since they are technically considered "territories" however they all 2118 | // look the same on an envelope! 2119 | {name: 'Northwest Territories', abbreviation: 'NT'}, 2120 | {name: 'Nunavut', abbreviation: 'NU'}, 2121 | {name: 'Yukon', abbreviation: 'YT'} 2122 | ], 2123 | "it": [ 2124 | { name: "Agrigento", abbreviation: "AG", code: 84 }, 2125 | { name: "Alessandria", abbreviation: "AL", code: 6 }, 2126 | { name: "Ancona", abbreviation: "AN", code: 42 }, 2127 | { name: "Aosta", abbreviation: "AO", code: 7 }, 2128 | { name: "L'Aquila", abbreviation: "AQ", code: 66 }, 2129 | { name: "Arezzo", abbreviation: "AR", code: 51 }, 2130 | { name: "Ascoli-Piceno", abbreviation: "AP", code: 44 }, 2131 | { name: "Asti", abbreviation: "AT", code: 5 }, 2132 | { name: "Avellino", abbreviation: "AV", code: 64 }, 2133 | { name: "Bari", abbreviation: "BA", code: 72 }, 2134 | { name: "Barletta-Andria-Trani", abbreviation: "BT", code: 72 }, 2135 | { name: "Belluno", abbreviation: "BL", code: 25 }, 2136 | { name: "Benevento", abbreviation: "BN", code: 62 }, 2137 | { name: "Bergamo", abbreviation: "BG", code: 16 }, 2138 | { name: "Biella", abbreviation: "BI", code: 96 }, 2139 | { name: "Bologna", abbreviation: "BO", code: 37 }, 2140 | { name: "Bolzano", abbreviation: "BZ", code: 21 }, 2141 | { name: "Brescia", abbreviation: "BS", code: 17 }, 2142 | { name: "Brindisi", abbreviation: "BR", code: 74 }, 2143 | { name: "Cagliari", abbreviation: "CA", code: 92 }, 2144 | { name: "Caltanissetta", abbreviation: "CL", code: 85 }, 2145 | { name: "Campobasso", abbreviation: "CB", code: 70 }, 2146 | { name: "Carbonia Iglesias", abbreviation: "CI", code: 70 }, 2147 | { name: "Caserta", abbreviation: "CE", code: 61 }, 2148 | { name: "Catania", abbreviation: "CT", code: 87 }, 2149 | { name: "Catanzaro", abbreviation: "CZ", code: 79 }, 2150 | { name: "Chieti", abbreviation: "CH", code: 69 }, 2151 | { name: "Como", abbreviation: "CO", code: 13 }, 2152 | { name: "Cosenza", abbreviation: "CS", code: 78 }, 2153 | { name: "Cremona", abbreviation: "CR", code: 19 }, 2154 | { name: "Crotone", abbreviation: "KR", code: 101 }, 2155 | { name: "Cuneo", abbreviation: "CN", code: 4 }, 2156 | { name: "Enna", abbreviation: "EN", code: 86 }, 2157 | { name: "Fermo", abbreviation: "FM", code: 86 }, 2158 | { name: "Ferrara", abbreviation: "FE", code: 38 }, 2159 | { name: "Firenze", abbreviation: "FI", code: 48 }, 2160 | { name: "Foggia", abbreviation: "FG", code: 71 }, 2161 | { name: "Forli-Cesena", abbreviation: "FC", code: 71 }, 2162 | { name: "Frosinone", abbreviation: "FR", code: 60 }, 2163 | { name: "Genova", abbreviation: "GE", code: 10 }, 2164 | { name: "Gorizia", abbreviation: "GO", code: 31 }, 2165 | { name: "Grosseto", abbreviation: "GR", code: 53 }, 2166 | { name: "Imperia", abbreviation: "IM", code: 8 }, 2167 | { name: "Isernia", abbreviation: "IS", code: 94 }, 2168 | { name: "La-Spezia", abbreviation: "SP", code: 66 }, 2169 | { name: "Latina", abbreviation: "LT", code: 59 }, 2170 | { name: "Lecce", abbreviation: "LE", code: 75 }, 2171 | { name: "Lecco", abbreviation: "LC", code: 97 }, 2172 | { name: "Livorno", abbreviation: "LI", code: 49 }, 2173 | { name: "Lodi", abbreviation: "LO", code: 98 }, 2174 | { name: "Lucca", abbreviation: "LU", code: 46 }, 2175 | { name: "Macerata", abbreviation: "MC", code: 43 }, 2176 | { name: "Mantova", abbreviation: "MN", code: 20 }, 2177 | { name: "Massa-Carrara", abbreviation: "MS", code: 45 }, 2178 | { name: "Matera", abbreviation: "MT", code: 77 }, 2179 | { name: "Medio Campidano", abbreviation: "VS", code: 77 }, 2180 | { name: "Messina", abbreviation: "ME", code: 83 }, 2181 | { name: "Milano", abbreviation: "MI", code: 15 }, 2182 | { name: "Modena", abbreviation: "MO", code: 36 }, 2183 | { name: "Monza-Brianza", abbreviation: "MB", code: 36 }, 2184 | { name: "Napoli", abbreviation: "NA", code: 63 }, 2185 | { name: "Novara", abbreviation: "NO", code: 3 }, 2186 | { name: "Nuoro", abbreviation: "NU", code: 91 }, 2187 | { name: "Ogliastra", abbreviation: "OG", code: 91 }, 2188 | { name: "Olbia Tempio", abbreviation: "OT", code: 91 }, 2189 | { name: "Oristano", abbreviation: "OR", code: 95 }, 2190 | { name: "Padova", abbreviation: "PD", code: 28 }, 2191 | { name: "Palermo", abbreviation: "PA", code: 82 }, 2192 | { name: "Parma", abbreviation: "PR", code: 34 }, 2193 | { name: "Pavia", abbreviation: "PV", code: 18 }, 2194 | { name: "Perugia", abbreviation: "PG", code: 54 }, 2195 | { name: "Pesaro-Urbino", abbreviation: "PU", code: 41 }, 2196 | { name: "Pescara", abbreviation: "PE", code: 68 }, 2197 | { name: "Piacenza", abbreviation: "PC", code: 33 }, 2198 | { name: "Pisa", abbreviation: "PI", code: 50 }, 2199 | { name: "Pistoia", abbreviation: "PT", code: 47 }, 2200 | { name: "Pordenone", abbreviation: "PN", code: 93 }, 2201 | { name: "Potenza", abbreviation: "PZ", code: 76 }, 2202 | { name: "Prato", abbreviation: "PO", code: 100 }, 2203 | { name: "Ragusa", abbreviation: "RG", code: 88 }, 2204 | { name: "Ravenna", abbreviation: "RA", code: 39 }, 2205 | { name: "Reggio-Calabria", abbreviation: "RC", code: 35 }, 2206 | { name: "Reggio-Emilia", abbreviation: "RE", code: 35 }, 2207 | { name: "Rieti", abbreviation: "RI", code: 57 }, 2208 | { name: "Rimini", abbreviation: "RN", code: 99 }, 2209 | { name: "Roma", abbreviation: "Roma", code: 58 }, 2210 | { name: "Rovigo", abbreviation: "RO", code: 29 }, 2211 | { name: "Salerno", abbreviation: "SA", code: 65 }, 2212 | { name: "Sassari", abbreviation: "SS", code: 90 }, 2213 | { name: "Savona", abbreviation: "SV", code: 9 }, 2214 | { name: "Siena", abbreviation: "SI", code: 52 }, 2215 | { name: "Siracusa", abbreviation: "SR", code: 89 }, 2216 | { name: "Sondrio", abbreviation: "SO", code: 14 }, 2217 | { name: "Taranto", abbreviation: "TA", code: 73 }, 2218 | { name: "Teramo", abbreviation: "TE", code: 67 }, 2219 | { name: "Terni", abbreviation: "TR", code: 55 }, 2220 | { name: "Torino", abbreviation: "TO", code: 1 }, 2221 | { name: "Trapani", abbreviation: "TP", code: 81 }, 2222 | { name: "Trento", abbreviation: "TN", code: 22 }, 2223 | { name: "Treviso", abbreviation: "TV", code: 26 }, 2224 | { name: "Trieste", abbreviation: "TS", code: 32 }, 2225 | { name: "Udine", abbreviation: "UD", code: 30 }, 2226 | { name: "Varese", abbreviation: "VA", code: 12 }, 2227 | { name: "Venezia", abbreviation: "VE", code: 27 }, 2228 | { name: "Verbania", abbreviation: "VB", code: 27 }, 2229 | { name: "Vercelli", abbreviation: "VC", code: 2 }, 2230 | { name: "Verona", abbreviation: "VR", code: 23 }, 2231 | { name: "Vibo-Valentia", abbreviation: "VV", code: 102 }, 2232 | { name: "Vicenza", abbreviation: "VI", code: 24 }, 2233 | { name: "Viterbo", abbreviation: "VT", code: 56 } 2234 | ] 2235 | }, 2236 | 2237 | // from: https://github.com/samsargent/Useful-Autocomplete-Data/blob/master/data/nationalities.json 2238 | nationalities: [ 2239 | {name: 'Afghan'}, 2240 | {name: 'Albanian'}, 2241 | {name: 'Algerian'}, 2242 | {name: 'American'}, 2243 | {name: 'Andorran'}, 2244 | {name: 'Angolan'}, 2245 | {name: 'Antiguans'}, 2246 | {name: 'Argentinean'}, 2247 | {name: 'Armenian'}, 2248 | {name: 'Australian'}, 2249 | {name: 'Austrian'}, 2250 | {name: 'Azerbaijani'}, 2251 | {name: 'Bahami'}, 2252 | {name: 'Bahraini'}, 2253 | {name: 'Bangladeshi'}, 2254 | {name: 'Barbadian'}, 2255 | {name: 'Barbudans'}, 2256 | {name: 'Batswana'}, 2257 | {name: 'Belarusian'}, 2258 | {name: 'Belgian'}, 2259 | {name: 'Belizean'}, 2260 | {name: 'Beninese'}, 2261 | {name: 'Bhutanese'}, 2262 | {name: 'Bolivian'}, 2263 | {name: 'Bosnian'}, 2264 | {name: 'Brazilian'}, 2265 | {name: 'British'}, 2266 | {name: 'Bruneian'}, 2267 | {name: 'Bulgarian'}, 2268 | {name: 'Burkinabe'}, 2269 | {name: 'Burmese'}, 2270 | {name: 'Burundian'}, 2271 | {name: 'Cambodian'}, 2272 | {name: 'Cameroonian'}, 2273 | {name: 'Canadian'}, 2274 | {name: 'Cape Verdean'}, 2275 | {name: 'Central African'}, 2276 | {name: 'Chadian'}, 2277 | {name: 'Chilean'}, 2278 | {name: 'Chinese'}, 2279 | {name: 'Colombian'}, 2280 | {name: 'Comoran'}, 2281 | {name: 'Congolese'}, 2282 | {name: 'Costa Rican'}, 2283 | {name: 'Croatian'}, 2284 | {name: 'Cuban'}, 2285 | {name: 'Cypriot'}, 2286 | {name: 'Czech'}, 2287 | {name: 'Danish'}, 2288 | {name: 'Djibouti'}, 2289 | {name: 'Dominican'}, 2290 | {name: 'Dutch'}, 2291 | {name: 'East Timorese'}, 2292 | {name: 'Ecuadorean'}, 2293 | {name: 'Egyptian'}, 2294 | {name: 'Emirian'}, 2295 | {name: 'Equatorial Guinean'}, 2296 | {name: 'Eritrean'}, 2297 | {name: 'Estonian'}, 2298 | {name: 'Ethiopian'}, 2299 | {name: 'Fijian'}, 2300 | {name: 'Filipino'}, 2301 | {name: 'Finnish'}, 2302 | {name: 'French'}, 2303 | {name: 'Gabonese'}, 2304 | {name: 'Gambian'}, 2305 | {name: 'Georgian'}, 2306 | {name: 'German'}, 2307 | {name: 'Ghanaian'}, 2308 | {name: 'Greek'}, 2309 | {name: 'Grenadian'}, 2310 | {name: 'Guatemalan'}, 2311 | {name: 'Guinea-Bissauan'}, 2312 | {name: 'Guinean'}, 2313 | {name: 'Guyanese'}, 2314 | {name: 'Haitian'}, 2315 | {name: 'Herzegovinian'}, 2316 | {name: 'Honduran'}, 2317 | {name: 'Hungarian'}, 2318 | {name: 'I-Kiribati'}, 2319 | {name: 'Icelander'}, 2320 | {name: 'Indian'}, 2321 | {name: 'Indonesian'}, 2322 | {name: 'Iranian'}, 2323 | {name: 'Iraqi'}, 2324 | {name: 'Irish'}, 2325 | {name: 'Israeli'}, 2326 | {name: 'Italian'}, 2327 | {name: 'Ivorian'}, 2328 | {name: 'Jamaican'}, 2329 | {name: 'Japanese'}, 2330 | {name: 'Jordanian'}, 2331 | {name: 'Kazakhstani'}, 2332 | {name: 'Kenyan'}, 2333 | {name: 'Kittian and Nevisian'}, 2334 | {name: 'Kuwaiti'}, 2335 | {name: 'Kyrgyz'}, 2336 | {name: 'Laotian'}, 2337 | {name: 'Latvian'}, 2338 | {name: 'Lebanese'}, 2339 | {name: 'Liberian'}, 2340 | {name: 'Libyan'}, 2341 | {name: 'Liechtensteiner'}, 2342 | {name: 'Lithuanian'}, 2343 | {name: 'Luxembourger'}, 2344 | {name: 'Macedonian'}, 2345 | {name: 'Malagasy'}, 2346 | {name: 'Malawian'}, 2347 | {name: 'Malaysian'}, 2348 | {name: 'Maldivan'}, 2349 | {name: 'Malian'}, 2350 | {name: 'Maltese'}, 2351 | {name: 'Marshallese'}, 2352 | {name: 'Mauritanian'}, 2353 | {name: 'Mauritian'}, 2354 | {name: 'Mexican'}, 2355 | {name: 'Micronesian'}, 2356 | {name: 'Moldovan'}, 2357 | {name: 'Monacan'}, 2358 | {name: 'Mongolian'}, 2359 | {name: 'Moroccan'}, 2360 | {name: 'Mosotho'}, 2361 | {name: 'Motswana'}, 2362 | {name: 'Mozambican'}, 2363 | {name: 'Namibian'}, 2364 | {name: 'Nauruan'}, 2365 | {name: 'Nepalese'}, 2366 | {name: 'New Zealander'}, 2367 | {name: 'Nicaraguan'}, 2368 | {name: 'Nigerian'}, 2369 | {name: 'Nigerien'}, 2370 | {name: 'North Korean'}, 2371 | {name: 'Northern Irish'}, 2372 | {name: 'Norwegian'}, 2373 | {name: 'Omani'}, 2374 | {name: 'Pakistani'}, 2375 | {name: 'Palauan'}, 2376 | {name: 'Panamanian'}, 2377 | {name: 'Papua New Guinean'}, 2378 | {name: 'Paraguayan'}, 2379 | {name: 'Peruvian'}, 2380 | {name: 'Polish'}, 2381 | {name: 'Portuguese'}, 2382 | {name: 'Qatari'}, 2383 | {name: 'Romani'}, 2384 | {name: 'Russian'}, 2385 | {name: 'Rwandan'}, 2386 | {name: 'Saint Lucian'}, 2387 | {name: 'Salvadoran'}, 2388 | {name: 'Samoan'}, 2389 | {name: 'San Marinese'}, 2390 | {name: 'Sao Tomean'}, 2391 | {name: 'Saudi'}, 2392 | {name: 'Scottish'}, 2393 | {name: 'Senegalese'}, 2394 | {name: 'Serbian'}, 2395 | {name: 'Seychellois'}, 2396 | {name: 'Sierra Leonean'}, 2397 | {name: 'Singaporean'}, 2398 | {name: 'Slovakian'}, 2399 | {name: 'Slovenian'}, 2400 | {name: 'Solomon Islander'}, 2401 | {name: 'Somali'}, 2402 | {name: 'South African'}, 2403 | {name: 'South Korean'}, 2404 | {name: 'Spanish'}, 2405 | {name: 'Sri Lankan'}, 2406 | {name: 'Sudanese'}, 2407 | {name: 'Surinamer'}, 2408 | {name: 'Swazi'}, 2409 | {name: 'Swedish'}, 2410 | {name: 'Swiss'}, 2411 | {name: 'Syrian'}, 2412 | {name: 'Taiwanese'}, 2413 | {name: 'Tajik'}, 2414 | {name: 'Tanzanian'}, 2415 | {name: 'Thai'}, 2416 | {name: 'Togolese'}, 2417 | {name: 'Tongan'}, 2418 | {name: 'Trinidadian or Tobagonian'}, 2419 | {name: 'Tunisian'}, 2420 | {name: 'Turkish'}, 2421 | {name: 'Tuvaluan'}, 2422 | {name: 'Ugandan'}, 2423 | {name: 'Ukrainian'}, 2424 | {name: 'Uruguaya'}, 2425 | {name: 'Uzbekistani'}, 2426 | {name: 'Venezuela'}, 2427 | {name: 'Vietnamese'}, 2428 | {name: 'Wels'}, 2429 | {name: 'Yemenit'}, 2430 | {name: 'Zambia'}, 2431 | {name: 'Zimbabwe'}, 2432 | ], 2433 | 2434 | us_states_and_dc: [ 2435 | {name: 'Alabama', abbreviation: 'AL'}, 2436 | {name: 'Alaska', abbreviation: 'AK'}, 2437 | {name: 'Arizona', abbreviation: 'AZ'}, 2438 | {name: 'Arkansas', abbreviation: 'AR'}, 2439 | {name: 'California', abbreviation: 'CA'}, 2440 | {name: 'Colorado', abbreviation: 'CO'}, 2441 | {name: 'Connecticut', abbreviation: 'CT'}, 2442 | {name: 'Delaware', abbreviation: 'DE'}, 2443 | {name: 'District of Columbia', abbreviation: 'DC'}, 2444 | {name: 'Florida', abbreviation: 'FL'}, 2445 | {name: 'Georgia', abbreviation: 'GA'}, 2446 | {name: 'Hawaii', abbreviation: 'HI'}, 2447 | {name: 'Idaho', abbreviation: 'ID'}, 2448 | {name: 'Illinois', abbreviation: 'IL'}, 2449 | {name: 'Indiana', abbreviation: 'IN'}, 2450 | {name: 'Iowa', abbreviation: 'IA'}, 2451 | {name: 'Kansas', abbreviation: 'KS'}, 2452 | {name: 'Kentucky', abbreviation: 'KY'}, 2453 | {name: 'Louisiana', abbreviation: 'LA'}, 2454 | {name: 'Maine', abbreviation: 'ME'}, 2455 | {name: 'Maryland', abbreviation: 'MD'}, 2456 | {name: 'Massachusetts', abbreviation: 'MA'}, 2457 | {name: 'Michigan', abbreviation: 'MI'}, 2458 | {name: 'Minnesota', abbreviation: 'MN'}, 2459 | {name: 'Mississippi', abbreviation: 'MS'}, 2460 | {name: 'Missouri', abbreviation: 'MO'}, 2461 | {name: 'Montana', abbreviation: 'MT'}, 2462 | {name: 'Nebraska', abbreviation: 'NE'}, 2463 | {name: 'Nevada', abbreviation: 'NV'}, 2464 | {name: 'New Hampshire', abbreviation: 'NH'}, 2465 | {name: 'New Jersey', abbreviation: 'NJ'}, 2466 | {name: 'New Mexico', abbreviation: 'NM'}, 2467 | {name: 'New York', abbreviation: 'NY'}, 2468 | {name: 'North Carolina', abbreviation: 'NC'}, 2469 | {name: 'North Dakota', abbreviation: 'ND'}, 2470 | {name: 'Ohio', abbreviation: 'OH'}, 2471 | {name: 'Oklahoma', abbreviation: 'OK'}, 2472 | {name: 'Oregon', abbreviation: 'OR'}, 2473 | {name: 'Pennsylvania', abbreviation: 'PA'}, 2474 | {name: 'Rhode Island', abbreviation: 'RI'}, 2475 | {name: 'South Carolina', abbreviation: 'SC'}, 2476 | {name: 'South Dakota', abbreviation: 'SD'}, 2477 | {name: 'Tennessee', abbreviation: 'TN'}, 2478 | {name: 'Texas', abbreviation: 'TX'}, 2479 | {name: 'Utah', abbreviation: 'UT'}, 2480 | {name: 'Vermont', abbreviation: 'VT'}, 2481 | {name: 'Virginia', abbreviation: 'VA'}, 2482 | {name: 'Washington', abbreviation: 'WA'}, 2483 | {name: 'West Virginia', abbreviation: 'WV'}, 2484 | {name: 'Wisconsin', abbreviation: 'WI'}, 2485 | {name: 'Wyoming', abbreviation: 'WY'} 2486 | ], 2487 | 2488 | territories: [ 2489 | {name: 'American Samoa', abbreviation: 'AS'}, 2490 | {name: 'Federated States of Micronesia', abbreviation: 'FM'}, 2491 | {name: 'Guam', abbreviation: 'GU'}, 2492 | {name: 'Marshall Islands', abbreviation: 'MH'}, 2493 | {name: 'Northern Mariana Islands', abbreviation: 'MP'}, 2494 | {name: 'Puerto Rico', abbreviation: 'PR'}, 2495 | {name: 'Virgin Islands, U.S.', abbreviation: 'VI'} 2496 | ], 2497 | 2498 | armed_forces: [ 2499 | {name: 'Armed Forces Europe', abbreviation: 'AE'}, 2500 | {name: 'Armed Forces Pacific', abbreviation: 'AP'}, 2501 | {name: 'Armed Forces the Americas', abbreviation: 'AA'} 2502 | ], 2503 | 2504 | country_regions: { 2505 | it: [ 2506 | { name: "Valle d'Aosta", abbreviation: "VDA" }, 2507 | { name: "Piemonte", abbreviation: "PIE" }, 2508 | { name: "Lombardia", abbreviation: "LOM" }, 2509 | { name: "Veneto", abbreviation: "VEN" }, 2510 | { name: "Trentino Alto Adige", abbreviation: "TAA" }, 2511 | { name: "Friuli Venezia Giulia", abbreviation: "FVG" }, 2512 | { name: "Liguria", abbreviation: "LIG" }, 2513 | { name: "Emilia Romagna", abbreviation: "EMR" }, 2514 | { name: "Toscana", abbreviation: "TOS" }, 2515 | { name: "Umbria", abbreviation: "UMB" }, 2516 | { name: "Marche", abbreviation: "MAR" }, 2517 | { name: "Abruzzo", abbreviation: "ABR" }, 2518 | { name: "Lazio", abbreviation: "LAZ" }, 2519 | { name: "Campania", abbreviation: "CAM" }, 2520 | { name: "Puglia", abbreviation: "PUG" }, 2521 | { name: "Basilicata", abbreviation: "BAS" }, 2522 | { name: "Molise", abbreviation: "MOL" }, 2523 | { name: "Calabria", abbreviation: "CAL" }, 2524 | { name: "Sicilia", abbreviation: "SIC" }, 2525 | { name: "Sardegna", abbreviation: "SAR" } 2526 | ] 2527 | }, 2528 | 2529 | street_suffixes: { 2530 | 'us': [ 2531 | {name: 'Avenue', abbreviation: 'Ave'}, 2532 | {name: 'Boulevard', abbreviation: 'Blvd'}, 2533 | {name: 'Center', abbreviation: 'Ctr'}, 2534 | {name: 'Circle', abbreviation: 'Cir'}, 2535 | {name: 'Court', abbreviation: 'Ct'}, 2536 | {name: 'Drive', abbreviation: 'Dr'}, 2537 | {name: 'Extension', abbreviation: 'Ext'}, 2538 | {name: 'Glen', abbreviation: 'Gln'}, 2539 | {name: 'Grove', abbreviation: 'Grv'}, 2540 | {name: 'Heights', abbreviation: 'Hts'}, 2541 | {name: 'Highway', abbreviation: 'Hwy'}, 2542 | {name: 'Junction', abbreviation: 'Jct'}, 2543 | {name: 'Key', abbreviation: 'Key'}, 2544 | {name: 'Lane', abbreviation: 'Ln'}, 2545 | {name: 'Loop', abbreviation: 'Loop'}, 2546 | {name: 'Manor', abbreviation: 'Mnr'}, 2547 | {name: 'Mill', abbreviation: 'Mill'}, 2548 | {name: 'Park', abbreviation: 'Park'}, 2549 | {name: 'Parkway', abbreviation: 'Pkwy'}, 2550 | {name: 'Pass', abbreviation: 'Pass'}, 2551 | {name: 'Path', abbreviation: 'Path'}, 2552 | {name: 'Pike', abbreviation: 'Pike'}, 2553 | {name: 'Place', abbreviation: 'Pl'}, 2554 | {name: 'Plaza', abbreviation: 'Plz'}, 2555 | {name: 'Point', abbreviation: 'Pt'}, 2556 | {name: 'Ridge', abbreviation: 'Rdg'}, 2557 | {name: 'River', abbreviation: 'Riv'}, 2558 | {name: 'Road', abbreviation: 'Rd'}, 2559 | {name: 'Square', abbreviation: 'Sq'}, 2560 | {name: 'Street', abbreviation: 'St'}, 2561 | {name: 'Terrace', abbreviation: 'Ter'}, 2562 | {name: 'Trail', abbreviation: 'Trl'}, 2563 | {name: 'Turnpike', abbreviation: 'Tpke'}, 2564 | {name: 'View', abbreviation: 'Vw'}, 2565 | {name: 'Way', abbreviation: 'Way'} 2566 | ], 2567 | 'it': [ 2568 | { name: 'Accesso', abbreviation: 'Acc.' }, 2569 | { name: 'Alzaia', abbreviation: 'Alz.' }, 2570 | { name: 'Arco', abbreviation: 'Arco' }, 2571 | { name: 'Archivolto', abbreviation: 'Acv.' }, 2572 | { name: 'Arena', abbreviation: 'Arena' }, 2573 | { name: 'Argine', abbreviation: 'Argine' }, 2574 | { name: 'Bacino', abbreviation: 'Bacino' }, 2575 | { name: 'Banchi', abbreviation: 'Banchi' }, 2576 | { name: 'Banchina', abbreviation: 'Ban.' }, 2577 | { name: 'Bastioni', abbreviation: 'Bas.' }, 2578 | { name: 'Belvedere', abbreviation: 'Belv.' }, 2579 | { name: 'Borgata', abbreviation: 'B.ta' }, 2580 | { name: 'Borgo', abbreviation: 'B.go' }, 2581 | { name: 'Calata', abbreviation: 'Cal.' }, 2582 | { name: 'Calle', abbreviation: 'Calle' }, 2583 | { name: 'Campiello', abbreviation: 'Cam.' }, 2584 | { name: 'Campo', abbreviation: 'Cam.' }, 2585 | { name: 'Canale', abbreviation: 'Can.' }, 2586 | { name: 'Carraia', abbreviation: 'Carr.' }, 2587 | { name: 'Cascina', abbreviation: 'Cascina' }, 2588 | { name: 'Case sparse', abbreviation: 'c.s.' }, 2589 | { name: 'Cavalcavia', abbreviation: 'Cv.' }, 2590 | { name: 'Circonvallazione', abbreviation: 'Cv.' }, 2591 | { name: 'Complanare', abbreviation: 'C.re' }, 2592 | { name: 'Contrada', abbreviation: 'C.da' }, 2593 | { name: 'Corso', abbreviation: 'C.so' }, 2594 | { name: 'Corte', abbreviation: 'C.te' }, 2595 | { name: 'Cortile', abbreviation: 'C.le' }, 2596 | { name: 'Diramazione', abbreviation: 'Dir.' }, 2597 | { name: 'Fondaco', abbreviation: 'F.co' }, 2598 | { name: 'Fondamenta', abbreviation: 'F.ta' }, 2599 | { name: 'Fondo', abbreviation: 'F.do' }, 2600 | { name: 'Frazione', abbreviation: 'Fr.' }, 2601 | { name: 'Isola', abbreviation: 'Is.' }, 2602 | { name: 'Largo', abbreviation: 'L.go' }, 2603 | { name: 'Litoranea', abbreviation: 'Lit.' }, 2604 | { name: 'Lungolago', abbreviation: 'L.go lago' }, 2605 | { name: 'Lungo Po', abbreviation: 'l.go Po' }, 2606 | { name: 'Molo', abbreviation: 'Molo' }, 2607 | { name: 'Mura', abbreviation: 'Mura' }, 2608 | { name: 'Passaggio privato', abbreviation: 'pass. priv.' }, 2609 | { name: 'Passeggiata', abbreviation: 'Pass.' }, 2610 | { name: 'Piazza', abbreviation: 'P.zza' }, 2611 | { name: 'Piazzale', abbreviation: 'P.le' }, 2612 | { name: 'Ponte', abbreviation: 'P.te' }, 2613 | { name: 'Portico', abbreviation: 'P.co' }, 2614 | { name: 'Rampa', abbreviation: 'Rampa' }, 2615 | { name: 'Regione', abbreviation: 'Reg.' }, 2616 | { name: 'Rione', abbreviation: 'R.ne' }, 2617 | { name: 'Rio', abbreviation: 'Rio' }, 2618 | { name: 'Ripa', abbreviation: 'Ripa' }, 2619 | { name: 'Riva', abbreviation: 'Riva' }, 2620 | { name: 'Rondò', abbreviation: 'Rondò' }, 2621 | { name: 'Rotonda', abbreviation: 'Rot.' }, 2622 | { name: 'Sagrato', abbreviation: 'Sagr.' }, 2623 | { name: 'Salita', abbreviation: 'Sal.' }, 2624 | { name: 'Scalinata', abbreviation: 'Scal.' }, 2625 | { name: 'Scalone', abbreviation: 'Scal.' }, 2626 | { name: 'Slargo', abbreviation: 'Sl.' }, 2627 | { name: 'Sottoportico', abbreviation: 'Sott.' }, 2628 | { name: 'Strada', abbreviation: 'Str.' }, 2629 | { name: 'Stradale', abbreviation: 'Str.le' }, 2630 | { name: 'Strettoia', abbreviation: 'Strett.' }, 2631 | { name: 'Traversa', abbreviation: 'Trav.' }, 2632 | { name: 'Via', abbreviation: 'V.' }, 2633 | { name: 'Viale', abbreviation: 'V.le' }, 2634 | { name: 'Vicinale', abbreviation: 'Vic.le' }, 2635 | { name: 'Vicolo', abbreviation: 'Vic.' } 2636 | ] 2637 | }, 2638 | 2639 | months: [ 2640 | {name: 'January', short_name: 'Jan', numeric: '01', days: 31}, 2641 | // Not messing with leap years... 2642 | {name: 'February', short_name: 'Feb', numeric: '02', days: 28}, 2643 | {name: 'March', short_name: 'Mar', numeric: '03', days: 31}, 2644 | {name: 'April', short_name: 'Apr', numeric: '04', days: 30}, 2645 | {name: 'May', short_name: 'May', numeric: '05', days: 31}, 2646 | {name: 'June', short_name: 'Jun', numeric: '06', days: 30}, 2647 | {name: 'July', short_name: 'Jul', numeric: '07', days: 31}, 2648 | {name: 'August', short_name: 'Aug', numeric: '08', days: 31}, 2649 | {name: 'September', short_name: 'Sep', numeric: '09', days: 30}, 2650 | {name: 'October', short_name: 'Oct', numeric: '10', days: 31}, 2651 | {name: 'November', short_name: 'Nov', numeric: '11', days: 30}, 2652 | {name: 'December', short_name: 'Dec', numeric: '12', days: 31} 2653 | ], 2654 | 2655 | // http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29 2656 | cc_types: [ 2657 | {name: "American Express", short_name: 'amex', prefix: '34', length: 15}, 2658 | {name: "Bankcard", short_name: 'bankcard', prefix: '5610', length: 16}, 2659 | {name: "China UnionPay", short_name: 'chinaunion', prefix: '62', length: 16}, 2660 | {name: "Diners Club Carte Blanche", short_name: 'dccarte', prefix: '300', length: 14}, 2661 | {name: "Diners Club enRoute", short_name: 'dcenroute', prefix: '2014', length: 15}, 2662 | {name: "Diners Club International", short_name: 'dcintl', prefix: '36', length: 14}, 2663 | {name: "Diners Club United States & Canada", short_name: 'dcusc', prefix: '54', length: 16}, 2664 | {name: "Discover Card", short_name: 'discover', prefix: '6011', length: 16}, 2665 | {name: "InstaPayment", short_name: 'instapay', prefix: '637', length: 16}, 2666 | {name: "JCB", short_name: 'jcb', prefix: '3528', length: 16}, 2667 | {name: "Laser", short_name: 'laser', prefix: '6304', length: 16}, 2668 | {name: "Maestro", short_name: 'maestro', prefix: '5018', length: 16}, 2669 | {name: "Mastercard", short_name: 'mc', prefix: '51', length: 16}, 2670 | {name: "Solo", short_name: 'solo', prefix: '6334', length: 16}, 2671 | {name: "Switch", short_name: 'switch', prefix: '4903', length: 16}, 2672 | {name: "Visa", short_name: 'visa', prefix: '4', length: 16}, 2673 | {name: "Visa Electron", short_name: 'electron', prefix: '4026', length: 16} 2674 | ], 2675 | 2676 | //return all world currency by ISO 4217 2677 | currency_types: [ 2678 | {'code' : 'AED', 'name' : 'United Arab Emirates Dirham'}, 2679 | {'code' : 'AFN', 'name' : 'Afghanistan Afghani'}, 2680 | {'code' : 'ALL', 'name' : 'Albania Lek'}, 2681 | {'code' : 'AMD', 'name' : 'Armenia Dram'}, 2682 | {'code' : 'ANG', 'name' : 'Netherlands Antilles Guilder'}, 2683 | {'code' : 'AOA', 'name' : 'Angola Kwanza'}, 2684 | {'code' : 'ARS', 'name' : 'Argentina Peso'}, 2685 | {'code' : 'AUD', 'name' : 'Australia Dollar'}, 2686 | {'code' : 'AWG', 'name' : 'Aruba Guilder'}, 2687 | {'code' : 'AZN', 'name' : 'Azerbaijan New Manat'}, 2688 | {'code' : 'BAM', 'name' : 'Bosnia and Herzegovina Convertible Marka'}, 2689 | {'code' : 'BBD', 'name' : 'Barbados Dollar'}, 2690 | {'code' : 'BDT', 'name' : 'Bangladesh Taka'}, 2691 | {'code' : 'BGN', 'name' : 'Bulgaria Lev'}, 2692 | {'code' : 'BHD', 'name' : 'Bahrain Dinar'}, 2693 | {'code' : 'BIF', 'name' : 'Burundi Franc'}, 2694 | {'code' : 'BMD', 'name' : 'Bermuda Dollar'}, 2695 | {'code' : 'BND', 'name' : 'Brunei Darussalam Dollar'}, 2696 | {'code' : 'BOB', 'name' : 'Bolivia Boliviano'}, 2697 | {'code' : 'BRL', 'name' : 'Brazil Real'}, 2698 | {'code' : 'BSD', 'name' : 'Bahamas Dollar'}, 2699 | {'code' : 'BTN', 'name' : 'Bhutan Ngultrum'}, 2700 | {'code' : 'BWP', 'name' : 'Botswana Pula'}, 2701 | {'code' : 'BYR', 'name' : 'Belarus Ruble'}, 2702 | {'code' : 'BZD', 'name' : 'Belize Dollar'}, 2703 | {'code' : 'CAD', 'name' : 'Canada Dollar'}, 2704 | {'code' : 'CDF', 'name' : 'Congo/Kinshasa Franc'}, 2705 | {'code' : 'CHF', 'name' : 'Switzerland Franc'}, 2706 | {'code' : 'CLP', 'name' : 'Chile Peso'}, 2707 | {'code' : 'CNY', 'name' : 'China Yuan Renminbi'}, 2708 | {'code' : 'COP', 'name' : 'Colombia Peso'}, 2709 | {'code' : 'CRC', 'name' : 'Costa Rica Colon'}, 2710 | {'code' : 'CUC', 'name' : 'Cuba Convertible Peso'}, 2711 | {'code' : 'CUP', 'name' : 'Cuba Peso'}, 2712 | {'code' : 'CVE', 'name' : 'Cape Verde Escudo'}, 2713 | {'code' : 'CZK', 'name' : 'Czech Republic Koruna'}, 2714 | {'code' : 'DJF', 'name' : 'Djibouti Franc'}, 2715 | {'code' : 'DKK', 'name' : 'Denmark Krone'}, 2716 | {'code' : 'DOP', 'name' : 'Dominican Republic Peso'}, 2717 | {'code' : 'DZD', 'name' : 'Algeria Dinar'}, 2718 | {'code' : 'EGP', 'name' : 'Egypt Pound'}, 2719 | {'code' : 'ERN', 'name' : 'Eritrea Nakfa'}, 2720 | {'code' : 'ETB', 'name' : 'Ethiopia Birr'}, 2721 | {'code' : 'EUR', 'name' : 'Euro Member Countries'}, 2722 | {'code' : 'FJD', 'name' : 'Fiji Dollar'}, 2723 | {'code' : 'FKP', 'name' : 'Falkland Islands (Malvinas) Pound'}, 2724 | {'code' : 'GBP', 'name' : 'United Kingdom Pound'}, 2725 | {'code' : 'GEL', 'name' : 'Georgia Lari'}, 2726 | {'code' : 'GGP', 'name' : 'Guernsey Pound'}, 2727 | {'code' : 'GHS', 'name' : 'Ghana Cedi'}, 2728 | {'code' : 'GIP', 'name' : 'Gibraltar Pound'}, 2729 | {'code' : 'GMD', 'name' : 'Gambia Dalasi'}, 2730 | {'code' : 'GNF', 'name' : 'Guinea Franc'}, 2731 | {'code' : 'GTQ', 'name' : 'Guatemala Quetzal'}, 2732 | {'code' : 'GYD', 'name' : 'Guyana Dollar'}, 2733 | {'code' : 'HKD', 'name' : 'Hong Kong Dollar'}, 2734 | {'code' : 'HNL', 'name' : 'Honduras Lempira'}, 2735 | {'code' : 'HRK', 'name' : 'Croatia Kuna'}, 2736 | {'code' : 'HTG', 'name' : 'Haiti Gourde'}, 2737 | {'code' : 'HUF', 'name' : 'Hungary Forint'}, 2738 | {'code' : 'IDR', 'name' : 'Indonesia Rupiah'}, 2739 | {'code' : 'ILS', 'name' : 'Israel Shekel'}, 2740 | {'code' : 'IMP', 'name' : 'Isle of Man Pound'}, 2741 | {'code' : 'INR', 'name' : 'India Rupee'}, 2742 | {'code' : 'IQD', 'name' : 'Iraq Dinar'}, 2743 | {'code' : 'IRR', 'name' : 'Iran Rial'}, 2744 | {'code' : 'ISK', 'name' : 'Iceland Krona'}, 2745 | {'code' : 'JEP', 'name' : 'Jersey Pound'}, 2746 | {'code' : 'JMD', 'name' : 'Jamaica Dollar'}, 2747 | {'code' : 'JOD', 'name' : 'Jordan Dinar'}, 2748 | {'code' : 'JPY', 'name' : 'Japan Yen'}, 2749 | {'code' : 'KES', 'name' : 'Kenya Shilling'}, 2750 | {'code' : 'KGS', 'name' : 'Kyrgyzstan Som'}, 2751 | {'code' : 'KHR', 'name' : 'Cambodia Riel'}, 2752 | {'code' : 'KMF', 'name' : 'Comoros Franc'}, 2753 | {'code' : 'KPW', 'name' : 'Korea (North) Won'}, 2754 | {'code' : 'KRW', 'name' : 'Korea (South) Won'}, 2755 | {'code' : 'KWD', 'name' : 'Kuwait Dinar'}, 2756 | {'code' : 'KYD', 'name' : 'Cayman Islands Dollar'}, 2757 | {'code' : 'KZT', 'name' : 'Kazakhstan Tenge'}, 2758 | {'code' : 'LAK', 'name' : 'Laos Kip'}, 2759 | {'code' : 'LBP', 'name' : 'Lebanon Pound'}, 2760 | {'code' : 'LKR', 'name' : 'Sri Lanka Rupee'}, 2761 | {'code' : 'LRD', 'name' : 'Liberia Dollar'}, 2762 | {'code' : 'LSL', 'name' : 'Lesotho Loti'}, 2763 | {'code' : 'LTL', 'name' : 'Lithuania Litas'}, 2764 | {'code' : 'LYD', 'name' : 'Libya Dinar'}, 2765 | {'code' : 'MAD', 'name' : 'Morocco Dirham'}, 2766 | {'code' : 'MDL', 'name' : 'Moldova Leu'}, 2767 | {'code' : 'MGA', 'name' : 'Madagascar Ariary'}, 2768 | {'code' : 'MKD', 'name' : 'Macedonia Denar'}, 2769 | {'code' : 'MMK', 'name' : 'Myanmar (Burma) Kyat'}, 2770 | {'code' : 'MNT', 'name' : 'Mongolia Tughrik'}, 2771 | {'code' : 'MOP', 'name' : 'Macau Pataca'}, 2772 | {'code' : 'MRO', 'name' : 'Mauritania Ouguiya'}, 2773 | {'code' : 'MUR', 'name' : 'Mauritius Rupee'}, 2774 | {'code' : 'MVR', 'name' : 'Maldives (Maldive Islands) Rufiyaa'}, 2775 | {'code' : 'MWK', 'name' : 'Malawi Kwacha'}, 2776 | {'code' : 'MXN', 'name' : 'Mexico Peso'}, 2777 | {'code' : 'MYR', 'name' : 'Malaysia Ringgit'}, 2778 | {'code' : 'MZN', 'name' : 'Mozambique Metical'}, 2779 | {'code' : 'NAD', 'name' : 'Namibia Dollar'}, 2780 | {'code' : 'NGN', 'name' : 'Nigeria Naira'}, 2781 | {'code' : 'NIO', 'name' : 'Nicaragua Cordoba'}, 2782 | {'code' : 'NOK', 'name' : 'Norway Krone'}, 2783 | {'code' : 'NPR', 'name' : 'Nepal Rupee'}, 2784 | {'code' : 'NZD', 'name' : 'New Zealand Dollar'}, 2785 | {'code' : 'OMR', 'name' : 'Oman Rial'}, 2786 | {'code' : 'PAB', 'name' : 'Panama Balboa'}, 2787 | {'code' : 'PEN', 'name' : 'Peru Nuevo Sol'}, 2788 | {'code' : 'PGK', 'name' : 'Papua New Guinea Kina'}, 2789 | {'code' : 'PHP', 'name' : 'Philippines Peso'}, 2790 | {'code' : 'PKR', 'name' : 'Pakistan Rupee'}, 2791 | {'code' : 'PLN', 'name' : 'Poland Zloty'}, 2792 | {'code' : 'PYG', 'name' : 'Paraguay Guarani'}, 2793 | {'code' : 'QAR', 'name' : 'Qatar Riyal'}, 2794 | {'code' : 'RON', 'name' : 'Romania New Leu'}, 2795 | {'code' : 'RSD', 'name' : 'Serbia Dinar'}, 2796 | {'code' : 'RUB', 'name' : 'Russia Ruble'}, 2797 | {'code' : 'RWF', 'name' : 'Rwanda Franc'}, 2798 | {'code' : 'SAR', 'name' : 'Saudi Arabia Riyal'}, 2799 | {'code' : 'SBD', 'name' : 'Solomon Islands Dollar'}, 2800 | {'code' : 'SCR', 'name' : 'Seychelles Rupee'}, 2801 | {'code' : 'SDG', 'name' : 'Sudan Pound'}, 2802 | {'code' : 'SEK', 'name' : 'Sweden Krona'}, 2803 | {'code' : 'SGD', 'name' : 'Singapore Dollar'}, 2804 | {'code' : 'SHP', 'name' : 'Saint Helena Pound'}, 2805 | {'code' : 'SLL', 'name' : 'Sierra Leone Leone'}, 2806 | {'code' : 'SOS', 'name' : 'Somalia Shilling'}, 2807 | {'code' : 'SPL', 'name' : 'Seborga Luigino'}, 2808 | {'code' : 'SRD', 'name' : 'Suriname Dollar'}, 2809 | {'code' : 'STD', 'name' : 'São Tomé and Príncipe Dobra'}, 2810 | {'code' : 'SVC', 'name' : 'El Salvador Colon'}, 2811 | {'code' : 'SYP', 'name' : 'Syria Pound'}, 2812 | {'code' : 'SZL', 'name' : 'Swaziland Lilangeni'}, 2813 | {'code' : 'THB', 'name' : 'Thailand Baht'}, 2814 | {'code' : 'TJS', 'name' : 'Tajikistan Somoni'}, 2815 | {'code' : 'TMT', 'name' : 'Turkmenistan Manat'}, 2816 | {'code' : 'TND', 'name' : 'Tunisia Dinar'}, 2817 | {'code' : 'TOP', 'name' : 'Tonga Pa\'anga'}, 2818 | {'code' : 'TRY', 'name' : 'Turkey Lira'}, 2819 | {'code' : 'TTD', 'name' : 'Trinidad and Tobago Dollar'}, 2820 | {'code' : 'TVD', 'name' : 'Tuvalu Dollar'}, 2821 | {'code' : 'TWD', 'name' : 'Taiwan New Dollar'}, 2822 | {'code' : 'TZS', 'name' : 'Tanzania Shilling'}, 2823 | {'code' : 'UAH', 'name' : 'Ukraine Hryvnia'}, 2824 | {'code' : 'UGX', 'name' : 'Uganda Shilling'}, 2825 | {'code' : 'USD', 'name' : 'United States Dollar'}, 2826 | {'code' : 'UYU', 'name' : 'Uruguay Peso'}, 2827 | {'code' : 'UZS', 'name' : 'Uzbekistan Som'}, 2828 | {'code' : 'VEF', 'name' : 'Venezuela Bolivar'}, 2829 | {'code' : 'VND', 'name' : 'Viet Nam Dong'}, 2830 | {'code' : 'VUV', 'name' : 'Vanuatu Vatu'}, 2831 | {'code' : 'WST', 'name' : 'Samoa Tala'}, 2832 | {'code' : 'XAF', 'name' : 'Communauté Financière Africaine (BEAC) CFA Franc BEAC'}, 2833 | {'code' : 'XCD', 'name' : 'East Caribbean Dollar'}, 2834 | {'code' : 'XDR', 'name' : 'International Monetary Fund (IMF) Special Drawing Rights'}, 2835 | {'code' : 'XOF', 'name' : 'Communauté Financière Africaine (BCEAO) Franc'}, 2836 | {'code' : 'XPF', 'name' : 'Comptoirs Français du Pacifique (CFP) Franc'}, 2837 | {'code' : 'YER', 'name' : 'Yemen Rial'}, 2838 | {'code' : 'ZAR', 'name' : 'South Africa Rand'}, 2839 | {'code' : 'ZMW', 'name' : 'Zambia Kwacha'}, 2840 | {'code' : 'ZWD', 'name' : 'Zimbabwe Dollar'} 2841 | ], 2842 | 2843 | // return the names of all valide colors 2844 | colorNames : [ "AliceBlue", "Black", "Navy", "DarkBlue", "MediumBlue", "Blue", "DarkGreen", "Green", "Teal", "DarkCyan", "DeepSkyBlue", "DarkTurquoise", "MediumSpringGreen", "Lime", "SpringGreen", 2845 | "Aqua", "Cyan", "MidnightBlue", "DodgerBlue", "LightSeaGreen", "ForestGreen", "SeaGreen", "DarkSlateGray", "LimeGreen", "MediumSeaGreen", "Turquoise", "RoyalBlue", "SteelBlue", "DarkSlateBlue", "MediumTurquoise", 2846 | "Indigo", "DarkOliveGreen", "CadetBlue", "CornflowerBlue", "RebeccaPurple", "MediumAquaMarine", "DimGray", "SlateBlue", "OliveDrab", "SlateGray", "LightSlateGray", "MediumSlateBlue", "LawnGreen", "Chartreuse", 2847 | "Aquamarine", "Maroon", "Purple", "Olive", "Gray", "SkyBlue", "LightSkyBlue", "BlueViolet", "DarkRed", "DarkMagenta", "SaddleBrown", "Ivory", "White", 2848 | "DarkSeaGreen", "LightGreen", "MediumPurple", "DarkViolet", "PaleGreen", "DarkOrchid", "YellowGreen", "Sienna", "Brown", "DarkGray", "LightBlue", "GreenYellow", "PaleTurquoise", "LightSteelBlue", "PowderBlue", 2849 | "FireBrick", "DarkGoldenRod", "MediumOrchid", "RosyBrown", "DarkKhaki", "Silver", "MediumVioletRed", "IndianRed", "Peru", "Chocolate", "Tan", "LightGray", "Thistle", "Orchid", "GoldenRod", "PaleVioletRed", 2850 | "Crimson", "Gainsboro", "Plum", "BurlyWood", "LightCyan", "Lavender", "DarkSalmon", "Violet", "PaleGoldenRod", "LightCoral", "Khaki", "AliceBlue", "HoneyDew", "Azure", "SandyBrown", "Wheat", "Beige", "WhiteSmoke", 2851 | "MintCream", "GhostWhite", "Salmon", "AntiqueWhite", "Linen", "LightGoldenRodYellow", "OldLace", "Red", "Fuchsia", "Magenta", "DeepPink", "OrangeRed", "Tomato", "HotPink", "Coral", "DarkOrange", "LightSalmon", "Orange", 2852 | "LightPink", "Pink", "Gold", "PeachPuff", "NavajoWhite", "Moccasin", "Bisque", "MistyRose", "BlanchedAlmond", "PapayaWhip", "LavenderBlush", "SeaShell", "Cornsilk", "LemonChiffon", "FloralWhite", "Snow", "Yellow", "LightYellow" 2853 | ], 2854 | 2855 | fileExtension : { 2856 | "raster" : ["bmp", "gif", "gpl", "ico", "jpeg", "psd", "png", "psp", "raw", "tiff"], 2857 | "vector" : ["3dv", "amf", "awg", "ai", "cgm", "cdr", "cmx", "dxf", "e2d", "egt", "eps", "fs", "odg", "svg", "xar"], 2858 | "3d" : ["3dmf", "3dm", "3mf", "3ds", "an8", "aoi", "blend", "cal3d", "cob", "ctm", "iob", "jas", "max", "mb", "mdx", "obj", "x", "x3d"], 2859 | "document" : ["doc", "docx", "dot", "html", "xml", "odt", "odm", "ott", "csv", "rtf", "tex", "xhtml", "xps"] 2860 | } 2861 | }; 2862 | 2863 | var o_hasOwnProperty = Object.prototype.hasOwnProperty; 2864 | var o_keys = (Object.keys || function(obj) { 2865 | var result = []; 2866 | for (var key in obj) { 2867 | if (o_hasOwnProperty.call(obj, key)) { 2868 | result.push(key); 2869 | } 2870 | } 2871 | 2872 | return result; 2873 | }); 2874 | 2875 | function _copyObject(source, target) { 2876 | var keys = o_keys(source); 2877 | var key; 2878 | 2879 | for (var i = 0, l = keys.length; i < l; i++) { 2880 | key = keys[i]; 2881 | target[key] = source[key] || target[key]; 2882 | } 2883 | } 2884 | 2885 | function _copyArray(source, target) { 2886 | for (var i = 0, l = source.length; i < l; i++) { 2887 | target[i] = source[i]; 2888 | } 2889 | } 2890 | 2891 | function copyObject(source, _target) { 2892 | var isArray = Array.isArray(source); 2893 | var target = _target || (isArray ? new Array(source.length) : {}); 2894 | 2895 | if (isArray) { 2896 | _copyArray(source, target); 2897 | } else { 2898 | _copyObject(source, target); 2899 | } 2900 | 2901 | return target; 2902 | } 2903 | 2904 | /** Get the data based on key**/ 2905 | Chance.prototype.get = function (name) { 2906 | return copyObject(data[name]); 2907 | }; 2908 | 2909 | // Mac Address 2910 | Chance.prototype.mac_address = function(options){ 2911 | // typically mac addresses are separated by ":" 2912 | // however they can also be separated by "-" 2913 | // the network variant uses a dot every fourth byte 2914 | 2915 | options = initOptions(options); 2916 | if(!options.separator) { 2917 | options.separator = options.networkVersion ? "." : ":"; 2918 | } 2919 | 2920 | var mac_pool="ABCDEF1234567890", 2921 | mac = ""; 2922 | if(!options.networkVersion) { 2923 | mac = this.n(this.string, 6, { pool: mac_pool, length:2 }).join(options.separator); 2924 | } else { 2925 | mac = this.n(this.string, 3, { pool: mac_pool, length:4 }).join(options.separator); 2926 | } 2927 | 2928 | return mac; 2929 | }; 2930 | 2931 | Chance.prototype.normal = function (options) { 2932 | options = initOptions(options, {mean : 0, dev : 1, pool : []}); 2933 | 2934 | testRange( 2935 | options.pool.constructor !== Array, 2936 | "Chance: The pool option must be a valid array." 2937 | ); 2938 | 2939 | // If a pool has been passed, then we are returning an item from that pool, 2940 | // using the normal distribution settings that were passed in 2941 | if (options.pool.length > 0) { 2942 | return this.normal_pool(options); 2943 | } 2944 | 2945 | // The Marsaglia Polar method 2946 | var s, u, v, norm, 2947 | mean = options.mean, 2948 | dev = options.dev; 2949 | 2950 | do { 2951 | // U and V are from the uniform distribution on (-1, 1) 2952 | u = this.random() * 2 - 1; 2953 | v = this.random() * 2 - 1; 2954 | 2955 | s = u * u + v * v; 2956 | } while (s >= 1); 2957 | 2958 | // Compute the standard normal variate 2959 | norm = u * Math.sqrt(-2 * Math.log(s) / s); 2960 | 2961 | // Shape and scale 2962 | return dev * norm + mean; 2963 | }; 2964 | 2965 | Chance.prototype.normal_pool = function(options) { 2966 | var performanceCounter = 0; 2967 | do { 2968 | var idx = Math.round(this.normal({ mean: options.mean, dev: options.dev })); 2969 | if (idx < options.pool.length && idx >= 0) { 2970 | return options.pool[idx]; 2971 | } else { 2972 | performanceCounter++; 2973 | } 2974 | } while(performanceCounter < 100); 2975 | 2976 | throw new RangeError("Chance: Your pool is too small for the given mean and standard deviation. Please adjust."); 2977 | }; 2978 | 2979 | Chance.prototype.radio = function (options) { 2980 | // Initial Letter (Typically Designated by Side of Mississippi River) 2981 | options = initOptions(options, {side : "?"}); 2982 | var fl = ""; 2983 | switch (options.side.toLowerCase()) { 2984 | case "east": 2985 | case "e": 2986 | fl = "W"; 2987 | break; 2988 | case "west": 2989 | case "w": 2990 | fl = "K"; 2991 | break; 2992 | default: 2993 | fl = this.character({pool: "KW"}); 2994 | break; 2995 | } 2996 | 2997 | return fl + this.character({alpha: true, casing: "upper"}) + 2998 | this.character({alpha: true, casing: "upper"}) + 2999 | this.character({alpha: true, casing: "upper"}); 3000 | }; 3001 | 3002 | // Set the data as key and data or the data map 3003 | Chance.prototype.set = function (name, values) { 3004 | if (typeof name === "string") { 3005 | data[name] = values; 3006 | } else { 3007 | data = copyObject(name, data); 3008 | } 3009 | }; 3010 | 3011 | Chance.prototype.tv = function (options) { 3012 | return this.radio(options); 3013 | }; 3014 | 3015 | // ID number for Brazil companies 3016 | Chance.prototype.cnpj = function () { 3017 | var n = this.n(this.natural, 8, { max: 9 }); 3018 | var d1 = 2+n[7]*6+n[6]*7+n[5]*8+n[4]*9+n[3]*2+n[2]*3+n[1]*4+n[0]*5; 3019 | d1 = 11 - (d1 % 11); 3020 | if (d1>=10){ 3021 | d1 = 0; 3022 | } 3023 | var d2 = d1*2+3+n[7]*7+n[6]*8+n[5]*9+n[4]*2+n[3]*3+n[2]*4+n[1]*5+n[0]*6; 3024 | d2 = 11 - (d2 % 11); 3025 | if (d2>=10){ 3026 | d2 = 0; 3027 | } 3028 | return ''+n[0]+n[1]+'.'+n[2]+n[3]+n[4]+'.'+n[5]+n[6]+n[7]+'/0001-'+d1+d2; 3029 | }; 3030 | 3031 | // -- End Miscellaneous -- 3032 | 3033 | Chance.prototype.mersenne_twister = function (seed) { 3034 | return new MersenneTwister(seed); 3035 | }; 3036 | 3037 | Chance.prototype.blueimp_md5 = function () { 3038 | return new BlueImpMD5(); 3039 | }; 3040 | 3041 | // Mersenne Twister from https://gist.github.com/banksean/300494 3042 | var MersenneTwister = function (seed) { 3043 | if (seed === undefined) { 3044 | // kept random number same size as time used previously to ensure no unexpected results downstream 3045 | seed = Math.floor(Math.random()*Math.pow(10,13)); 3046 | } 3047 | /* Period parameters */ 3048 | this.N = 624; 3049 | this.M = 397; 3050 | this.MATRIX_A = 0x9908b0df; /* constant vector a */ 3051 | this.UPPER_MASK = 0x80000000; /* most significant w-r bits */ 3052 | this.LOWER_MASK = 0x7fffffff; /* least significant r bits */ 3053 | 3054 | this.mt = new Array(this.N); /* the array for the state vector */ 3055 | this.mti = this.N + 1; /* mti==N + 1 means mt[N] is not initialized */ 3056 | 3057 | this.init_genrand(seed); 3058 | }; 3059 | 3060 | /* initializes mt[N] with a seed */ 3061 | MersenneTwister.prototype.init_genrand = function (s) { 3062 | this.mt[0] = s >>> 0; 3063 | for (this.mti = 1; this.mti < this.N; this.mti++) { 3064 | s = this.mt[this.mti - 1] ^ (this.mt[this.mti - 1] >>> 30); 3065 | this.mt[this.mti] = (((((s & 0xffff0000) >>> 16) * 1812433253) << 16) + (s & 0x0000ffff) * 1812433253) + this.mti; 3066 | /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ 3067 | /* In the previous versions, MSBs of the seed affect */ 3068 | /* only MSBs of the array mt[]. */ 3069 | /* 2002/01/09 modified by Makoto Matsumoto */ 3070 | this.mt[this.mti] >>>= 0; 3071 | /* for >32 bit machines */ 3072 | } 3073 | }; 3074 | 3075 | /* initialize by an array with array-length */ 3076 | /* init_key is the array for initializing keys */ 3077 | /* key_length is its length */ 3078 | /* slight change for C++, 2004/2/26 */ 3079 | MersenneTwister.prototype.init_by_array = function (init_key, key_length) { 3080 | var i = 1, j = 0, k, s; 3081 | this.init_genrand(19650218); 3082 | k = (this.N > key_length ? this.N : key_length); 3083 | for (; k; k--) { 3084 | s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30); 3085 | this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1664525) << 16) + ((s & 0x0000ffff) * 1664525))) + init_key[j] + j; /* non linear */ 3086 | this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */ 3087 | i++; 3088 | j++; 3089 | if (i >= this.N) { this.mt[0] = this.mt[this.N - 1]; i = 1; } 3090 | if (j >= key_length) { j = 0; } 3091 | } 3092 | for (k = this.N - 1; k; k--) { 3093 | s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30); 3094 | this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1566083941) << 16) + (s & 0x0000ffff) * 1566083941)) - i; /* non linear */ 3095 | this.mt[i] >>>= 0; /* for WORDSIZE > 32 machines */ 3096 | i++; 3097 | if (i >= this.N) { this.mt[0] = this.mt[this.N - 1]; i = 1; } 3098 | } 3099 | 3100 | this.mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */ 3101 | }; 3102 | 3103 | /* generates a random number on [0,0xffffffff]-interval */ 3104 | MersenneTwister.prototype.genrand_int32 = function () { 3105 | var y; 3106 | var mag01 = new Array(0x0, this.MATRIX_A); 3107 | /* mag01[x] = x * MATRIX_A for x=0,1 */ 3108 | 3109 | if (this.mti >= this.N) { /* generate N words at one time */ 3110 | var kk; 3111 | 3112 | if (this.mti === this.N + 1) { /* if init_genrand() has not been called, */ 3113 | this.init_genrand(5489); /* a default initial seed is used */ 3114 | } 3115 | for (kk = 0; kk < this.N - this.M; kk++) { 3116 | y = (this.mt[kk]&this.UPPER_MASK)|(this.mt[kk + 1]&this.LOWER_MASK); 3117 | this.mt[kk] = this.mt[kk + this.M] ^ (y >>> 1) ^ mag01[y & 0x1]; 3118 | } 3119 | for (;kk < this.N - 1; kk++) { 3120 | y = (this.mt[kk]&this.UPPER_MASK)|(this.mt[kk + 1]&this.LOWER_MASK); 3121 | this.mt[kk] = this.mt[kk + (this.M - this.N)] ^ (y >>> 1) ^ mag01[y & 0x1]; 3122 | } 3123 | y = (this.mt[this.N - 1]&this.UPPER_MASK)|(this.mt[0]&this.LOWER_MASK); 3124 | this.mt[this.N - 1] = this.mt[this.M - 1] ^ (y >>> 1) ^ mag01[y & 0x1]; 3125 | 3126 | this.mti = 0; 3127 | } 3128 | 3129 | y = this.mt[this.mti++]; 3130 | 3131 | /* Tempering */ 3132 | y ^= (y >>> 11); 3133 | y ^= (y << 7) & 0x9d2c5680; 3134 | y ^= (y << 15) & 0xefc60000; 3135 | y ^= (y >>> 18); 3136 | 3137 | return y >>> 0; 3138 | }; 3139 | 3140 | /* generates a random number on [0,0x7fffffff]-interval */ 3141 | MersenneTwister.prototype.genrand_int31 = function () { 3142 | return (this.genrand_int32() >>> 1); 3143 | }; 3144 | 3145 | /* generates a random number on [0,1]-real-interval */ 3146 | MersenneTwister.prototype.genrand_real1 = function () { 3147 | return this.genrand_int32() * (1.0 / 4294967295.0); 3148 | /* divided by 2^32-1 */ 3149 | }; 3150 | 3151 | /* generates a random number on [0,1)-real-interval */ 3152 | MersenneTwister.prototype.random = function () { 3153 | return this.genrand_int32() * (1.0 / 4294967296.0); 3154 | /* divided by 2^32 */ 3155 | }; 3156 | 3157 | /* generates a random number on (0,1)-real-interval */ 3158 | MersenneTwister.prototype.genrand_real3 = function () { 3159 | return (this.genrand_int32() + 0.5) * (1.0 / 4294967296.0); 3160 | /* divided by 2^32 */ 3161 | }; 3162 | 3163 | /* generates a random number on [0,1) with 53-bit resolution*/ 3164 | MersenneTwister.prototype.genrand_res53 = function () { 3165 | var a = this.genrand_int32()>>>5, b = this.genrand_int32()>>>6; 3166 | return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0); 3167 | }; 3168 | 3169 | // BlueImp MD5 hashing algorithm from https://github.com/blueimp/JavaScript-MD5 3170 | var BlueImpMD5 = function () {}; 3171 | 3172 | BlueImpMD5.prototype.VERSION = '1.0.1'; 3173 | 3174 | /* 3175 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally 3176 | * to work around bugs in some JS interpreters. 3177 | */ 3178 | BlueImpMD5.prototype.safe_add = function safe_add(x, y) { 3179 | var lsw = (x & 0xFFFF) + (y & 0xFFFF), 3180 | msw = (x >> 16) + (y >> 16) + (lsw >> 16); 3181 | return (msw << 16) | (lsw & 0xFFFF); 3182 | }; 3183 | 3184 | /* 3185 | * Bitwise rotate a 32-bit number to the left. 3186 | */ 3187 | BlueImpMD5.prototype.bit_roll = function (num, cnt) { 3188 | return (num << cnt) | (num >>> (32 - cnt)); 3189 | }; 3190 | 3191 | /* 3192 | * These functions implement the five basic operations the algorithm uses. 3193 | */ 3194 | BlueImpMD5.prototype.md5_cmn = function (q, a, b, x, s, t) { 3195 | return this.safe_add(this.bit_roll(this.safe_add(this.safe_add(a, q), this.safe_add(x, t)), s), b); 3196 | }; 3197 | BlueImpMD5.prototype.md5_ff = function (a, b, c, d, x, s, t) { 3198 | return this.md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); 3199 | }; 3200 | BlueImpMD5.prototype.md5_gg = function (a, b, c, d, x, s, t) { 3201 | return this.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); 3202 | }; 3203 | BlueImpMD5.prototype.md5_hh = function (a, b, c, d, x, s, t) { 3204 | return this.md5_cmn(b ^ c ^ d, a, b, x, s, t); 3205 | }; 3206 | BlueImpMD5.prototype.md5_ii = function (a, b, c, d, x, s, t) { 3207 | return this.md5_cmn(c ^ (b | (~d)), a, b, x, s, t); 3208 | }; 3209 | 3210 | /* 3211 | * Calculate the MD5 of an array of little-endian words, and a bit length. 3212 | */ 3213 | BlueImpMD5.prototype.binl_md5 = function (x, len) { 3214 | /* append padding */ 3215 | x[len >> 5] |= 0x80 << (len % 32); 3216 | x[(((len + 64) >>> 9) << 4) + 14] = len; 3217 | 3218 | var i, olda, oldb, oldc, oldd, 3219 | a = 1732584193, 3220 | b = -271733879, 3221 | c = -1732584194, 3222 | d = 271733878; 3223 | 3224 | for (i = 0; i < x.length; i += 16) { 3225 | olda = a; 3226 | oldb = b; 3227 | oldc = c; 3228 | oldd = d; 3229 | 3230 | a = this.md5_ff(a, b, c, d, x[i], 7, -680876936); 3231 | d = this.md5_ff(d, a, b, c, x[i + 1], 12, -389564586); 3232 | c = this.md5_ff(c, d, a, b, x[i + 2], 17, 606105819); 3233 | b = this.md5_ff(b, c, d, a, x[i + 3], 22, -1044525330); 3234 | a = this.md5_ff(a, b, c, d, x[i + 4], 7, -176418897); 3235 | d = this.md5_ff(d, a, b, c, x[i + 5], 12, 1200080426); 3236 | c = this.md5_ff(c, d, a, b, x[i + 6], 17, -1473231341); 3237 | b = this.md5_ff(b, c, d, a, x[i + 7], 22, -45705983); 3238 | a = this.md5_ff(a, b, c, d, x[i + 8], 7, 1770035416); 3239 | d = this.md5_ff(d, a, b, c, x[i + 9], 12, -1958414417); 3240 | c = this.md5_ff(c, d, a, b, x[i + 10], 17, -42063); 3241 | b = this.md5_ff(b, c, d, a, x[i + 11], 22, -1990404162); 3242 | a = this.md5_ff(a, b, c, d, x[i + 12], 7, 1804603682); 3243 | d = this.md5_ff(d, a, b, c, x[i + 13], 12, -40341101); 3244 | c = this.md5_ff(c, d, a, b, x[i + 14], 17, -1502002290); 3245 | b = this.md5_ff(b, c, d, a, x[i + 15], 22, 1236535329); 3246 | 3247 | a = this.md5_gg(a, b, c, d, x[i + 1], 5, -165796510); 3248 | d = this.md5_gg(d, a, b, c, x[i + 6], 9, -1069501632); 3249 | c = this.md5_gg(c, d, a, b, x[i + 11], 14, 643717713); 3250 | b = this.md5_gg(b, c, d, a, x[i], 20, -373897302); 3251 | a = this.md5_gg(a, b, c, d, x[i + 5], 5, -701558691); 3252 | d = this.md5_gg(d, a, b, c, x[i + 10], 9, 38016083); 3253 | c = this.md5_gg(c, d, a, b, x[i + 15], 14, -660478335); 3254 | b = this.md5_gg(b, c, d, a, x[i + 4], 20, -405537848); 3255 | a = this.md5_gg(a, b, c, d, x[i + 9], 5, 568446438); 3256 | d = this.md5_gg(d, a, b, c, x[i + 14], 9, -1019803690); 3257 | c = this.md5_gg(c, d, a, b, x[i + 3], 14, -187363961); 3258 | b = this.md5_gg(b, c, d, a, x[i + 8], 20, 1163531501); 3259 | a = this.md5_gg(a, b, c, d, x[i + 13], 5, -1444681467); 3260 | d = this.md5_gg(d, a, b, c, x[i + 2], 9, -51403784); 3261 | c = this.md5_gg(c, d, a, b, x[i + 7], 14, 1735328473); 3262 | b = this.md5_gg(b, c, d, a, x[i + 12], 20, -1926607734); 3263 | 3264 | a = this.md5_hh(a, b, c, d, x[i + 5], 4, -378558); 3265 | d = this.md5_hh(d, a, b, c, x[i + 8], 11, -2022574463); 3266 | c = this.md5_hh(c, d, a, b, x[i + 11], 16, 1839030562); 3267 | b = this.md5_hh(b, c, d, a, x[i + 14], 23, -35309556); 3268 | a = this.md5_hh(a, b, c, d, x[i + 1], 4, -1530992060); 3269 | d = this.md5_hh(d, a, b, c, x[i + 4], 11, 1272893353); 3270 | c = this.md5_hh(c, d, a, b, x[i + 7], 16, -155497632); 3271 | b = this.md5_hh(b, c, d, a, x[i + 10], 23, -1094730640); 3272 | a = this.md5_hh(a, b, c, d, x[i + 13], 4, 681279174); 3273 | d = this.md5_hh(d, a, b, c, x[i], 11, -358537222); 3274 | c = this.md5_hh(c, d, a, b, x[i + 3], 16, -722521979); 3275 | b = this.md5_hh(b, c, d, a, x[i + 6], 23, 76029189); 3276 | a = this.md5_hh(a, b, c, d, x[i + 9], 4, -640364487); 3277 | d = this.md5_hh(d, a, b, c, x[i + 12], 11, -421815835); 3278 | c = this.md5_hh(c, d, a, b, x[i + 15], 16, 530742520); 3279 | b = this.md5_hh(b, c, d, a, x[i + 2], 23, -995338651); 3280 | 3281 | a = this.md5_ii(a, b, c, d, x[i], 6, -198630844); 3282 | d = this.md5_ii(d, a, b, c, x[i + 7], 10, 1126891415); 3283 | c = this.md5_ii(c, d, a, b, x[i + 14], 15, -1416354905); 3284 | b = this.md5_ii(b, c, d, a, x[i + 5], 21, -57434055); 3285 | a = this.md5_ii(a, b, c, d, x[i + 12], 6, 1700485571); 3286 | d = this.md5_ii(d, a, b, c, x[i + 3], 10, -1894986606); 3287 | c = this.md5_ii(c, d, a, b, x[i + 10], 15, -1051523); 3288 | b = this.md5_ii(b, c, d, a, x[i + 1], 21, -2054922799); 3289 | a = this.md5_ii(a, b, c, d, x[i + 8], 6, 1873313359); 3290 | d = this.md5_ii(d, a, b, c, x[i + 15], 10, -30611744); 3291 | c = this.md5_ii(c, d, a, b, x[i + 6], 15, -1560198380); 3292 | b = this.md5_ii(b, c, d, a, x[i + 13], 21, 1309151649); 3293 | a = this.md5_ii(a, b, c, d, x[i + 4], 6, -145523070); 3294 | d = this.md5_ii(d, a, b, c, x[i + 11], 10, -1120210379); 3295 | c = this.md5_ii(c, d, a, b, x[i + 2], 15, 718787259); 3296 | b = this.md5_ii(b, c, d, a, x[i + 9], 21, -343485551); 3297 | 3298 | a = this.safe_add(a, olda); 3299 | b = this.safe_add(b, oldb); 3300 | c = this.safe_add(c, oldc); 3301 | d = this.safe_add(d, oldd); 3302 | } 3303 | return [a, b, c, d]; 3304 | }; 3305 | 3306 | /* 3307 | * Convert an array of little-endian words to a string 3308 | */ 3309 | BlueImpMD5.prototype.binl2rstr = function (input) { 3310 | var i, 3311 | output = ''; 3312 | for (i = 0; i < input.length * 32; i += 8) { 3313 | output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF); 3314 | } 3315 | return output; 3316 | }; 3317 | 3318 | /* 3319 | * Convert a raw string to an array of little-endian words 3320 | * Characters >255 have their high-byte silently ignored. 3321 | */ 3322 | BlueImpMD5.prototype.rstr2binl = function (input) { 3323 | var i, 3324 | output = []; 3325 | output[(input.length >> 2) - 1] = undefined; 3326 | for (i = 0; i < output.length; i += 1) { 3327 | output[i] = 0; 3328 | } 3329 | for (i = 0; i < input.length * 8; i += 8) { 3330 | output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32); 3331 | } 3332 | return output; 3333 | }; 3334 | 3335 | /* 3336 | * Calculate the MD5 of a raw string 3337 | */ 3338 | BlueImpMD5.prototype.rstr_md5 = function (s) { 3339 | return this.binl2rstr(this.binl_md5(this.rstr2binl(s), s.length * 8)); 3340 | }; 3341 | 3342 | /* 3343 | * Calculate the HMAC-MD5, of a key and some data (raw strings) 3344 | */ 3345 | BlueImpMD5.prototype.rstr_hmac_md5 = function (key, data) { 3346 | var i, 3347 | bkey = this.rstr2binl(key), 3348 | ipad = [], 3349 | opad = [], 3350 | hash; 3351 | ipad[15] = opad[15] = undefined; 3352 | if (bkey.length > 16) { 3353 | bkey = this.binl_md5(bkey, key.length * 8); 3354 | } 3355 | for (i = 0; i < 16; i += 1) { 3356 | ipad[i] = bkey[i] ^ 0x36363636; 3357 | opad[i] = bkey[i] ^ 0x5C5C5C5C; 3358 | } 3359 | hash = this.binl_md5(ipad.concat(this.rstr2binl(data)), 512 + data.length * 8); 3360 | return this.binl2rstr(this.binl_md5(opad.concat(hash), 512 + 128)); 3361 | }; 3362 | 3363 | /* 3364 | * Convert a raw string to a hex string 3365 | */ 3366 | BlueImpMD5.prototype.rstr2hex = function (input) { 3367 | var hex_tab = '0123456789abcdef', 3368 | output = '', 3369 | x, 3370 | i; 3371 | for (i = 0; i < input.length; i += 1) { 3372 | x = input.charCodeAt(i); 3373 | output += hex_tab.charAt((x >>> 4) & 0x0F) + 3374 | hex_tab.charAt(x & 0x0F); 3375 | } 3376 | return output; 3377 | }; 3378 | 3379 | /* 3380 | * Encode a string as utf-8 3381 | */ 3382 | BlueImpMD5.prototype.str2rstr_utf8 = function (input) { 3383 | return unescape(encodeURIComponent(input)); 3384 | }; 3385 | 3386 | /* 3387 | * Take string arguments and return either raw or hex encoded strings 3388 | */ 3389 | BlueImpMD5.prototype.raw_md5 = function (s) { 3390 | return this.rstr_md5(this.str2rstr_utf8(s)); 3391 | }; 3392 | BlueImpMD5.prototype.hex_md5 = function (s) { 3393 | return this.rstr2hex(this.raw_md5(s)); 3394 | }; 3395 | BlueImpMD5.prototype.raw_hmac_md5 = function (k, d) { 3396 | return this.rstr_hmac_md5(this.str2rstr_utf8(k), this.str2rstr_utf8(d)); 3397 | }; 3398 | BlueImpMD5.prototype.hex_hmac_md5 = function (k, d) { 3399 | return this.rstr2hex(this.raw_hmac_md5(k, d)); 3400 | }; 3401 | 3402 | BlueImpMD5.prototype.md5 = function (string, key, raw) { 3403 | if (!key) { 3404 | if (!raw) { 3405 | return this.hex_md5(string); 3406 | } 3407 | 3408 | return this.raw_md5(string); 3409 | } 3410 | 3411 | if (!raw) { 3412 | return this.hex_hmac_md5(key, string); 3413 | } 3414 | 3415 | return this.raw_hmac_md5(key, string); 3416 | }; 3417 | 3418 | 3419 | // PawExtensions 3420 | (function() { 3421 | var ChanceDynamicValue; 3422 | 3423 | ChanceDynamicValue = function() { 3424 | this.evaluate = function() { 3425 | if (this.chanceType) { 3426 | var chance = new Chance(); 3427 | var type = this.chanceType; 3428 | var value = null; 3429 | 3430 | // compute value 3431 | if (this.chanceArgs) { 3432 | eval('var args =[' + this.chanceArgs + ']'); 3433 | value = chance[type].apply(chance, args); 3434 | } else { 3435 | value = chance[type](); 3436 | } 3437 | 3438 | // serialize value if needed 3439 | if (typeof value === 'object') { 3440 | return JSON.stringify(value); 3441 | } 3442 | else { 3443 | return value.toString(); 3444 | } 3445 | } 3446 | return "Try something like `sentence` in Type"; 3447 | }; 3448 | this.title = function() { 3449 | return "Chance Dynamic Value"; 3450 | }; 3451 | }; 3452 | 3453 | ChanceDynamicValue.identifier = "com.atan.PawExtensions.ChanceDynamicValue"; 3454 | 3455 | ChanceDynamicValue.title = "Chance Dynamic Value"; 3456 | 3457 | ChanceDynamicValue.inputs = [ 3458 | DynamicValueInput("chanceType", "Type", "String"), 3459 | DynamicValueInput("chanceArgs", "Args", "String"), 3460 | ]; 3461 | 3462 | registerDynamicValueClass(ChanceDynamicValue); 3463 | 3464 | }).call(this); 3465 | --------------------------------------------------------------------------------