Skip to content

Instantly share code, notes, and snippets.

Esteban Muñoz Lagos luckio41

Block or report user

Report or block luckio41

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@luckio41
luckio41 / format.pipe.ts
Created Dec 14, 2017
Number Format Pipe
View format.pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'numberFormat'
})
export class FormatPipe implements PipeTransform {
transform(value: any, ...args: any[]): any {
value = value.toString().split('').reverse().join('').replace(/(?=\d*\.?)(\d{3})/g, '$1.');
value = value.split('').reverse().join('').replace(/^[\.]/, '');
@luckio41
luckio41 / shuffle.ts
Created Dec 14, 2017
Typescript shuffle function
View shuffle.ts
/**
* Shuffle
* @param a
*/
shuffle(a) {
for (let i = a.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[a[i], a[j]] = [a[j], a[i]];
}
return a;
You can’t perform that action at this time.