{"id":15664097,"url":"https://github.com/schniz/bs-faker","last_synced_at":"2026-01-08T14:06:19.126Z","repository":{"id":32611058,"uuid":"137761765","full_name":"Schniz/bs-faker","owner":"Schniz","description":"Faker.js bindings for BuckleScript in Reason","archived":false,"fork":false,"pushed_at":"2023-01-04T01:23:36.000Z","size":427,"stargazers_count":17,"open_issues_count":16,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-10T15:44:41.217Z","etag":null,"topics":["bucklescript","fake","testing"],"latest_commit_sha":null,"homepage":null,"language":"Reason","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Schniz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-18T14:24:53.000Z","updated_at":"2023-08-24T15:02:44.000Z","dependencies_parsed_at":"2023-01-14T21:43:41.142Z","dependency_job_id":null,"html_url":"https://github.com/Schniz/bs-faker","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Schniz%2Fbs-faker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Schniz%2Fbs-faker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Schniz%2Fbs-faker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Schniz%2Fbs-faker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Schniz","download_url":"https://codeload.github.com/Schniz/bs-faker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246273554,"owners_count":20750906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bucklescript","fake","testing"],"created_at":"2024-10-03T13:41:11.596Z","updated_at":"2026-01-08T14:06:14.087Z","avatar_url":"https://github.com/Schniz.png","language":"Reason","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bs-faker [![Build Status](https://travis-ci.org/Schniz/bs-faker.svg?branch=master)](https://travis-ci.org/Schniz/bs-faker) ![BuckleScript binding coverage](https://img.shields.io/badge/binding%20coverage-135%2F148-yellowgreen.svg)\n\n\u003e [Faker.js](https://github.com/marak/Faker.js/) bindings for [BuckleScript](https://github.com/bloomberg/bucklescript) in [Reason](https://github.com/facebook/reason)\n\n# Install\n\n```\nnpm install --save bs-faker\n```\n\nThen add `bs-faker` as a dependency to `bsconfig.json`:\n\n```diff\n  ...\n  \"bs-dependencies\": [\n    // add your dependencies here. You'd usually install them normally through `npm install my-dependency`. If my-dependency has a bsconfig.json too, then everything will work seamlessly.\n+   \"bs-faker\"\n  ]\n  ...\n```\n\n## API\n\nWhen using optional params (`~param=?`), don't forget to add a unit `()` parameter in the end to invoke the function\nlike so:\n\n```reason\nlet narrowFood = BsFaker.Image.food(~width=200, ()); /* =\u003e \"https://someimage/with/width/of/200\" */\n\n/* Without the optional parameters, you don't have to add the unit */\nlet defaultFood = BsFaker.Image.food(); /* =\u003e \"https://someimage/with/default/width\" */\n```\n\n### `BsFaker.fake`\nCreates a string with fake data using mustache style templates.\nReturns a safe, `result` type instead of throwing an error on runtime.\n\n```reason\nlet message = BsFaker.Faker.fake(\"Welcome aboard, {{name.firstName}}\");\nswitch (message) {\n| Ok(msg) =\u003e print_endline(msg)\n| Error(_) =\u003e print_endline(\"Parsing error\")\n};\n```\n\n### `BsFaker.Image`\n\n```reason\nlet avatar = BsFaker.Image.avatar(); /* =\u003e string; \"https://\" */\nlet abstract = BsFaker.Image.abstract(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\nlet animals = BsFaker.Image.animals(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\nlet business = BsFaker.Image.business(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\nlet cats = BsFaker.Image.cats(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\nlet city = BsFaker.Image.city(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\nlet dataUri = BsFaker.Image.dataUri(~width: int=?, ~height: int=?, ()); /* =\u003e string; \"data:inage/svg+xml;...\" */\nlet fashion = BsFaker.Image.fashion(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\nlet food = BsFaker.Image.food(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\nlet image = BsFaker.Image.image(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\nlet imageUrl = BsFaker.Image.imageUrl(~width: int=?, ~height: int=?, ~category: string=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/640/480\" */\nlet nature = BsFaker.Image.nature(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\nlet nightlife = BsFaker.Image.nightlife(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\nlet people = BsFaker.Image.people(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\nlet sports = BsFaker.Image.sports(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\nlet technics = BsFaker.Image.technics(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\nlet transport = BsFaker.Image.transport(~width: int=?, ~height: int=?, ~randomize: bool=?, ()); /* =\u003e string; \"http://lorempixel.com/...\" */\n```\n\n### `BsFaker.Name`\n\n```reason\nlet findName = BsFaker.Name.findName(~firstName: string=?, ~lastName: string=?, ~gender: string=?, ()); /* =\u003e string; \"Mollie Hills\" */\nlet firstName = BsFaker.Name.firstName(~gender: string=?, ()); /* =\u003e string; \"Max\" */\nlet lastName = BsFaker.Name.lastName(~gender: string=?, ()); /* =\u003e string; \"Bartoletti\" */\nlet prefix = BsFaker.Name.prefix(~gender: string=?, ()); /* =\u003e string; \"Dr.\" */\nlet suffix = BsFaker.Name.suffix(); /* =\u003e string; \"MD\" */\nlet title = BsFaker.Name.title(); /* =\u003e string; \"Senior Creative Specialist\" */\nlet jobArea = BsFaker.Name.jobArea(); /* =\u003e string; \"Tactics\" */\nlet jobType = BsFaker.Name.jobType(); /* =\u003e string; \"Assistant\" */\n```\n\n### `BsFaker.Lorem`\n```reason\nlet word = BsFaker.Lorem.word(); /* =\u003e string; \"Lorem\" */\nlet words = BsFaker.Lorem.words(~wordCount=3, ()); /* =\u003e string; \"Lorem ipsum dolor\" */\nlet sentence = BsFaker.Lorem.sentence(~wordCount=5, ()); /* =\u003e string; \"Lorem ipsum dolor est totam\" */\nlet slug = BsFaker.Lorem.slug(~wordCount=3, ()); /* =\u003e string; \"lorem-ratione-est\" */\nlet sentences = BsFaker.Lorem.sentences(~sentenceCount=3, ~separator=\";;;\", ()); /* =\u003e string; \"Lorem ipsum....;;;Et ratione est...\" */\nlet paragraph = BsFaker.Lorem.paragraph(~sentenceCount=2, ()); /* =\u003e string; \"Et ratione est totam assumenda ...\" */\nlet paragraphs = BsFaker.Lorem.paragraphs(~paragraphCount=3, ~separator=\"\\n----\\n\", ()); /* =\u003e string */\nlet text = BsFaker.Lorem.text(); /* =\u003e string; \"Et lorem est dolor totam... */\nlet lines = BsFaker.Lorem.lines(~lineCount=3, ()); /* =\u003e string; */\n```\n\n### `BsFaker.Date`\n```reason\nlet past = BsFaker.Date.past(~years: int=?, ~refDate: Js.Date.t=?, ()); /* =\u003e Js.Date.t; */\nlet future = BsFaker.Date.future(~years: int=?, ~refDate: Js.Date.t=?, ()); /* =\u003e Js.Date.t; */\nlet between = BsFaker.Date.between(Js.Date.t, Js.Date.t); /* =\u003e Js.Date.t; */\nlet recent = BsFaker.Date.recent(~days: int=?, ()); /* =\u003e Js.Date.t; */\nlet month: (~abbr: bool=?, ~context: bool=?, ()); /* =\u003e string; */\nlet weekday: (~abbr: bool=?, ~context: bool=?, ()); /* =\u003e string; */\n```\n\n### `BsFaker.Company`\n```reason\nlet suffixes = BsFaker.Company.suffixes(); /* =\u003e [\"and Sons\", \"Co.\", \"Inc.\"] */\nlet companyName = BsFaker.Company.companyName(~format=2, ()); /* =\u003e \"Dewey, Cheatem and Howe\" */\nlet companySuffix = BsFaker.Company.companySuffix(); /* =\u003e \"Co.\" */\nlet catchPhrase = BsFaker.Company.catchPhrase(); /* =\u003e string */\nlet bs = BsFaker.Company.bs(); /* =\u003e string */\nlet catchPhraseAdjective = BsFaker.Company.catchPhraseAdjective(); /* =\u003e string */\nlet catchPhraseDescriptor = BsFaker.Company.catchPhraseDescriptor(); /* =\u003e string */\nlet catchPhraseNoun = BsFaker.Company.catchPhraseNoun(); /* =\u003e string */\nlet bsAdjective = BsFaker.Company.bsAdjective(); /* =\u003e string */\nlet bsBuzz = BsFaker.Company.bsBuzz(); /* =\u003e string */\nlet bsNoun = BsFaker.Company.bsNoun(); /* =\u003e string */\n```\n\n### `BsFaker.Phone`\n```reason\nlet phoneNumber = BsFaker.Phone.phoneNumber(~format=\"###.###.####\", ()); /* =\u003e string; \"621.876.3963\" */\nlet phoneNumberFormat = BsFaker.Phone.phoneNumberFormat(~phoneFormatsIndex=0); /* =\u003e string; \"107-646-3702\" */\nlet phoneFormats = BsFaker.Phone.phoneFormats(); /* =\u003e string; \"###-###-#### x###\" */\n```\n\n### `BsFaker.Internet`\n```reason\nlet userName = BsFaker.Internet.userName(~firstName: string=?, ~lastName: string=?, ()); /* =\u003e string; \"Rage.Max123\" */\nlet avatar = BsFaker.Internet.avatar(); /* =\u003e string; \"https://s3.amazonaws.com/uifaces/faces/twitter/igorgarybaldi/128.jpg\" */\nlet email = BsFaker.Internet.email(); /* =\u003e string; \": \"foo.bar@gmail.com\" */\nlet exampleEmail = BsFaker.Internet.exampleEmail(); /* =\u003e string; \"foo.bar@example.org\" */\nlet protocol = BsFaker.Internet.protocol(); /* =\u003e string; \"https\" */\nlet url = BsFaker.Internet.url(); /* =\u003e string; \"https://rashawn.name\" */\nlet domainName = BsFaker.Internet.domainName(); /* =\u003e string; \"marvin.org\" */\nlet domainSuffix = BsFaker.Internet.domainSuffix(); /* =\u003e string; \"net\" */\nlet domainWord = BsFaker.Internet.domainWord(); /* =\u003e string; \"alyce\" */\nlet ip = BsFaker.Internet.ip(); /* =\u003e string; \"97.238.241.11\" */\nlet ipv6 = BsFaker.Internet.ipv6(); /* =\u003e string; \"2001:0db8:6276:b1a7:5213:22f1:25df:c8a0\" */\nlet userAgent = BsFaker.Internet.userAgent(); /* =\u003e string; \"Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_7_5 rv:6.0; SL) AppleWebKit/532.0.1 (KHTML, like Gecko)\" */\nlet color = BsFaker.Internet.color(); /* =\u003e string; \"#06267f\" */\nlet mac = BsFaker.Internet.mac(); /* =\u003e string; \"78:06:cc:ae:b3:81\" */\nlet password = BsFaker.Internet.password(); /* =\u003e string; \"AM7zl6Mg\" */\n```\n\n### `BsFaker.Random`\n```reason\nlet alphaNumeric = BsFaker.Random.alphaNumeric(~count=5, ()); /* =\u003e string; \"9fedl\" */\nlet arrayElement = BsFaker.Random.arrayElement(~array=[| 126, -3, 58, 31 |], ()); /* =\u003e int; 58 */\nlet boolean = BsFaker.Random.boolean(); /* =\u003e boolean; true */\nlet image = BsFaker.Random.image(); /* =\u003e string; \"http://lorempixel.com/640/480/city\" */\nlet locale = BsFaker.Random.locale(); /* =\u003e string; \"sk\" */\nlet number = BsFaker.Random.number(~min=0, ~max=150, ~precision=5, ()); /* =\u003e int; 65 */\nlet uuid = BsFaker.Random.uuid(); /* =\u003e string; \"053cf30a-e38a-4327-936a-e5e2991f6b7f\" */\nlet word = BsFaker.Random.word(); /* =\u003e string; \"Gibraltar\" */\nlet words = BsFaker.Random.words(~count=3, ()); /* =\u003e string; \"Savings Account function Executive\" */\n```\n\n### `BsFaker.Database`\n```reason\nlet column = BsFaker.Database.column(); /* =\u003e string; \"id\" */\nlet type_ = BsFaker.Database.type_(); /* =\u003e string; \"byte\" */\nlet collation = BsFaker.Database.collation(); /* =\u003e string; \"utf8_unicode_ci\" */\nlet engine = BsFaker.Database.engine(); /* =\u003e string; \"MyISAM\" */\n```\n\n### `BsFaker.Hacker`\n```reason\nlet abbreviation = BsFaker.Hacker.abbreviation(); /* =\u003e string; \"XSS\" */\nlet adjective = BsFaker.Hacker.adjective(); /* =\u003e string; \"primary\" */\nlet noun = BsFaker.Hacker.noun(); /* =\u003e string; \"capacitor\" */\nlet verb = BsFaker.Hacker.verb(); /* =\u003e string; \"synthesize\" */\nlet ingverb = BsFaker.Hacker.ingverb(); /* =\u003e string; \"hacking\" */\nlet phrase = BsFaker.Hacker.phrase(); /* =\u003e string; \"You can't transmit the program without overriding the bluetooth RSS port!\" */\n```\n\n### `BsFaker.System`\n```reason\nlet fileName = BsFaker.System.fileName(); /* =\u003e string; \"optical.xsm\" */\nlet commonFileName = BsFaker.System.commonFileName(~ext=\"txt\", ()); /* =\u003e string; \"redundant.txt\" */\nlet mimeType = BsFaker.System.mimeType(); /* =\u003e string; \"audio/webm\" */\nlet commonFileType = BsFaker.System.commonFileType(); /* =\u003e string; \"text\" */\nlet commonFileExt = BsFaker.System.commonFileExt(); /* =\u003e string; \"png\" */\nlet fileType = BsFaker.System.fileType(); /* =\u003e string; \"audio\" */\nlet fileExt = BsFaker.System.fileExt(~mimeType=\"audio/webm\", ()); /* =\u003e string; \"model\" */\nlet semver = BsFaker.System.semver(); /* =\u003e string; \"0.8.1\" */\n```\n\n### `BsFaker.Commerce`\n\n```reason\nlet color = BsFaker.Commerce.color(); /* =\u003e string; \"maroon\" */\nlet department = BsFaker.Commerce.department(); /* =\u003e string; \"Music\" */\nlet productName = BsFaker.Commerce.productName(); /* =\u003e string; \"Licensed Steel Keyboard\" */\nlet price = BsFaker.Commerce.price(~min=0, ~max=1000, ~decimal=2, ~symbol=\"$\", ()); /* =\u003e string; \"$580.00\" */\nlet productAdjective = BsFaker.Commerce.productAdjective(); /* =\u003e string; \"Handcrafted\" */\nlet productMaterial = BsFaker.Commerce.productMaterial(); /* =\u003e string; \"Granite\" */\nlet product = BsFaker.Commerce.product(); /* =\u003e string; \"Salad\" */\n```\n\n### `BsFaker.Locale`\n`setLocale` function accepts parameter in form of variant.\nThe variant's constructors are capitalized locale ids of available locales, i.e. `Az` | `Cz` | `De` | `En_GB` etc.\n\n```reason\nlet () = BsFaker.Locale.setLocale(Sk); /* =\u003e unit */\nlet locale = BsFaker.Locale.getLocale(); /* =\u003e string; \"sk\" */\n```\n\n### `BsFaker.Finance`\n\n```reason\nlet account = BsFaker.Finance.account(~length=4, ()); /* =\u003e string; \"6738\" */\nlet accountName = BsFaker.Finance.accountName(); /* =\u003e string; \"Personal Loan Account\" */\nlet amount = BsFaker.Finance.amount(~min=50, ~max=100, ~dec=2, ~symbol=\"$\", ()); /* =\u003e string; \"$53.54\" */\nlet bic = BsFaker.Finance.bic(); /* =\u003e string; \"DYTOFXJ1362\" */\nlet bitcoinAddress = BsFaker.Finance.bitcoinAddress(); /* =\u003e string; \"17C4J6I0UE9O4Y5UCOFCWLG2RYPA5HMP\" */\nlet currencyCode = BsFaker.Finance.currencyCode(); /* =\u003e string; \"KMF\" */\nlet currencyName = BsFaker.Finance.currencyName(); /* =\u003e string; \"Zloty\" */\nlet currencySymbol = BsFaker.Finance.currencySymbol(); /* =\u003e string; \"CHF\" */\nlet iban = BsFaker.Finance.iban(); /* =\u003e string; \"SE1400277200550070250082\" */\nlet mask = BsFaker.Finance.mask(~length=4, ~parens=true, ~ellipsis=true, ()); /* =\u003e string; \"(...8899)\" */\nlet transactionType = BsFaker.Finance.transactionType(); /* =\u003e string; \"invoice\" */\n```\n\n### `BsFaker.Address`\n\n```reason\nlet city = (~format: string=?, ()); /* =\u003e string; */\nlet cityPrefix = (); /* =\u003e string; */\nlet citySuffix = (); /* =\u003e string; */\nlet country = (); /* =\u003e string; */\nlet countryCode = (); /* =\u003e string; */\nlet county = (); /* =\u003e string; */\nlet latitude = (); /* =\u003e string; */\nlet longitude = (); /* =\u003e string; */\nlet secondaryAddress = (); /* =\u003e string; */\nlet state = (~useAbbr: bool=?, ()); /* =\u003e string; */\nlet stateAbbr = (); /* =\u003e string; */\nlet streetAddress = (~useFullAddress: bool=?, ()); /* =\u003e string; */\nlet streetName = (); /* =\u003e string; */\nlet streetPrefix = (); /* =\u003e string; */\nlet streetSuffix = (); /* =\u003e string; */\nlet zipCode = (~format: string=?, ()); /* =\u003e string; */\n```\n\n### `BsFaker.Helpers`\n\n```reason\nlet randomize = (~arr: Js.Array.t('a)=?, ()); /* =\u003e 'a */\nlet slugify = (~str: string=?, ()); /* =\u003e string */\nlet replaceSymbolWithNumber = (~str: string=?, ~symbol: string=?, ()); /* =\u003e string */\nlet replaceSymbols = (~str: string=?, ()); /* =\u003e string */\nlet shuffle = (~o: Js.Array.t('a)=?, ()); /* =\u003e Js.Array.t('a) */\nlet mustache = (~str: string=?, ~data: Js.Dict.t('a)=?, ()); /* =\u003e string */\nlet createCard = (); /* =\u003e card */\nlet contextualCard = (); /* =\u003e contextual_card */\n```\n\n# Testing the library\n\n```\nnpm test\n```\n\nthis will compile and execute tests with `bs-jest`\n\n# Contributions\n\nDon't hesitate to open a PR with a new binding - while bumping up the amount of covered bindings in the README.\nThere are tests, use them and write the most simple test you can think of to make sure that the bindings work correctly.\n[You can read more about contributing here](CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschniz%2Fbs-faker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschniz%2Fbs-faker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschniz%2Fbs-faker/lists"}