Skip to content

Commit

Permalink
chore: move to modules
Browse files Browse the repository at this point in the history
- update to modules
- update dependencies
- update readme
- update editorconfig
- update test
- move to github workflows
  • Loading branch information
detj committed May 9, 2023
1 parent d9e64cc commit d270ef0
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 42 deletions.
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
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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 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))];
7 changes: 4 additions & 3 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 @@ -12,7 +13,7 @@
"csv",
"uniq",
"unique",
"dedup",
"dedupe",
"environment variables",
"env"
],
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']);
});

0 comments on commit d270ef0

Please sign in to comment.