Skip to content

a simple function to search in array, return an array of strings

License

Notifications You must be signed in to change notification settings

dallmo/array-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@dallmo/array-search

overview

  • a simple function to search in array, return an array of strings ;
  • published on both deno land and jsr ;

usage

1. running on deno, import via deno module

  1. nothing to add via CLI.

  2. create a file test-via-deno-modules.ts

import { array_search } from "https://deno.land/x/dallmo_array_search/mod.ts";

  const test_array: any[] = ["aa", "abc", "a a", "b b", 123123, "123cc", "真係", "真 係 乜","唔係"];
  const search_string: string = "a";
  const search_result: string[] = await array_search( test_array, search_string );

console.log( search_result );
  1. run the test file
deno run test-via-deno-modules.ts

2. running on deno, import via jsr

usage

  1. in CLI, add the module with :
deno add @dallmo/array-search
  1. create a file test-via-jsr.ts
import { array_search } from "@dallmo/array-search";

  const test_array: any[] = ["aa", "abc", "a a", "b b", 123123, "123cc", "真係", "真 係 乜","唔係"];
  const search_string: string = "a";
  const search_result: string[] = await array_search( test_array, search_string );

console.log( search_result );
  1. run the test file
deno run test-via-jsr.ts

testing source codes

just run

deno test