Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "derive-ts", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"author": "Jake Cyr", | ||
@@ -5,0 +5,0 @@ "license": "ISC", |
@@ -81,2 +81,4 @@ # Derive TypeScript Interface | ||
### Simple Example | ||
A JavaScript file has been created called 'example.js' with the following contents: | ||
@@ -126,1 +128,50 @@ | ||
``` | ||
### Example with Sub-Interfaces Generated | ||
A JavaScript file has been created called 'example.js' with the following contents: | ||
```javascript | ||
exports.example = { | ||
address_components: [ | ||
{ long_name: '8035', short_name: '8035', types: ['street_number'] }, | ||
{ long_name: 'Market Street', short_name: 'Market St', types: ['route'] }, | ||
{ long_name: 'Wilmington', short_name: 'Wilmington', types: ['locality', 'political'] }, | ||
], | ||
adr_address: | ||
'<span class="street-address">8035 Market St</span>, <span class="locality">Wilmington</span>, <span class="region">NC</span> <span class="postal-code">28411</span>, <span class="country-name">USA</span>', | ||
business_status: 'OPERATIONAL', | ||
formatted_address: '8035 Market St, Wilmington, NC 28411, USA', | ||
formatted_phone_number: '(910) 686-2007', | ||
vicinity: '8035 Market Street, Wilmington', | ||
website: | ||
'https://restaurants.subway.com/united-states/nc/wilmington/8035-market-st?utm_source=yxt-goog&utm_medium=local&utm_term=acq&utm_content=60848&utm_campaign=evergreen-2020&y_source=1_MTQ4OTUyNzYtNzE1LWxvY2F0aW9uLmdvb2dsZV93ZWJzaXRlX292ZXJyaWRl', | ||
}; | ||
``` | ||
After running the following command (notice the `--sub-interfaces` flag in the command) | ||
```bash | ||
derive-ts derive ./example.js --output-file output.ts --interface-name Test --import-name example --sub-interfaces | ||
``` | ||
The following file is generated 'output.ts' with the contents: | ||
```typescript | ||
export interface AddressComponents { | ||
long_name: string; | ||
short_name: string; | ||
types: string[]; | ||
} | ||
export interface Test { | ||
address_components: AddressComponents[]; | ||
adr_address: string; | ||
business_status: string; | ||
formatted_address: string; | ||
formatted_phone_number: string; | ||
vicinity: string; | ||
website: string; | ||
} | ||
``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12630
176
0