billymoon / fiona Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://fiona.itaccess.org
Home Page: https://fiona.itaccess.org
Following the deno 1.0.0 style guide, it is recommended to not use index.js or index.ts as this can be misleading and be cause for confusion for users.
Fiona.register(["name", (seeded, { gender } = {}) => {
const myGender = getGender(gender || seeded.gender());
return `${
seeded.firstname({
gender: myGender,
})
} ${seeded.surname()}`;
}]);
Calling unique with Fiona.Json returns unique results as it's json strings being compared...
Fiona().unique(3, Fiona.Json({ nice: Fiona.Number({ max: 5 }) }))
(3) ['{"nice":1}', '{"nice":2}', '{"nice":5}']
... but with objects, they are compared for equality and can then be duplicated because they are not the same object even though they have the same data shape ...
JSON.stringify(Fiona().unique(3, Fiona.Object({ nice: Fiona.Number({ max: 5 }) })))
'[{"nice":0},{"nice":2},{"nice":0}]'
... it should be possible to request unique data structures, not just unique values
const [capture, retrieve] = Store();
console.log(Fiona(1).object({
user: capture("myUser", {
first: Fiona.Firstname,
last: Fiona.Surname
}, undefined),
firsty: () => retrieve("myUser").first,
lasty: () => retrieve("myUser").last
}))
When using in object structure, the approach of building string from initseed could be unexpected as sometimes numeric seed and string seed produce different output, and sometimes the same.
Fiona(123).random()
// 0.7081193615254571
Fiona('123').random()
// 0.9708307874253163
Fiona(123).object(Fiona.Random())
// 0.46259732286566746
Fiona('123').object(Fiona.Random())
// 0.46259732286566746
Fiona(123).info()
// {initseed: 123}
Fiona('123').info()
// {initseed: "123"}
Fiona(123).object(seeded => seeded.info())
// {initseed: "root/123"}
Fiona('123').object(seeded => seeded.info())
// {initseed: "root/123"}
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.