Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move to modules #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
root = true

[*]
indent_style = tab
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_style = space
indent_size = 2
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test

on: [push, pull_request]

jobs:
test:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Checkout project
uses: actions/checkout@v3
- name: test node@${{ matrix.node-version }} on ${{ matrix.os }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# split-uniq

> splits string by comma, trims & dedups

## Install

```sh
npm install split-uniq
```

## Usage

```js
import splituniq from "split-uniq"
splituniq('beep, boop, beep')
// ['beep', 'boop']
```

## License

MIT © [Debjeet Biswas](http://github.com/detj)
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
'use strict';
module.exports = (str, del = ',') => [... new Set(str.split(del).map(x => x.trim()).filter(x => x))];
export default (str, del = ',') => [... new Set(str.split(del).map(x => x.trim()).filter(x => x))];
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "split-uniq",
"version": "1.0.0",
"version": "2.0.0",
"description": "splits string by comma, trims & dedups",
"main": "index.js",
"type": "module",
"scripts": {
"test": "ava"
},
Expand All @@ -23,6 +24,6 @@
"author": "Debjeet Biswas <debjeet12@gmail.com>",
"license": "MIT",
"devDependencies": {
"ava": "^0.25.0"
"ava": "^5.2.0"
}
}
21 changes: 0 additions & 21 deletions readme.md

This file was deleted.

12 changes: 6 additions & 6 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const test = require('ava')

const splituniq = require('./')
import test from "ava";
import splituniq from "./index.js";

test('splits, trims & dedups', t => {
t.deepEqual(splituniq('beep, boop, beep'), ['beep', 'boop'])
t.deepEqual(splituniq('beep | boop | beep', '|'), ['beep', 'boop'])
})
t.deepEqual(splituniq('beep, boop, beep'), ['beep', 'boop']);
t.deepEqual(splituniq('beep | boop | beep', '|'), ['beep', 'boop']);
t.deepEqual(splituniq(' beep , boop , boop'), ['beep', 'boop']);
});