ngneat / falso Goto Github PK
View Code? Open in Web Editor NEWAll the Fake Data for All Your Real Needs 🙂
Home Page: https://ngneat.github.io/falso/
License: MIT License
All the Fake Data for All Your Real Needs 🙂
Home Page: https://ngneat.github.io/falso/
License: MIT License
Add randProduct entity
No response
No response
No
Add more protocols to the randProtocol method, and also take a parameter like fullName
.
randProtocol({fullName: true}) // User Datagram Protocol
I have a PR ready for this.
No response
Yes
As tests are added to the project, it would be great to automate testing on push/pr git events.
Create a GitHub Action.
I can add it before creating a PR for #2 as more tests will be introduced.
No response
Yes
Add color function - blue, black, etc.
No response
No response
No
Priority list
No response
No response
No
gender({ abbrev: true })
// F M
No response
No response
No
Browsers list
No response
No response
No
It would be good to be able to determine a character count for a block of text. This could be super useful for testing max/min validation on inputs
We could either update an existing function to take an optional characterCount
param (maybe text
or words
). Or we could create a new function entirely?
E.G
function text(characterCount = 200): string {
No response
Yes
Drinks list
No response
No response
No
Currently, each function returns a single value. We should give the option to return an array of values.
Create a proxy function and use it in each one of the function generators:
export function cat(options?: FakeOptions) {
return fake(catsData, options)
}
// core.ts
export interface FakeOptions {
size: number
}
export function fake(options?: { size: 10 } ) {
return ...
}
No response
No
I want to use https://docusaurus.io/ to build the website as we did with elf.
I'm thinking about the following:
First, we need to group files by categories. For example:
- account
- city.ts
We can also keep it flat and add the @category
in a comment.
Next, we need to add docs to each function. ( We can do most of it using a script )
import { fake, FakeOptions } from './core';
import { data } from './abbreviation.json';
/**
* Returns a random abbreviation.
*
* @param {Object} options
* @param {string} options.length - Returns an array with the provided size.
*
*/
export function abbreviation<O extends FakeOptions>(options?: O) {
return fake(data, options);
}
Finally, based on the above information, we can write an executor that builds the docs as docusaurus expects it (using AST).
No response
No
Create a randMovie function
No response
No response
No
Will there be any interest in adding a list of programming languages?
No
Yes
Right now falso
generator is nondeterministic.
Using it in some snapshot tests will make tests always fail.
Add a way to set a starting seed number for random number generator
Proposed API
import { seed, randomNumber } from 'falso'
seed('some-seed') // set seed to some constant
randomNumber() // always returns same number
https://github.com/davidbau/seedrandom
https://unpkg.com/browse/[email protected]/lib/random.js
No response
Yes
No
The exported function is random
, not randRandom
.
https://ngneat.github.io/falso/docs/general#random
No response
No response
No response
No
No
Expected Behavior:
The following
const fields = {
contactEmail: randEmail(),
contactFirstName: randFirstName(),
contactLastName: randLastName(),
};
should report return values of
const fields = {
contactEmail: string,
contactFirstName: string,
contactLastName: string
};
Current behavior:
The above functions result in reporting
const fields = {
contactEmail: string[],
contactFirstName: string[],
contactLastName: string[]
};
Suggested fix:
declare function rand*<Options extends FakeOptions = undefined>(options?: Options): Options["length"] extends number ? string[] : string;
instead of
declare function rand*<Options extends FakeOptions>(options?: Options): Options["length"] extends number ? string[] : string;
No response
The issue simply has to do with that the type seems to favor the left-hand side of the type argument.
tsconfig: {
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false,
"esModuleInterop": true
}
}
Webstorm 2021.3
VSCode 1.63.2
For some reason, the error does not present itself when run in Code Sandbox with the same tsconfig. However, it has presented itself in two IDE with the above tsconfig.
No
Add randRole function
No response
No response
No
Add a method for generating some random quotes.
Pick up a couple of quotes and add then as json. I have done this, and just waiting for approval to submit a PR
No response
Yes
Brands list
No response
No response
No
I see that randomNumber
and others don't actually generate random numbers on demand but have a pre-canned list of numbers to pick from. I'd like something similar for dates.
randomDate
returns any random Date
picking from a pre-canned list of Date
offsets and then creating a new Date
object from "now" and applying the offset to get a random Date
relative to today (the date may be in the future or the past)randomPastDate
does the same as randomDate
except the offset is always negative to create a Date
in the pastrandomFutureDate
is like randomPastDate
except the offset is always positiverandomRecentDate
and randomSoonDate
are like randomPastDate
and randomFutureDate
except using a list of smaller offset values to returns dates that are within a few days from todayNo response
Yes
[
"Slack",
"GitHub",
"Jira",
"AWS Lambda",
"Bitbucket",
"Bitbucket Server",
"GitHub Enterprise",
"GitLab",
"Grafana",
"Jira Server",
"Microsoft Teams",
"PagerDuty",
"Vercel",
"Azure DevOps",
"WebHooks",
"Amixr",
"Calixa",
"ClickUp",
"Komodor",
"Linear",
"Rookout",
"Shortcut",
"Spike.sh",
"Split",
"TaskCall",
"Teamwork",
"Asana",
"OpenReplay",
"Bitbucket Pipelines",
"Datadog",
"FullStory",
"GitHub Actions",
"Heroku",
"InsightFinder",
"Netlify",
"Octohook",
"Learn More",
"Pivotal Tracker",
"Rocket.Chat",
"Trello",
"Twilio (SMS)",
"OpsGenie",
"Phabricator",
"Pushover",
"Redmine",
"SessionStack",
"VictorOps",
"Amazon SQS",
"Segment",
"Splunk"
]
No response
No response
No
Add support to generate hexadecimal and RGBA color generator.
Generate a random color with hexadecimal or RGBA utility.
No response
Yes
Support formats in phone number function.
References:
https://gist.github.com/anubhavshrimal/75f6183458db8c453306f93521e93d37
https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers
No response
No response
No
Permissions list
No response
No response
No
Add the following functions:
Use date-fns
No
No
I'd like to be able to get a random number (int or float) between a lower (inclusive) and an upper (exclusive) bound or something similar.
randomNumber
to randomInt
randomNumber
/randomInt
and to randomFloat
to accept an inclusive minimum and an exclusive maximumI did briefly look at the implementations of randomNumber
and randomFloat
and it appears that instead of generating random number on demand those modules take an approach of having pre-canned items to randomly pick from… that wasn't what I initially expected but I imagine there are benefits to this approach and I'm not sure yet if the same is feasible with a min/max
I am open to that. I do not feel strongly one way or the other as to who creates the pull request.
Add person skills function
No response
No response
No
Add food function
No response
No response
No
Use tool like https://typedoc.org/ to auto-generate our docs
No response
No response
No
Add clothing sizes to eCommerce
No response
No response
No
randRegion
randService
randArn
No response
No response
No
It would be good to have an example output for each function example
/**
* Generate a random rgb.
*
* @category colors
*
* @example
*
* randRgb()
* // rgb(69, 254, 28)
*
* @example
*
* randRgb({ alpha: true })
* // rgba(159, 167, 129, 0.74)
*
* @example
*
* randRgb({ length: 3 })
* // [ 'rgb(158, 13, 22)', 'rgb(58, 214, 87)', 'rgb(43, 193, 36)' ]
*
*/
I'm not sure if these will be pulled from the JS Doc comments automatically, or if we will need to do some extra work to our docusaurus config
No response
No
/**
* Generate a random date between ranges.
*
* @category Date
*
* @example
*
* month()
*
* @example
*
* month({ from: Date, to: Date })
*
* @example
*
* month({ length: 10 })
*
*/
export function between<Options extends BetweenOptions>(options: Options) {}
Note: Prefix each function with company
and max 20 items for each
Note: Prefix each function with database
and max 20 items for each
Note: max 20 items for each
Note: Prefix each function with vehicle
and max 20 items for each
No response
No response
No
Yes
rand is listed in the README as an export, but it's not actually exported.
I started a PR but the required boilerplate took longer than the fix.
No response
No response
No response
No response
No
Add language function
No response
No response
No
github, google, etc
No response
No response
No
Considering that UUID generally are used as identifiers, having a static list tends to me a problem sometime.
Generate UUID with some specific script or library to reduce chances of having duplicate identifiers
No response
Yes
https://dev.to/mrmuhammadali/live-code-editing-in-docusaurus-ux-at-its-best-2hj1
No response
No response
No
Yes
Usage of Math.random
should be banned because cannot be deterministic.
And in cases when using a faker funtion in a test, it will allways fail, because everytime returns nondeterministic random data.
A random
method already exists in the source code that allow also to set a seed
for pseudo random generator.
To replace every instance of Math.random
with random
from random.ts
+import { random } from './random.ts
-Math.random()
+random()
No response
No response
No response
No response
No
Most of the demos need predefined entities to work it.
Create new entity functions under the Entities category.
todo
import { fake, FakeOptions } from './core/core';
/**
* Generate a random todo.
*
* @category Entities
*
* @example
*
* randTodo()
*
* @example
*
* randTodo({ length: 10 })
*
*/
export function randTodo<O extends FakeOptions>(options?: O) {
return fake(() => ({
id,
title,
completed: false
}), options);
}
user
post
comment
No response
No
We should add some some of the more popular first/last names from around the world (making sure to include some names with accents over letters; é, ã, ù etc.
I could scrape the top X names from a selection of areas from around the world using This website
E.G
No response
Yes
Not all systems are meant to support accented characters.
We should separate the firstName and lastName JSON into with/without accented characters and allow users to pass a param to randFirstName
, randLastName
& randFullName
randFullName({ accentedChars: true });
// Alícia Ðekić
randFullName({ accentedChars: false });
// Ryan Smee
randFullName();
// Ryan Ðekić
No response
No response
Yes
Add locales support
Generate data via google translate?
?
No
Never, Once, Seldom, Often, Daily, Weekly, Monthly, Yearly
No response
No response
No
We can minimize the bundle size by using existing functions in other helpers. For example:
findName() => firstName() + lastName()
email() => firstName().toLowerCase() + postfix
card
alpha
etc
...
No
No
Instead of having an array of static RGB values, we could generate them on the fly.
(I'd be happy to do the work, i've just never contributed to an open source project before so i'm not sure on the etiquette)
function randomValue() {
return Math.floor(Math.random() * (255 + 1));
}
export function rgb() {
return `rgb(${randomValue()}, ${randomValue()}, ${randomValue()})`;
}
No response
Yes
Generate randLines
programmatically
No response
No response
No
This would allow user to test regex patterns for specific emails with random names.
E.G
randEmail({ length: 20, provider: 'myCorpEmail', suffix: 'com' });
// -> [ [email protected], [email protected], [email protected], .... ]
No response
No response
Yes
Pronouns is becoming a common field for user profiles
Use rand()
to select from the JSON list of most common pronouns.
(I have a branch for this ready to go if this feature is wanted)
No response
Yes
No
I would like to use this library in NodeJS. Unfortunately, I get an error message (see below) when I run the following code:
import { cat } from '@ngneat/falso';
console.log(cat());
https://stackblitz.com/edit/node-q73wut?file=index.ts
❯ npx ts-node index.ts
/home/projects/node-q73wut/node_modules/@ngneat/falso/src/index.js:1
export { zipCode } from './lib/zip-code';
^^^^^^
SyntaxError: Unexpected token 'export'
at wrapSafe (https://node-q73wut.w.staticblitz.com/blitz.528f704493b63b14b6f9ee36935eead8382e8395.js:6:166885)
at Module._compile (https://node-q73wut.w.staticblitz.com/blitz.528f704493b63b14b6f9ee36935eead8382e8395.js:6:167517)
at Object.Module._extensions..js (https://node-q73wut.w.staticblitz.com/blitz.528f704493b63b14b6f9ee36935eead8382e8395.js:6:168239)
at Module.load (https://node-q73wut.w.staticblitz.com/blitz.528f704493b63b14b6f9ee36935eead8382e8395.js:6:166317)
at Function.Module._load (https://node-q73wut.w.staticblitz.com/blitz.528f704493b63b14b6f9ee36935eead8382e8395.js:6:163857)
at Module.require (https://node-q73wut.w.staticblitz.com/blitz.528f704493b63b14b6f9ee36935eead8382e8395.js:6:166635)
### Please provide the environment you discovered this bug in
```true
URL: https://stackblitz.com/edit/node-q73wut?file=index.ts
~/projects/node-q73wut
❯ node -v
v14.16.0
~/projects/node-q73wut
❯ npm -v
7.17.0
### Anything else?
_No response_
### Do you want to create a pull request?
No
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.