Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,18 @@ casual.card_data // { type: 'MasterCard', number: '5307558778577046',

// Misc

casual.country_code // 'ES'
casual.language_code // 'ru'
casual.locale // 'hi_IN'
casual.currency // { symbol: 'R', name: 'South African Rand', symbol_native: 'R', decimal_digits: 2, rounding: 0, code: 'ZAR', name_plural: 'South African rand' }
casual.currency_code // 'TRY'
casual.currency_symbol // 'TL'
casual.currency_name // Turkish Lira
casual.mime_type // 'audio/mpeg'
casual.file_extension // 'rtf'
casual.boolean // true
casual.uuid // '2f4dc6ba-bd25-4e66-b369-43a13e0cf150'
casual.country_code // 'ES'
casual.language_code // 'ru'
casual.locale // 'hi_IN'
casual.currency // { symbol: 'R', name: 'South African Rand', symbol_native: 'R', decimal_digits: 2, rounding: 0, code: 'ZAR', name_plural: 'South African rand' }
casual.currency_code // 'TRY'
casual.currency_symbol // 'TL'
casual.currency_name // Turkish Lira
casual.mime_type // 'audio/mpeg'
casual.file_extension // 'rtf'
casual.boolean // true
casual.uuid // '2f4dc6ba-bd25-4e66-b369-43a13e0cf150'
casual.MongoObjectIdStr // '2a5d1ce1bab2530a76cd936ce'

// Colors

Expand Down
8 changes: 6 additions & 2 deletions src/providers/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,7 @@ var provider = {
'video/x-msvideo': 'avi',
'video/x-sgi-movie': 'movie'
},

animals: [
"alligator",
"alpaca",
Expand Down Expand Up @@ -1641,7 +1641,11 @@ var provider = {
return a ? (a ^ number.random() * 16 >> a / 4).toString(16) : ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, b);
}))();
},


MongoObjectIdStr: function () {
return Array.from({length: 24}).map(() => Math.floor(number.random() * 16).toString(16)).join('')
},

animal: function () {
return this.random_element(this.animals);
}
Expand Down
3 changes: 2 additions & 1 deletion test/casual.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ describe('API', function() {
'mime_type',
'file_extension',
'boolean',
'uuid'
'uuid',
'MongoObjectIdStr'
];

var color = [
Expand Down