Socket
Socket
Sign inDemoInstall

@ashetm/ng-utility

Package Overview
Dependencies
10
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 14.0.0 to 14.0.1

ashetm-ng-utility-14.0.1.tgz

2

lib/pipes/array-filter.pipe.d.ts
import { PipeTransform } from '@angular/core';
import * as i0 from "@angular/core";
export declare class ArrayFilter<T extends string | number | boolean> implements PipeTransform {
transform(value: T[], filterBy: string | number | boolean): (string | number | boolean)[];
transform(value: T[], filterBy?: string | number | boolean): (string | number | boolean)[];
static ɵfac: i0.ɵɵFactoryDeclaration<ArrayFilter<any>, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<ArrayFilter<any>, "arrayFilter", true>;
}
import { PipeTransform } from '@angular/core';
import * as i0 from "@angular/core";
export declare class ArrayPluck implements PipeTransform {
transform(value: Array<Record<string | number, any>>, key: (string | number)): Array<any>;
transform(value: Array<Record<string | number, any>>, key: string | number): Array<any>;
static ɵfac: i0.ɵɵFactoryDeclaration<ArrayPluck, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<ArrayPluck, "arrayPluck", true>;
}

@@ -14,6 +14,6 @@ import * as i0 from "@angular/core";

import * as i12 from "./pipes/object-values.pipe";
export declare class NgUtilityPipesModule {
static ɵfac: i0.ɵɵFactoryDeclaration<NgUtilityPipesModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<NgUtilityPipesModule, never, [typeof i1.ArrayFilter, typeof i2.ArrayFrom, typeof i3.ArrayPluck, typeof i4.CapitalCase, typeof i5.CoerciveBoolean, typeof i6.ControlErrors, typeof i7.ControlValue, typeof i8.Initial, typeof i9.IsDate, typeof i10.ObjectEntries, typeof i11.ObjectKeys, typeof i12.ObjectValues], [typeof i1.ArrayFilter, typeof i2.ArrayFrom, typeof i3.ArrayPluck, typeof i4.CapitalCase, typeof i5.CoerciveBoolean, typeof i6.ControlErrors, typeof i7.ControlValue, typeof i8.Initial, typeof i9.IsDate, typeof i10.ObjectEntries, typeof i11.ObjectKeys, typeof i12.ObjectValues]>;
static ɵinj: i0.ɵɵInjectorDeclaration<NgUtilityPipesModule>;
export declare class UtilityPipesModule {
static ɵfac: i0.ɵɵFactoryDeclaration<UtilityPipesModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<UtilityPipesModule, never, [typeof i1.ArrayFilter, typeof i2.ArrayFrom, typeof i3.ArrayPluck, typeof i4.CapitalCase, typeof i5.CoerciveBoolean, typeof i6.ControlErrors, typeof i7.ControlValue, typeof i8.Initial, typeof i9.IsDate, typeof i10.ObjectEntries, typeof i11.ObjectKeys, typeof i12.ObjectValues], [typeof i1.ArrayFilter, typeof i2.ArrayFrom, typeof i3.ArrayPluck, typeof i4.CapitalCase, typeof i5.CoerciveBoolean, typeof i6.ControlErrors, typeof i7.ControlValue, typeof i8.Initial, typeof i9.IsDate, typeof i10.ObjectEntries, typeof i11.ObjectKeys, typeof i12.ObjectValues]>;
static ɵinj: i0.ɵɵInjectorDeclaration<UtilityPipesModule>;
}
import * as i0 from "@angular/core";
import * as i1 from "./utility-pipes.module";
export declare class NgUtilityModule {
static ɵfac: i0.ɵɵFactoryDeclaration<NgUtilityModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<NgUtilityModule, never, never, [typeof i1.NgUtilityPipesModule]>;
static ɵinj: i0.ɵɵInjectorDeclaration<NgUtilityModule>;
export declare class UtilityModule {
static ɵfac: i0.ɵɵFactoryDeclaration<UtilityModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<UtilityModule, never, never, [typeof i1.UtilityPipesModule]>;
static ɵinj: i0.ɵɵInjectorDeclaration<UtilityModule>;
}
{
"name": "@ashetm/ng-utility",
"version": "14.0.0",
"version": "14.0.1",
"contributors": [

@@ -5,0 +5,0 @@ {

@@ -1,24 +0,248 @@

# NgUtility
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.3.0.
# @ashetm/ng-utility
## Code scaffolding
``@ashetm/ng-utility`` is a library that provide some utilities classes, like pipes.
Run `ng generate component component-name --project ng-utility` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ng-utility`.
> Note: Don't forget to add `--project ng-utility` or else it will be added to the default project in your `angular.json` file.
*It works with Angular 14 and above*
## Build
<!-- [![build status](http://img.shields.io/travis/likeastore/ngDialog.svg)](https://travis-ci.org/likeastore/ngDialog) -->
<!-- [![npm version](http://badge.fury.io/js/ng-dialog.svg)](http://badge.fury.io/js/ng-dialog) -->
<!-- [![github tag](https://img.shields.io/github/tag/likeastore/ngDialog.svg)](https://github.com/likeastore/ngDialog/tags) -->
<!-- [![Download Count](https://img.shields.io/npm/dm/ng-dialog.svg)](http://www.npmjs.com/package/ng-dialog) -->
<!-- [![Code Climate](https://codeclimate.com/github/likeastore/ngDialog/badges/gpa.svg)](https://codeclimate.com/github/likeastore/ngDialog) -->
Run `ng build ng-utility` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
<!-- ### [Demo](http://likeastore.github.io/ngDialog) -->
After building your library with `ng build ng-utility`, go to the dist folder `cd dist/ng-utility` and run `npm publish`.
## Install
## Running unit tests
You can install it with npm:
Run `ng test ng-utility` to execute the unit tests via [Karma](https://karma-runner.github.io).
```bash
npm install @ashetm/ng-utility
```
## Further help
## Import
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
You only need to import ``UtilityModule``.
```ts
...
import { UtilityModule } from '@ashetm/ng-utility';
...
@NgModule({
...
imports: [
...
UtilityModule,
...
]
...
})
export class AppModule { }
```
## API
``@ashetm/ng-utility`` exposes the following:
### Modules
* ``UtilityModule``, that needs to import in order to use the library.
### Pipes
All pipes are standalone pipes.
#### ArrayFilter
```ts
<T extends string | number | boolean> transform(
value: T[],
filterBy?: string | number | boolean
): (string | number | boolean)[] { ... }
```
Use on array of string, number or boolean items, and needs an optional argument of type string, number or boolean.
If no argument provided, it will return the same array.
Example:
```tsx
{{ [0, 'test', false, 100, 'texts'] | arrayfilter }} // [0, 'test', false, 100, 'texts']
{{ [0, 'test', false, 100, 'texts'] | arrayfilter:'te' }} // ['test', 'texts']
```
#### ArrayFrom
```ts
transform(length: number, fill?: number): number[] { ... }
```
Use on a number, and needs an optional argument of type number.
If no argument provided, it will return an array with index as value.
Example:
```tsx
{{ 5 | arrayFrom }} // [0, 1, 2, 3, 4]
{{ 5 | arrayFrom:10 }} // [10, 10, 10, 10, 10]
```
#### ArrayPluck
```ts
transform(
value: Array<Record<string | number, any>>,
key: (string | number)
): Array<any> { ... }
```
Use on array of object items, and needs an argument of type number or string.
Example:
```tsx
{{ [{ a: 1, b: 5 }, { a: 2, c: 4 }, { a: true, b: 'test', c: {} }] | arrayPluck:'b' }} // [5, 'test']
{{ [{ a: 1, b: 5 }, { a: 2, c: 4 }, { a: true, b: 'test', c: {} }] | arrayPluck:'a' }} // [1, 2, true]
```
#### CapitalCase
```ts
transform(value: string): string { ... }
```
Use on string.
Example:
```tsx
{{ 'Lorum ipsum' | capitalCase }} // 'Lorum Ipson'
```
#### CoerciveBoolean
```ts
transform(value?: any): boolean { ... }
```
Use on any type.
Example:
```tsx
{{ undefined | coerciveBoolean }} // true
{{ null | coerciveBoolean }} // false
{{ 'true' | coerciveBoolean }} // true
```
#### ControlErrors
```ts
transform(controls: AbstractControl): (string | any)[] { ... }
```
Use on any ``AbstractControl`` type.
Example:
```tsx
formControl = new FormControl(null, {
validators: [Validators.required, () => ({ customValidator: 'Custom Error Message in any key name!' })]
});
...
{{ formControl | controlErrors }} // ['This field is required', 'Custom Error Message in any key name!']
```
#### ControlValue
```ts
transform(value: AbstractControl): any { ... }
```
Use on any ``AbstractControl`` type.
Example:
```tsx
formGroup = new FormGroup({
test1: new FormControl('test'),
test2: new FormControl(null),
});
...
{{ formGroup | controlValue }} // { test1: 'test', test2: null }
```
#### Initial
```ts
transform(value: string, max: number = Infinity): string { ... }
```
Use on a string, and needs an optional argument of type number.
If no argument provided, it will return string with initial of all words.
Example:
```tsx
{{ 'abc Def Ghi Jkl' | initial }} // 'aDGJ'
{{ 'abc Def Ghi Jkl' | initial:2 }} // 'aD'
```
#### IsDate
```ts
transform(value: any): boolean { ... }
```
Use on a string, and needs an optional argument of type number.
If no argument provided, it will return string with initial of all words.
Example:
```tsx
{{ 1676808350561 | isDate }} // true
{{ 'Sun Feb 19 2023 13:05:50 GMT+0100 (UTC+01:00)' | isDate }} // true
{{ 'WRONG' | isDate }} // false
```
#### ObjectEntries
```ts
transform(value: Record<string | number, any>): [string | number, any][] { ... }
```
Use on a object.
Example:
Same as ``Object.entries``.
#### ObjectKeys
```ts
transform(value: Record<string | number, any>): Array<string> { ... }
```
Use on a object.
Example:
Same as ``Object.keys``.
#### ObjectValues
```ts
transform(value: Record<string | number, any>): any[] { ... }
```
Use on a string, and needs an optional argument of type number.
Example:
Same as ``Object.values``.
## Issue
LOOKING FOR MAINTAINER OR IF THERE IS AN ISSUE OR ANY IDEA TO ADD. PLEASE CREATE ISSUE IN GITHUB REPOSITORY.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc