Skip to content

Commit

Permalink
Merge pull request #63 from hckrnews/feature/validation
Browse files Browse the repository at this point in the history
Add the validator package
  • Loading branch information
w3nl authored Mar 5, 2021
2 parents 64f3a1e + 74bf7ce commit 18f77b3
Show file tree
Hide file tree
Showing 12 changed files with 4,580 additions and 2,278 deletions.
34 changes: 34 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"root": true,
"env": {
"es6": true,
"node": true,
"browser": true
},
"globals": {
"describe": false,
"it": false,
"expect": false
},
"extends": [
"@hckrnews/eslint-config"
],
"parserOptions": {
"sourceType": "module",
"parser": "babel-eslint",
"babelOptions": {
"configFile": "babel.config.js",
}
},
"overrides": [
{
"files": [
"**/__tests__/*.{j,t}s?(x)",
"**/tests/unit/**/*.spec.{j,t}s?(x)"
],
"env": {
"jest": true
}
}
]
}
32 changes: 0 additions & 32 deletions .eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm ci --production
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
Expand All @@ -39,7 +39,7 @@ jobs:
node-version: 12
registry-url: https://npm.pkg.github.com/
scope: '@your-github-username'
- run: npm ci
- run: npm ci --production
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,31 @@ or

Example usage:
```javascript
const flatter = new Obj({
const addressSchema = {
street: String,
number: Number,
postalCode: String,
city: String,
country: String,
};

const Address = Obj({ schema: addressSchema })

const myAddress = new Address({
street: 'Abc',
number: 42,
postalCode: '1234AB',
city: 'Example',
country: 'The Netherlands'
})
```

Example usage without a schema:
...

```javascript
const ObjectWithoutSchema = Obj()
const flatter = new ObjectWithoutSchema({
a: 1,
b: 2,
c: [3, 4],
Expand Down
12 changes: 12 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: true,
},
},
],
],
};
3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

4 changes: 1 addition & 3 deletions jest.config.js → jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ module.exports = {
'^@/(.*)$': '<rootDir>/src/$1',
},

testMatch: [
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)',
],
testMatch: ['**/__tests__/*.js'],

testURL: 'http://localhost/',

Expand Down
Loading

0 comments on commit 18f77b3

Please sign in to comment.