mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-10 10:17:58 +00:00

* Releases updated version of datahub-web client UI code * Fix typo in yarn lock * Change yarn lock to match yarn registry directories * Previous commit missed some paths * Even more changes to yarnlock missing in previous commit * Include codegen file for typings * Add files to get parity for datahub-web and current OS datahub-midtier * Add in typo fix from previous commit - change to proper license * Implement proper OS fix for person entity picture url * Workarounds for open source DH issues * Fixes institutional memory api and removes unopensourced tabs for datasets * Fixes search dataset deprecation and user search issue as a result of changes * Remove internal only options in the avatar menu
71 lines
2.1 KiB
Markdown
71 lines
2.1 KiB
Markdown
# @datahub/utils
|
||
|
||
## Description
|
||
|
||
This contains a set of utility _functions_ & _types_, shareable and useful in a generic way **_across_** DataHub packages.
|
||
|
||
The goal here is not to serve as a 'bin' for code that may not fit into other packages and need to be shared, but to create a way to easily transport and host highly reusable and abstracted base functions that are independent of any application state.
|
||
|
||
**Functions should have**
|
||
|
||
- a well defined and thought out interface
|
||
- abide by the single responsibility principle, the open-closed principle
|
||
- be clearly named, unambiguously and adequately describe their use
|
||
- be properly namespaced
|
||
- be unit tested
|
||
|
||
Good examples of utility functions that makes sense to be included here would be
|
||
|
||
- an `Array` utility like groupBy that takes a collection of records and returns a map, keyed by values from records in the collection.
|
||
- a URL helper like `getAbsoluteUrl` that builds an absolute URL string from a relative URL.
|
||
|
||
Other non-function code snippets that make sense here would be base types.
|
||
A good example would be
|
||
|
||
- the generic type `ArrayElement<T>` where `ArrayElement` is `type ArrayElement<T extends Array<any>> = T[0]`
|
||
|
||
## Installation
|
||
|
||
```
|
||
ember install @datahub/utils
|
||
```
|
||
|
||
## Usage
|
||
|
||
```typescript
|
||
import { ArrayElement } from '@datahub/utils/types/array';
|
||
|
||
import { getAbsoluteUrl } from '@datahub/utils/url';
|
||
```
|
||
|
||
## Table of Contents
|
||
|
||
### Installation
|
||
|
||
- `mint checkout wherehows-frontend
|
||
- `cd datahub-web/@datahub/utils`
|
||
- `yarn install`
|
||
|
||
### Linting
|
||
|
||
- `yarn lint:hbs`
|
||
- `yarn lint:js`
|
||
- `yarn lint:js --fix`
|
||
|
||
### Running tests
|
||
|
||
- `ember test` – Runs the test suite on the current Ember version
|
||
- `ember test --server` – Runs the test suite in "watch mode"
|
||
- `ember try:each` – Runs the test suite against multiple Ember versions
|
||
|
||
### Running the dummy application
|
||
|
||
- `ember serve`
|
||
- Visit the dummy application at [http://localhost:4200](http://localhost:4200).
|
||
|
||
For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
|
||
|
||
## License
|
||
|
||
This project is licensed under the [Apache License](LICENSE.md).
|