# sush-plugin-trim-id

> SUSH Plugin for trimming head or tail from ID

Latest version **1.0.2** (published 2017-02-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install sush-plugin-trim-id
pnpm add sush-plugin-trim-id
yarn add sush-plugin-trim-id
bun add sush-plugin-trim-id
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-02-26 |
| First published | 2017-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | 3846masa |
| Maintainers | 3846masa |
| Keywords | SUSH, SUSH-plugin, url-shortner |

## Links

- npm: https://www.npmjs.com/package/sush-plugin-trim-id
- Repository: https://github.com/3846masa/SUSH/tree/master/packages/sush-plugin-trim-id
- npm.io page: https://npm.io/package/sush-plugin-trim-id

## Recent versions

- 1.0.2 (latest) — 2017-02-26
- 1.0.1 — 2017-02-25
- 1.0.0 — 2017-02-25

## README

# sush-plugin-trim-id

[![NPM](https://nodei.co/npm/sush-plugin-trim-id.png?compact=true)](https://nodei.co/npm/sush-plugin-trim-id/)

[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![npm](https://img.shields.io/npm/v/sush-plugin-trim-id.svg?style=flat-square)](https://www.npmjs.com/package/sush-plugin-trim-id)

> Trim head or tail from ID

## Table of Contents

- [Install](#install)
- [Usage](#usage)
- [Contribute](#contribute)
- [License](#license)

## Install

### For HTML

Insert script tags in your HTML.
```html
<script src="https://unpkg.com/sush"></script>
<script src="https://unpkg.com/sush-plugin-trim-id"></script>
<!-- Add script tags of SUSH Plugins -->
```

### Via Node.js
```
npm install --save sush sush-plugin-trim-id [...SUSH_PLUGINS]
```

## Usage

### Via HTML

```html
<!DOCTYPE html>
<html>
<head>
  <script src="https://unpkg.com/sush"></script>
  <script src="https://unpkg.com/sush-plugin-trim-id"></script>
  <script>
    console.log(location.hash); // `#/example.view`

    var sush = new SUSH();

    sush.flow([
      ({ id, store }) => {
        console.log(id); // `/example.view`
        return { id, store };
      },
      SUSH.$trimId({ head: 1, tail: 5 })
    ])
    .then(({ id, store }) => {
      console.log(id); // `example`
    })
    .catch((err) => {
      console.error(err.stack || err);
    });
  </script>
</head>
</html>
```

### Via Node.js (e.g. Browserify, Webpack)

```js
import SUSH from 'sush';
import trimId from 'sush-plugin-trim-id';

console.log(location.hash); // `#/example.view``

const sush = new SUSH();

sush.flow([
  ({ id, store }) => {
    console.log(id); // `/example.view`
    return { id, store };
  },
  trimId({ head: 1, tail: 5 })
])
.then(({ id, store }) => {
  console.log(id); // `example`
})
.catch((err) => {
  console.error(err.stack || err);
});
```

## Contribute

PRs accepted.

## License

MIT © 3846masa

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