🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

angular-ecmascript-intl

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-ecmascript-intl - npm Package Compare versions

Comparing version

to
6.0.0

183

index.d.ts

@@ -0,5 +1,182 @@

import * as i0 from '@angular/core';
import { PipeTransform, InjectionToken, OnDestroy, ChangeDetectorRef } from '@angular/core';
interface IntlPipeOptions {
locale?: string;
}
type IntlCountryPipeOptions = Omit<Partial<Intl.DisplayNamesOptions>, 'languageDisplay'> & IntlPipeOptions;
declare class IntlCountryPipe implements PipeTransform {
private readonly locale?;
private readonly defaultOptions?;
transform(value: string | null | undefined, options?: IntlCountryPipeOptions): string | null;
static ɵfac: i0.ɵɵFactoryDeclaration<IntlCountryPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<IntlCountryPipe, "intlCountry", true>;
}
declare const INTL_COUNTRY_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlCountryPipeOptions, "locale">>;
type OmitOptions$3 = 'unit' | 'unitDisplay' | 'currency';
type IntlCurrencyPipeOptions = Omit<Partial<Intl.NumberFormatOptions>, OmitOptions$3> & IntlPipeOptions;
declare class IntlCurrencyPipe implements PipeTransform {
private readonly locale?;
private readonly defaultOptions?;
transform(value: number | string | null | undefined, currency: string, options?: IntlCurrencyPipeOptions): string | null;
static ɵfac: i0.ɵɵFactoryDeclaration<IntlCurrencyPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<IntlCurrencyPipe, "intlCurrency", true>;
}
declare const INTL_CURRENCY_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlCurrencyPipeOptions, "locale">>;
type IntlDatePipeOptions = Partial<Intl.DateTimeFormatOptions> & IntlPipeOptions;
declare class IntlDatePipe implements PipeTransform {
private readonly locale?;
private readonly defaultOptions?;
transform(value: string | number | Date | null | undefined, options?: IntlDatePipeOptions): string | null;
static ɵfac: i0.ɵɵFactoryDeclaration<IntlDatePipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<IntlDatePipe, "intlDate", true>;
}
declare const INTL_DATE_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlDatePipeOptions, "locale">>;
type OmitOptions$2 = 'unit' | 'unitDisplay' | 'currency' | 'currencyDisplay' | 'currencySign';
type IntlDecimalPipeOptions = Omit<Partial<Intl.NumberFormatOptions>, OmitOptions$2> & IntlPipeOptions;
declare class IntlDecimalPipe implements PipeTransform {
private readonly locale?;
private readonly defaultOptions?;
transform(value: number | string | null | undefined, options?: IntlDecimalPipeOptions): string | null;
static ɵfac: i0.ɵɵFactoryDeclaration<IntlDecimalPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<IntlDecimalPipe, "intlDecimal", true>;
}
declare const INTL_DECIMAL_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlDecimalPipeOptions, "locale">>;
declare namespace Intl$1 {
class DurationFormat {
constructor(locale?: string[] | string, options?: DurationFormatOptions);
format(duration: Duration): string;
}
interface DurationFormatOptions {
style?: DurationItemStyle | 'digital';
years?: DurationItemStyle;
yearsDisplay?: DurationItemDisplay;
months?: DurationItemStyle;
monthsDisplay?: DurationItemDisplay;
weeks?: DurationItemStyle;
weeksDisplay?: DurationItemDisplay;
days?: DurationItemStyle;
daysDisplay?: DurationItemDisplay;
hours?: DurationItemStyle | 'numeric' | '2-digit';
hoursDisplay?: DurationItemDisplay;
minutes?: DurationItemStyle | 'numeric' | '2-digit';
minutesDisplay?: DurationItemDisplay;
seconds?: DurationItemStyle | 'numeric' | '2-digit';
secondsDisplay?: DurationItemDisplay;
milliseconds?: DurationItemStyle | 'numeric' | '2-digit';
millisecondsDisplay?: DurationItemDisplay;
microseconds?: DurationItemStyle | 'numeric';
microsecondsDisplay?: DurationItemDisplay;
nanoseconds?: DurationItemStyle | 'numeric';
nanosecondsDisplay?: DurationItemDisplay;
fractionalDigits?: number;
}
type DurationItemStyle = 'long' | 'short' | 'narrow';
type DurationItemDisplay = 'always' | 'auto';
interface Duration {
years?: number;
months?: number;
weeks?: number;
days?: number;
hours?: number;
minutes?: number;
seconds?: number;
milliseconds?: number;
microseconds?: number;
nanoseconds?: number;
}
}
type IntlDurationPipeOptions = Partial<Intl$1.DurationFormatOptions> & IntlPipeOptions;
declare class IntlDurationPipe implements PipeTransform {
readonly locale: string | string[] | null | undefined;
readonly defaultOptions: Omit<IntlDurationPipeOptions, "locale"> | null;
transform(value: Intl$1.Duration | null | undefined, options?: IntlDurationPipeOptions): string | null;
static ɵfac: i0.ɵɵFactoryDeclaration<IntlDurationPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<IntlDurationPipe, "intlDuration", true>;
}
declare const INTL_DURATION_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlDurationPipeOptions, "locale">>;
type IntlLanguagePipeOptions = Partial<Intl.DisplayNamesOptions> & IntlPipeOptions;
declare class IntlLanguagePipe implements PipeTransform {
private readonly locale?;
private readonly defaultOptions?;
transform(value: string | null | undefined, options?: IntlLanguagePipeOptions): string | null;
static ɵfac: i0.ɵɵFactoryDeclaration<IntlLanguagePipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<IntlLanguagePipe, "intlLanguage", true>;
}
type OmitOptions$1 = 'unit' | 'unitDisplay' | 'currency' | 'currencyDisplay' | 'currencySign';
type IntlPercentPipeOptions = Omit<Partial<Intl.NumberFormatOptions>, OmitOptions$1> & IntlPipeOptions;
declare class IntlPercentPipe implements PipeTransform {
private readonly locale?;
private readonly defaultOptions?;
transform(value: number | string | null | undefined, options?: IntlPercentPipeOptions): string | null;
static ɵfac: i0.ɵɵFactoryDeclaration<IntlPercentPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<IntlPercentPipe, "intlPercent", true>;
}
type OmitOptions = 'unit' | 'currency' | 'currencyDisplay' | 'currencySign';
type IntlUnitPipeOptions = Omit<Partial<Intl.NumberFormatOptions>, OmitOptions> & IntlPipeOptions;
declare class IntlUnitPipe implements PipeTransform {
private readonly locale?;
private readonly defaultOptions?;
transform(value: number | string | null | undefined, unit: string | undefined, options?: IntlUnitPipeOptions): string | null;
static ɵfac: i0.ɵɵFactoryDeclaration<IntlUnitPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<IntlUnitPipe, "intlUnit", true>;
}
type IntlListPipeOptions = Partial<Intl.ListFormatOptions> & IntlPipeOptions;
declare class IntlListPipe implements PipeTransform {
private readonly locale?;
private readonly defaultOptions?;
transform(value: Iterable<string> | null | undefined, options?: IntlListPipeOptions): string | null;
static ɵfac: i0.ɵɵFactoryDeclaration<IntlListPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<IntlListPipe, "intlList", true>;
}
type IntlRelativeTimePipeOptions = Partial<Intl.RelativeTimeFormatOptions> & IntlPipeOptions;
declare class IntlRelativeTimePipe implements PipeTransform, OnDestroy {
#private;
readonly cdr: ChangeDetectorRef | null;
private readonly locales?;
private readonly defaultOptions?;
transform(value: string | number | Date | null | undefined, options?: IntlRelativeTimePipeOptions): string | null;
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<IntlRelativeTimePipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<IntlRelativeTimePipe, "intlRelativeTime", true>;
}
declare class IntlModule {
static ɵfac: i0.ɵɵFactoryDeclaration<IntlModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<IntlModule, never, [typeof IntlDatePipe, typeof IntlLanguagePipe, typeof IntlDecimalPipe, typeof IntlPercentPipe, typeof IntlCurrencyPipe, typeof IntlCountryPipe, typeof IntlUnitPipe, typeof IntlListPipe, typeof IntlRelativeTimePipe, typeof IntlDurationPipe], [typeof IntlDatePipe, typeof IntlLanguagePipe, typeof IntlDecimalPipe, typeof IntlPercentPipe, typeof IntlCurrencyPipe, typeof IntlCountryPipe, typeof IntlUnitPipe, typeof IntlListPipe, typeof IntlRelativeTimePipe, typeof IntlDurationPipe]>;
static ɵinj: i0.ɵɵInjectorDeclaration<IntlModule>;
}
declare const INTL_LANGUAGE_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlLanguagePipeOptions, "locale">>;
declare const INTL_LIST_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlListPipeOptions, "locale">>;
/**
* Generated bundle index. Do not edit.
* Set the locale(s) for all Intl Pipes. If not specified, the user language specified in the browser will be used. If
* specified, it needs to be a string with a BCP 47 language tag, or an array of such strings.
*/
/// <amd-module name="angular-ecmascript-intl" />
export * from './public-api';
declare const INTL_LOCALES: InjectionToken<string | string[] | undefined>;
declare const INTL_PERCENT_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlPercentPipeOptions, "locale">>;
declare const INTL_RELATIVE_TIME_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlRelativeTimePipeOptions, "locale">>;
declare const INTL_UNIT_PIPE_DEFAULT_OPTIONS: InjectionToken<Omit<IntlUnitPipeOptions, "locale">>;
export { INTL_COUNTRY_PIPE_DEFAULT_OPTIONS, INTL_CURRENCY_PIPE_DEFAULT_OPTIONS, INTL_DATE_PIPE_DEFAULT_OPTIONS, INTL_DECIMAL_PIPE_DEFAULT_OPTIONS, INTL_DURATION_PIPE_DEFAULT_OPTIONS, INTL_LANGUAGE_PIPE_DEFAULT_OPTIONS, INTL_LIST_PIPE_DEFAULT_OPTIONS, INTL_LOCALES, INTL_PERCENT_PIPE_DEFAULT_OPTIONS, INTL_RELATIVE_TIME_PIPE_DEFAULT_OPTIONS, INTL_UNIT_PIPE_DEFAULT_OPTIONS, IntlCountryPipe, IntlCurrencyPipe, IntlDatePipe, IntlDecimalPipe, IntlDurationPipe, IntlLanguagePipe, IntlListPipe, IntlModule, IntlPercentPipe, IntlRelativeTimePipe, IntlUnitPipe };
export type { IntlCountryPipeOptions, IntlCurrencyPipeOptions, IntlDatePipeOptions, IntlDecimalPipeOptions, IntlDurationPipeOptions, IntlLanguagePipeOptions, IntlListPipeOptions, IntlPercentPipeOptions, IntlRelativeTimePipeOptions, IntlUnitPipeOptions };

