Skip to content

Commit

Permalink
corrected typo
Browse files Browse the repository at this point in the history
  • Loading branch information
mahakporwal02 committed Jan 14, 2022
1 parent 85b2b86 commit ad804e0
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Array [
email;
constructor(input) {
if (input.hasOwnProperty(email)) {
if (input.hasOwnProperty('email')) {
this.email = input.email;
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/javascript-use-cjs/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Person {
email;
constructor(input) {
if (input.hasOwnProperty(email)) {
if (input.hasOwnProperty('email')) {
this.email = input.email;
}
}
Expand All @@ -28,7 +28,7 @@ class Root {
person;
constructor(input) {
if (input.hasOwnProperty(person)) {
if (input.hasOwnProperty('person')) {
this.person = input.person;
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/javascript-use-esm/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Person {
email;
constructor(input) {
if (input.hasOwnProperty(email)) {
if (input.hasOwnProperty('email')) {
this.email = input.email;
}
}
Expand All @@ -29,7 +29,7 @@ class Root {
person;
constructor(input) {
if (input.hasOwnProperty(person)) {
if (input.hasOwnProperty('person')) {
this.person = input.person;
}
}
Expand Down
44 changes: 44 additions & 0 deletions exp4_q1_n270.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include <stdio.h>
#include <stdlib.h> // For exit()

int main()
{
FILE *fptr1, *fptr2;
char filename[100], c;

printf("Enter the filename to open for reading \n");
scanf("%s", filename);

// Open one file for reading
fptr1 = fopen(filename, "r");
if (fptr1 == NULL)
{
printf("Cannot open file %s \n", filename);
exit(0);
}

printf("Enter the filename to open for writing \n");
scanf("%s", filename);

// Open another file for writing
fptr2 = fopen(filename, "w");
if (fptr2 == NULL)
{
printf("Cannot open file %s \n", filename);
exit(0);
}

// Read contents from file
c = fgetc(fptr1);
while (c != EOF)
{
fputc(c, fptr2);
c = fgetc(fptr1);
}

printf("\nContents copied to %s", filename);

fclose(fptr1);
fclose(fptr2);
return 0;
}
2 changes: 1 addition & 1 deletion src/generators/javascript/renderers/ClassRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const JS_DEFAULT_CLASS_PRESET: ClassPreset<ClassRenderer> = {
const assigments = Object.entries(properties).map(([propertyName, property]) => {
if (!model.isRequired(propertyName)) {
propertyName = renderer.nameProperty(propertyName, property);
return `if (input.hasOwnProperty(${propertyName})) {
return `if (input.hasOwnProperty('${propertyName}')) {
this.${propertyName} = input.${propertyName};
}`;
}
Expand Down
4 changes: 2 additions & 2 deletions test/generators/javascript/JavaScriptGenerator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ describe('JavaScriptGenerator', () => {
this.city = input.city;
this.state = input.state;
this.houseNumber = input.houseNumber;
if (input.hasOwnProperty(marriage)) {
if (input.hasOwnProperty('marriage')) {
this.marriage = input.marriage;
}
if (input.hasOwnProperty(members)) {
if (input.hasOwnProperty('members')) {
this.members = input.members;
}
this.arrayType = input.arrayType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ class Address {
this.city = input.city;
this.state = input.state;
this.houseNumber = input.houseNumber;
if (input.hasOwnProperty(marriage)) {
if (input.hasOwnProperty('marriage')) {
this.marriage = input.marriage;
}
if (input.hasOwnProperty(members)) {
if (input.hasOwnProperty('members')) {
this.members = input.members;
}
this.arrayType = input.arrayType;
if (input.hasOwnProperty(otherModel)) {
if (input.hasOwnProperty('otherModel')) {
this.otherModel = input.otherModel;
}
}
Expand Down Expand Up @@ -105,14 +105,14 @@ class Address {
this.city = input.city;
this.state = input.state;
this.houseNumber = input.houseNumber;
if (input.hasOwnProperty(marriage)) {
if (input.hasOwnProperty('marriage')) {
this.marriage = input.marriage;
}
if (input.hasOwnProperty(members)) {
if (input.hasOwnProperty('members')) {
this.members = input.members;
}
this.arrayType = input.arrayType;
if (input.hasOwnProperty(otherModel)) {
if (input.hasOwnProperty('otherModel')) {
this.otherModel = input.otherModel;
}
}
Expand Down

0 comments on commit ad804e0

Please sign in to comment.