# handy

> Common utility functions

Latest version **0.0.13** (published 2013-02-27) · 0 weekly downloads

## Install

```sh
npm install handy
pnpm add handy
yarn add handy
bun add handy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.13 |
| Published | 2013-02-27 |
| First published | 2012-11-02 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | el aras |
| Maintainers | openmason |
| Keywords | handy, utilities, utility, belt |

## Links

- npm: https://www.npmjs.com/package/handy
- Repository: https://github.com/openmason/handy
- npm.io page: https://npm.io/package/handy

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.0.13 (latest) — 2013-02-27
- 0.0.12 — 2013-02-26
- 0.0.11 — 2012-12-09
- 0.0.10 — 2012-12-09
- 0.0.9 — 2012-12-09
- 0.0.8 — 2012-12-09
- 0.0.7 — 2012-11-05
- 0.0.6 — 2012-11-03
- 0.0.5 — 2012-11-02
- 0.0.4 — 2012-11-02
- 0.0.3 — 2012-11-02
- 0.0.2 — 2012-11-02
- 0.0.1 — 2012-11-02

## README

[![build status](https://secure.travis-ci.org/openmason/handy.png)](http://travis-ci.org/openmason/handy)

# handy
Bunch of common utility functions

## Functionality

  * getVersion
    * arguments
      1. path where package.json is present (optional)
    * returns
      * value of 'version' in package.json (or)
      * emptry string if unable to find package.json
    * example:
    
            var handy = require('handy');
            var ver = handy.getVersion(__dirname);

  * getUserHome
    * returns - home directory for current user (platform agnostic)
    
            var handy = require('handy');
            var home = handy.getUserHome();

  * getType
    * arguments
      1. object - for which type to be determined
    * returns - type of the object in lowercase ('number', 'array', 'object', 'regex' ...)
    
            var handy = require('handy');
            var xyz = [1,2,3];
            if(handy.getType(xyz)=='array') { 
              ... do something ...
            };

  * getFileExtension
    * arguments
      1. filename - filename for which the extension to be returned
      2. defaultExt - default extension if no extension found
    * returns - extension from the filename (or) defaultExt 
    
            var handy = require('handy');
            var x = "abc/this/there.x.y.j"
            var r = handy.getFileExtension(x);
            // r => 'j'

  * isArrayEqual - check if two arrays are equal, irrespective of order of elements
    * arguments: pass two array objects
    * returns - true (if both arrays are equal), else false
    
            var handy = require('handy');
            var x = [93,1,6], y=[6,93,1];
            var r = handy.isArrayEqual(x,y);
            // r => true

  * isObjectEqual - check if two objects are equal, irrespective of order of keys (if value is an array, it is expected to be in same order)
    * arguments: pass two objects
    * returns - true (if both objects are equal), else false
    
            var handy = require('handy');
            var x = {a:'hello', b:{scores:[1,2,3], name:'tal'}, id:123}, y={id:123,a:'hello',b:{name:'tal',scores:[1,2,3]}};
            var r = handy.isObjectEqual(x,y);
            // r => true

  * merge - shallow merge objects
    * arguments
      1. variable arguments, pass objects that needs to be merged
    * returns - merged object (or) {} 
    
            var handy = require('handy');
            var x = {a:1}, y={b:2}, z={a:4,c:5};
            var r = handy.merge(x,y,z);
            // r => {a:4, b:2, c:5}

  * deepMerge - merge objects, all hashes at all levels are merged (arrays left intact)
    * arguments
      1. variable arguments, pass objects that needs to be deep merged
    * returns - merged object (or) {} 
    
            var handy = require('handy');
            var x = {a:1,p:{a:5}}, y={b:2}, z={a:4,c:5,p:{a:3,b:11}};
            var r = handy.deepMerge(x,y,z);
            // r => {a:4, b:2, c:5, p:{a:3,b:11}}

## Install

    $ npm install handy
    # please include handy to your package.json

## Test cases
To execute full test cases

    $ make

---
_Source: https://npm.io/package/handy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
