@flock/wirespec 0.13.2 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # wirespec
2
+
3
+ ![npm version](https://img.shields.io/npm/v/@flock/wirespec)
4
+ ![license](https://img.shields.io/npm/l/@flock/wirespec)
5
+
6
+ ## Wirespec your API's
7
+
8
+ Simplify your API development workflows, accelerate implementation, and guarantee strict adherence to defined contract specifications
9
+
10
+ Wirespec is a tool that simplifies interface design using a contract-first approach, with concise, human-readable specifications as the single source of truth.
11
+
12
+ Visit [wirespec.io](https://wirespec.io) for more information about the project.
13
+
14
+ ## Features
15
+
16
+ - **Generate Wirespec files**: Automatically create Wirespec templates or definitions programmatically.
17
+ - **Validation**: Ensure your Wirespec files adhere to defined schema and specifications.
18
+ - **CLI Support**: Easily integrate with your development workflow using simple CLI commands.
19
+ - **Integration Ready**: Works well with modern JavaScript/TypeScript projects.
20
+
21
+ ## Installation
22
+
23
+ You can install `wirespec` globally or as a dev dependency in your project:
24
+
25
+ ```bash
26
+ # Install as a dev dependency
27
+ npm install --save-dev wirespec
28
+
29
+ # Or install globally
30
+ npm install -g wirespec
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ### CLI
36
+
37
+ The `wirespec` plugin can be used directly through the command line. Below are some example commands:
38
+
39
+ ```bash
40
+ # Create a new Wirespec file
41
+ wirespec generate <filename>
42
+
43
+ # Validate an existing Wirespec file
44
+ wirespec validate <filename>
45
+ ```
46
+
47
+ ### Programmatic Usage
48
+
49
+ You can also use `wirespec` in your JavaScript or TypeScript code:
50
+
51
+ ```javascript
52
+ import { generate, validate } from 'wirespec';
53
+
54
+ // Generate a Wirespec file
55
+ generate('example.wirespec');
56
+
57
+ // Validate a Wirespec file
58
+ const isValid = validate('example.wirespec');
59
+ console.log(`Is valid: ${isValid}`);
60
+ ```
61
+
62
+ ## Contributing
63
+
64
+ Contributions are welcome! If you find any issues or want to suggest new features, feel free to open an issue or submit
65
+ a pull request.
66
+
67
+ See [our CONTRIBUTING.md](https://github.com/flock-community/wirespec/blob/master/CONTRIBUTING.md) for more details
68
+
69
+ ## License
70
+
71
+ This project is licensed under the [Apache-2.0 license](https://github.com/flock-community/wirespec/blob/master/LICENSE).
72
+
73
+ ---
74
+
75
+ *Elevate your Wirespec development workflow with the `wirespec` npm library.*
@@ -37,6 +37,11 @@ if (typeof Array.prototype.fill === 'undefined') {
37
37
  Object.defineProperty(TypedArray.prototype, 'fill', {value: Array.prototype.fill});
38
38
  }
39
39
  });
40
+ if (typeof Math.log2 === 'undefined') {
41
+ Math.log2 = function (x) {
42
+ return Math.log(x) * Math.LOG2E;
43
+ };
44
+ }
40
45
  if (typeof Math.log10 === 'undefined') {
41
46
  Math.log10 = function (x) {
42
47
  return Math.log(x) * Math.LOG10E;
@@ -53,10 +58,11 @@ if (typeof Math.clz32 === 'undefined') {
53
58
  };
54
59
  }(Math.log, Math.LN2);
55
60
  }
56
- if (typeof Math.log2 === 'undefined') {
57
- Math.log2 = function (x) {
58
- return Math.log(x) * Math.LOG2E;
59
- };
61
+ if (typeof String.prototype.startsWith === 'undefined') {
62
+ Object.defineProperty(String.prototype, 'startsWith', {value: function (searchString, position) {
63
+ position = position || 0;
64
+ return this.lastIndexOf(searchString, position) === position;
65
+ }});
60
66
  }
61
67
  if (typeof String.prototype.endsWith === 'undefined') {
62
68
  Object.defineProperty(String.prototype, 'endsWith', {value: function (searchString, position) {
@@ -69,12 +75,6 @@ if (typeof String.prototype.endsWith === 'undefined') {
69
75
  return lastIndex !== -1 && lastIndex === position;
70
76
  }});
71
77
  }
72
- if (typeof String.prototype.startsWith === 'undefined') {
73
- Object.defineProperty(String.prototype, 'startsWith', {value: function (searchString, position) {
74
- position = position || 0;
75
- return this.lastIndexOf(searchString, position) === position;
76
- }});
77
- }
78
78
  //endregion
79
79
  //region block: imports
80
80
  var imul_0 = Math.imul;