1.0.1 • Published 3 years ago

search-string-eerg v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

search-string

Search String is a javascript package to search string or part of it in string

Installation

Use the package manager npm to install search string.

npm i search-string-eerg --save

Usage

 <button (click)="test('juan perez')" >test</button>
import { Component } from '@angular/core';
import { customSearch } from 'search-string-eerg';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  users = [
    'juan alfredo carias perez',
    'Jhon Doe',
    'random text',
  ];

  test(query){
    const searchResult = this.users.filter(function (elem) {
        if(customSearch(elem, query)){
          return true;
        }else{ return false; }
    });
    console.log('result of search', searchResult);
  }
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT