-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: reformat all code with prettier
- Loading branch information
Showing
31 changed files
with
122 additions
and
111 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
/* ngx-moment (c) 2015, 2016 Uri Shaked / MIT Licence */ | ||
|
||
import {Pipe, PipeTransform} from '@angular/core'; | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import * as moment from 'moment'; | ||
|
||
const momentConstructor = moment; | ||
|
||
@Pipe({ name: 'amAdd' }) | ||
export class AddPipe implements PipeTransform { | ||
transform(value: moment.MomentInput, amount: moment.DurationInputArg1, unit?: moment.DurationInputArg2): any { | ||
if (typeof amount === 'undefined' || (typeof amount === 'number' && typeof unit === 'undefined')) { | ||
throw new Error('AddPipe: missing required arguments'); | ||
} | ||
return momentConstructor(value).add(amount, unit); | ||
transform( | ||
value: moment.MomentInput, | ||
amount: moment.DurationInputArg1, | ||
unit?: moment.DurationInputArg2, | ||
): any { | ||
if ( | ||
typeof amount === 'undefined' || | ||
(typeof amount === 'number' && typeof unit === 'undefined') | ||
) { | ||
throw new Error('AddPipe: missing required arguments'); | ||
} | ||
return momentConstructor(value).add(amount, unit); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
/* ngx-moment (c) 2015, 2016 Uri Shaked / MIT Licence */ | ||
|
||
import {Pipe, PipeTransform} from '@angular/core'; | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import * as moment from 'moment'; | ||
|
||
const momentConstructor = moment; | ||
|
||
@Pipe({ name: 'amDateFormat' }) | ||
export class DateFormatPipe implements PipeTransform { | ||
transform(value: moment.MomentInput, ...args: any[]): string { | ||
if (!value) { return ''; } | ||
if (!value) { | ||
return ''; | ||
} | ||
return momentConstructor(value).format(args[0]); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* ngx-moment (c) 2015, 2016 Uri Shaked / MIT Licence */ | ||
|
||
import {Pipe, PipeTransform} from '@angular/core'; | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import * as moment from 'moment'; | ||
|
||
@Pipe({ name: 'amFromUnix' }) | ||
export class FromUnixPipe implements PipeTransform { | ||
transform(value: number | string, ...args: string[]): any { | ||
return (typeof value === 'string') ? moment.unix(parseInt(value, 10)) : moment.unix(value); | ||
return typeof value === 'string' ? moment.unix(parseInt(value, 10)) : moment.unix(value); | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* ngx-moment (c) 2015, 2016 Uri Shaked / MIT Licence */ | ||
|
||
import {Pipe, PipeTransform} from '@angular/core'; | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import * as moment from 'moment'; | ||
|
||
@Pipe({ name: 'amFromUtc' }) | ||
export class FromUtcPipe implements PipeTransform { | ||
transform(value: moment.MomentInput, formats?: string|string[], ...args: string[]): any { | ||
transform(value: moment.MomentInput, formats?: string | string[], ...args: string[]): any { | ||
return formats ? moment.utc(value, formats) : moment.utc(value); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.