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
export default class StringUtility { | |
/** | |
* Converts a string to a camel case string. | |
* | |
* @example | |
* StringUtility.toCamelCase("liveDown_by-the.River"); | |
* // 'liveDownByTheRiver' | |
*/ | |
static toCamelCase(str) { | |
return ( |
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
import { DispatchProp } from 'react-redux'; | |
import IAction from './IAction'; | |
import { RouteComponentProps } from 'react-router'; | |
export type ReduxProps<P = any, R = never> = [R] extends [never] | |
? DispatchProp<IAction<P>> | |
: DispatchProp<IAction<P>> & RouteComponentProps<R>; |
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
const intersection = array1.filter(element => array2.includes(element)); | |
const intersection = array1.some(element => array2.includes(element)); |
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
import LocationModel from './LocationModel'; | |
import CarModel from './CarModel'; | |
import {BaseModel} from 'sjs-base-model'; | |
class PersonModel extends BaseModel { | |
firstName = ''; | |
lastName = ''; | |
age = 0; | |
address = LocationModel; // Creates a new LocationModel if there is address data |
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
import LocationModel from './LocationModel'; | |
import CarModel from './CarModel'; | |
class PersonModel { | |
firstName = ''; | |
lastName = ''; | |
age = 0; | |
address = null | |
cars = []; |
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
import LocationModel from './LocationModel'; | |
import CarModel from './CarModel'; | |
import {BaseModel} from 'sjs-base-model'; | |
class PersonModel extends BaseModel { | |
public readonly firstName: string = ''; | |
public readonly lastName: string = ''; | |
public readonly age: string = 0; | |
public readonly address: LocationModel = LocationModel as any; |
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
const person = new PersonModel({firstName: 'Joe', lastName: 'Doe', address: addressData}); | |
console.log(person.fullName); // Joe Doe | |
person.update({firstName: 'John'}); | |
console.log(person.fullName); // John Doe |
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
import LocationModel from './LocationModel'; | |
import CarModel from './CarModel'; | |
import {BaseModel} from 'sjs-base-model'; | |
class PersonModel extends BaseModel { | |
firstName = ''; | |
lastName = ''; | |
age = 0; | |
address = LocationModel; |
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
validationSchema: yup.object().shape({ | |
firstName: yup.string().required(validationMessages.firstName), | |
lastName: yup.string().required(validationMessages.lastName), | |
emailAddress: yup | |
.string() | |
.email(validationMessages.email) | |
.test('eitherOr', validationMessages.eitherEmail, function(emailAddress) { | |
// tslint:disable-next-line:no-invalid-this | |
return Boolean(emailAddress) || Boolean(this.parent.pin); | |
}), |
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
resolve: { | |
extensions: ['.ts', '.tsx', '.js', '.json'], | |
alias: { | |
environment: path.join(__dirname, 'src', 'environments', process.env.CLIENT_ENV) | |
}, | |
}, |