Giter VIP home page Giter VIP logo

Comments (3)

paintedbicycle avatar paintedbicycle commented on May 23, 2024 1

Closing this as wontfix for now, but open to reopening it once I know more about other data sources I add and if they need a formatting layer.

from sketch-data-faker.

paintedbicycle avatar paintedbicycle commented on May 23, 2024

Hi @ErikFontanel thank you and yes, I agree with you that those formats should match locale. I assumed Faker.js would do that.

Now, I want to integrate this request, but I am going to hold off for a little bit until I can sort out some questions I have. I have several issues right now that hold me back from doing this.

These are:

  1. I think this ticket is better suited upstream (on the Faker.js project itself) as I am already asking Faker.js to provide me their data in a specific locale. They do already have locale support built-in and are the ones supplying the data. So it's an issue on their end if they are not sending me the correctly formatted data. It seems silly to have to re-format their data in my project based on that locale.

In fact, there are some open tickets over there around locales:
https://github.com/Marak/faker.js/issues/753
https://github.com/Marak/faker.js/issues/486
https://github.com/Marak/faker.js/issues/752
https://github.com/Marak/faker.js/issues/747
https://github.com/Marak/faker.js/issues/598

  1. Adding extra dependencies. I don't want to get too far into dependencies in this project which add weight and maintenance. But on top of weight and maintenance, looking specifically the numeral.js project, it doesn't seem to be well supported any more (over 2 years since the last change and over a hundred open issues). Even if we find another project, the weight and maintenance issues remain.
  2. It's also going to be messy to catch the data coming back from these plugins and supply it properly inside Sketch Data Faker. If they give us a time, or a currency or a tel, we have to know what we are going to get and then use the correct formatter methods on the return data. While not hard, it's a lot of extra logic to maintain, especially combined with my next point:
  3. Last, but perhaps most important - I am hoping to add other data sources in the near future to Sketch Data Faker. In these other data sources, there may be better formatting options, which could help here. But even if not, I wouldn't want us to go too far down the path of formatting logic until I can figure out a way to get Sketch Data Faker to use multiple data APIs. Then, if we need more formatting, we can apply it to everything, not just Faker.

As to your second request - Default Locales, I agree here too. In the original ticket (#5 (comment)), I thought about this. I think you're right and I'm going to open a new ticket to track it. You can see it here: #7

from sketch-data-faker.

ErikFontanel avatar ErikFontanel commented on May 23, 2024

Hey Paul,

Thanks for the thought out reply and concerns on maintainability, definitely something people can learn from :)

  1. Agreed, I was surprised myself these issues were not resolved in faker.js already. Considering faker.js seems pretty active, it's a fair bet to rely on the upstream to get this fixed.
  2. True. I'm not experienced enough in the locale side of JS, but natively JS already supports quite some formatting functionality. Ie. Number.toLocaleString and Intl.NumberFormat. Perhaps that's a direction to explore. Although I'm sure that will be it's own can of worms haha.
  3. & 4. Gotcha. I'm surprised there has been such a lack of data supplier plugins since the release of Sketch 52, so it's assuring to read that you have this on your radar.

For now I think I'll just use some localised txt files as a fallback for stuff like the phone numbers.

from sketch-data-faker.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.