On NPM and Github, we already have very good and complete libraries like `Faker.js`, `Mockjs`, etc. Compared to these libraries, Suchjs tries to provide a different experience.
- The original intention of Suchjs is mainly to:
Use data attributes and their combination to describe data, declarative writing is easier to remember than function call writing.
Because of the combination of the above data attributes, the library itself provides a set of Complete API is used to process the declaration and parsing of data attributes, and the library itself is based on these APIs. In the Node environment, you can also easily use the `such.config.js` configuration file to extend the library, which can meet the customization of various data formats.
Suchjs provides different configurations for fields to achieve the effect of multiple simulations of an instance and fine control of data.
Suchjs also implements a template type like JS template string, it can realize the effect of free combination of various simulation data types in the string.
If the above features just suit your appetite, welcome to try it. If you have good suggestions or encounter problems, welcome to suggest; if you can contribute code, even less welcome and grateful.
Usage & Test
Some usage examples in the developer tools console:
For more types and usages, you can test via the globally exposed `Such` object in the console.
- Github libraries:
- Main library, developed with Typescript
- Dependent library, generate strings based on regular expressions
- Dependent library, format the numbers like the C language `printf`
- Extension library to implement browser-side request interception
- Self-promotion article:
- How to use suchjs to simulate data
- Suchjs, a more powerful and extensible data simulation library
- Share a library of simulation data that was recently finally committed to version 1.0
- Yet another extendable library for generating fake data