You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Tp_ReactNative/JokesApp/model/JokeFactory.ts

25 lines
643 B

class JokeFactory {
public static createCustomJokes(jsonArray: string) : CustomJoke[]{
let array = []
let json = JSON.parse(jsonArray)
json.forEach(function (joke) {
array.push(new CustomJoke(joke.type,joke.setup,joke.punchline,joke.image,joke.id))
})
return array
}
public static createSampleJokes(jsonArray: string) : SampleJoke[] {
let array = []
let json = JSON.parse(jsonArray)
json.forEach(function (joke) {
array.push(new SampleJoke(joke.type,joke.setup,joke.punchline,joke.image,joke.id))
})
return array
}
}