# jstk

> A simple toolkit for lodash.

Latest version **0.1.7** (published 2014-07-23) · 0 weekly downloads

## Install

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

## 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.1.7 |
| Published | 2014-07-23 |
| First published | 2013-08-12 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.4 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tamas Kokeny |
| Maintainers | eggdice |

## Links

- npm: https://www.npmjs.com/package/jstk
- Repository: https://github.com/EggDice/jstk
- Issues: https://github.com/EggDice/jstk/issues
- npm.io page: https://npm.io/package/jstk

## Recent versions

- 0.1.7 (latest) — 2014-07-23
- 0.1.6 — 2014-07-23
- 0.1.5 — 2014-07-23
- 0.1.4 — 2014-05-20
- 0.1.3 — 2014-03-05
- 0.1.2 — 2014-02-06
- 0.1.1 — 2014-02-05
- 0.1.0 — 2014-02-05
- 0.0.18 — 2014-01-23
- 0.0.17 — 2014-01-22
- 0.0.13 — 2013-08-14
- 0.0.12 — 2013-08-13
- 0.0.11 — 2013-08-13
- 0.0.10 — 2013-08-12
- 0.0.9 — 2013-08-12

## README

# JSTK
(JavaScript Toolkit)

## Usage

```javascript
var _ = require('jstk').bind(require('lodash'));
```

## Features

### Matcher

[Scala like match syntax](http://www.scala-lang.org/old/node/120)

```javascript
var numberMatcher = _.matcher({
	'1': function() {
		return 'one'
	},
	'2': function() {
		return 'two'
	}	
});

console.log(numberMatcher(1)); // 'one'
console.log(numberMatcher(2)); // 'two'
```

### toInt

Always uses 10 as radix.

```javascript
var integer = _.toInt('012');

console.log(integer); // 12
```

### getProperty

Able to handle nested objects using array or the '.' notation in the keys.

```javascript
var people = [{
  name: {
    first: 'John',
    second: 'Smith'
  },
  age: 45
},
{
  name: {
    first: 'Sheela',
    second: 'Smith'
  },
  age: 34
}];

var names = _.map(people, _.getProperty('name.first'));
console.log(names); // ['John', 'Sheela']
var names = _.map(people, _.getProperty(['name', 'first']));
console.log(names); // ['John', 'Sheela']
```
<!--
### callMethod

Able to handle nested objects using the '.' notation in the keys.

```javascript
function Person(name, age) {
  this.name = name;
  this.age = age;
}

Person.prototype.getName = function() {
  return this.name;
};

var people = [];
people.push({
  person: new Person('John', 45),
  grade: 'A'
});
people.push({
  person: new Person('Sheela', 34),
  grade: 'B'
});

var names = _.map(people, _.callMethod('person.getName'));
console.log(names); // ['John', 'Sheela']
```
-->
### repeat

```javascript
var letters = _.repeat(5, 'w');
console.log(letters); // ['w', 'w', 'w', 'w', 'w']
```

### recursiveMapValues

Recursive version of mapValues. Keys are returned as an array in the iterator
function.

```javascript
var obj = recursiveMapValues({a: 1, b: {c: 1}}, function(e) {
  return e * 2;
});
console.log(obj); // {a: 2, b: {c: 2}}

var obj2 = recursiveMapValues({a: 1, b: {c: 1}}, function(value, keys) {
  return keys.join('.');
});
console.log(obj2); // {a: 'a', b: {c: 'b.c'}}
```

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