Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/y0hami/o
common object helper functions
https://github.com/y0hami/o
helper javascript object
Last synced: 3 months ago
JSON representation
common object helper functions
- Host: GitHub
- URL: https://github.com/y0hami/o
- Owner: y0hami
- License: mit
- Created: 2018-11-28T10:32:56.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T21:53:47.000Z (about 2 years ago)
- Last Synced: 2024-05-01T14:14:19.147Z (8 months ago)
- Topics: helper, javascript, object
- Language: TypeScript
- Homepage: https://o.hammy2899.dev
- Size: 6.65 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
![o Logo](https://unpkg.com/[email protected]/logo.png)
# [o](https://github.com/hammy2899/o)
common object helper functions written in TypeScript which can be used in [NodeJS](https://nodejs.org/en/) and the browser (supports ES6).[![GitHub Actions Status](https://github.com/hammy2899/o/workflows/CI/badge.svg)](https://github.com/hammy2899/o/actions)
[![Coverage Status](https://coveralls.io/repos/github/hammy2899/o/badge.svg?branch=master)](https://coveralls.io/github/hammy2899/o?branch=master)
[![npm version](https://img.shields.io/npm/v/o.svg)](https://www.npmjs.com/package/o)
[![license](https://img.shields.io/github/license/hammy2899/o.svg)](https://github.com/hammy2899/o/blob/master/LICENSE.md)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)### Installation
#### [NPM](https://npmjs.com)
```bash
$ npm install o
```#### [Yarn](https://yarnpkg.com)
```bash
$ yarn add o
```### Usage
#### TypeScript
```typescript
import o from 'o';
// or require specific functions
import { is, empty } from 'o';
```#### NodeJS
```javascript
const o = require('o');
// or require specific functions
const { is, empty } = require('o');
```#### Browser
##### ES6
```htmlimport './o.min.js';
```
##### CDN/Script
```html```
### Example usage
```javascript
const a = {
a: 1,
b: 2,
c: {
d: 3,
e: 4,
},
};is(a); // => true
empty(a); // => false
has(a, 'a'); // => true
has(a, 'd'); // => false
has(a, 'c.d'); // => trueconst b = set(a, 'f', 5);
get(b, 'f'); // => 5
```For more examples and a list of all functions view the [documentation page](https://o.hammy2899.dev).
### Documentation
You can view the [documentation here](https://o.hammy2899.dev), docs are generated by [TypeDoc](https://typedoc.org).
### Contributing
All functions are documented with [TypeDoc](https://typedoc.org) and are fully commented explaining how they works. If you want to
contribute feel free to open a PR. When you open a PR please make sure `yarn test` and `yarn lint` both pass
with no errors and if any tests fail or any linting issues are raised please fix them accordingly.