This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal extends BaseObject { | |
} | |
var animal = new Animal(); | |
// animal.static returns Animal's constructor | |
// | |
// Animal() { | |
// _super.apply(this, arguments); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var collection = new TSCore.Data.Collection<Movie>([ | |
new Movie("Deadpool", 2016), | |
new Movie("Triple 9", 2016) | |
]); | |
collection.toArray(); | |
// [ | |
// { title: "Deadpool", year: 2016 }, | |
// { title: "Triple 9", year: 2016 }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var collection = new TSCore.Data.Collection<Movie>(); | |
collection.add(new Movie("Revenant", 2015)); | |
collection.toArray(); | |
// [ | |
// { title: "Revenant", year: 2015 } | |
// ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var collection = new TSCore.Data.Collection<Movie>(); | |
collection.addMany([ | |
new Movie("The Martian", 2015), | |
new Movie("Sicario", 2015), | |
new Movie("Jurassic World", 2015) | |
]); | |
collection.toArray(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var collection = new TSCore.Data.Collection<Movie>([ | |
new Movie("The Avengers: Age of Ultron", 2015) | |
]); | |
var movie = new Movie("The Martian", 2015); | |
collection.add(movie); | |
collection.remove(movie); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var collection = new TSCore.Data.Collection<Movie>(); | |
var movie1 = new Movie("The Avengers: Age of Ultron", 2015); | |
var movie2 = new Movie("Mad Max: Fury Road", 2015); | |
collection.addMany([movie1, movie2]); | |
collection.removeMany([movie1, movie2]); | |
collection.toArray(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var collection = new TSCore.Data.Collection<Movie>([ | |
new Movie("Deadpool", 2016), | |
new Movie("Triple 9", 2016), | |
new Movie("The Martian", 2015) | |
]); | |
collection.toArray(); | |
collection.removeWhere({ year: 2015 }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var collection = new TSCore.Data.Collection<number>([1, 2, 3, 4]); | |
collection.length; | |
// 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var collection = new TSCore.Data.Collection<number>([1, 2, 3, 4]); | |
collection.count(); | |
// 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var names = new TSCore.Data.Collection<string>(['jack', 'amy', 'robert', null]); | |
names.map(name => { | |
return name.toUpperCase(); | |
}).reject(name => { | |
return _.isNull(name); | |
}); | |
// ['JACK', 'AMY', 'ROBERT'] |