2.0.10 • Published 2 months ago

@rokii/utils v2.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Available Utils

Memoize

import { memoize }  from '@rokii/utils';

const fetchResults = memoize(() => {
  // Your long running function
})

Use memoize function for your long-running functions, like API-requests.

Under the hood it just uses just-memoize. Check the documentation for more details.

Search

import { search } from '@rokii/utils';

// Filter your results array
const results = search(arr, 'something', (el) => el.key);

// Display filtered results
display(results);

Simple function to search in your collection:

search = (items, term, toString = (item) => item) => {}

Where

  • items – your array of items;
  • term – search term;
  • toString – function to convert your collection item to string.

ShellCommand

import { shellCommand } from '@rokii/utils';

// Run your shell command
const result = await shellCommand('ls -la');

Simple function to run shell commands. It uses native child_process module.

Related

  • Rokii – main repo for Cerebro app;

License

MIT © David Jiménez

2.0.10

2 months ago

2.0.9

2 months ago

2.0.4

3 months ago

2.0.7

3 months ago

2.0.6

3 months ago

2.0.8

3 months ago

1.1.1

9 months ago

2.0.1

6 months ago

2.0.0

8 months ago

1.1.0

1 year ago

1.0.0

1 year ago