9

package.json
{
"name": "angular-ecmascript-intl",
"version": "5.0.0",
"version": "6.0.0",
"description": "Contains Angular pipes to transform internationalization data using Intl.* browser APIs",

@@ -16,7 +16,8 @@ "keywords": [

"country",
"timeago"
"timeago",
"duration"
],
"peerDependencies": {
"@angular/common": ">=19",
"@angular/core": ">=19"
"@angular/common": ">=20",
"@angular/core": ">=20"
},

@@ -23,0 +24,0 @@ "dependencies": {

@@ -50,2 +50,3 @@ # Angular ECMAScript Intl

- [Relative Time (timeago) pipe](#relative-time-timeago-pipe)
- [Duration pipe](#duration-pipe)

@@ -275,2 +276,23 @@ ### Date pipe

## Duration pipe
Use the duration pipe like the following:
```
{{ { hours: 2, minutes: 53 } | intlDuration: options }}
```
The input can be one of the following:
- [duration object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/format#parameters)
- null
- undefined
The following options are supported:
- [`style`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/DurationFormat#style)
- [`fractionalDigits`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/DurationFormat#fractionalDigits)
For each duration unit, there is a style and display option.
## Browser compatibility

@@ -299,2 +321,3 @@

| Relative Time | 71 | 65 | 14 |
| Duration | 129 | 136 | 16.4 |

@@ -305,2 +328,3 @@ ## Angular compatibility table

|---------|-------------------------|
| 20 | 6.x |
| 19 | 5.x |

@@ -307,0 +331,0 @@ | 18 | 4.x |

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet