Skip to content

Commit

Permalink
Merge pull request #1 from mikaello/add-demo-project
Browse files Browse the repository at this point in the history
Add demo/example project, showing how to use this library
  • Loading branch information
mikaello authored Apr 2, 2019
2 parents abe8a15 + 137f1c8 commit fab5434
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Js.log(cleanedKeepStrings);
/* => { biz: 'baz', foo: '', qux: { baz: 'boz', txi: '' } } */
```

See also [example-project](./example).

## Contribute

If you find bugs or there are updates in [clean-deep](https://github.com/nunofgs/clean-deep), feel free to open an issue or PR. If you are upgrading any dependencies, please use yarn so `yarn.lock` is updated.
30 changes: 30 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Reason / Bucklescript
lib
.merlin
.bsb.lock
*.bs.js

# idea
.vscode

# OSX files
*.DS_Store

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity
21 changes: 21 additions & 0 deletions example/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 mikaello

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
20 changes: 20 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Demo project for bs-clean-deep

This project is only for testing that the [bs-clean-deep](https://github.com/mikaello/bs-clean-deep) bindings works as expected.

## Build
```
yarn build
```

## Build + Watch

```
yarn start
```

## Run

```
node src/Demo.bs.js
```
17 changes: 17 additions & 0 deletions example/bsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "bs-clean-deep-demo",
"version": "0.1.0",
"sources": {
"dir" : "src",
},
"package-specs": {
"module": "commonjs",
"in-source": true
},
"suffix": ".bs.js",
"bs-dependencies": [
"bs-clean-deep"
],
"namespace": true,
"refmt": 3
}
16 changes: 16 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "bs-clean-deep-demo",
"version": "0.1.0",
"scripts": {
"build": "bsb -make-world",
"start": "bsb -make-world -w",
"clean": "bsb -clean-world"
},
"license": "MIT",
"devDependencies": {
"bs-platform": "^5"
},
"dependencies": {
"bs-clean-deep": "^0.1.0"
}
}
14 changes: 14 additions & 0 deletions example/src/Demo.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
open BsCleanDeep;

Js.log("Demo of 'bs-clean-deep'\n");

let s = [%bs.raw {| { emptystring: '', foo: 3, emptyobject: {} } |}];

Js.log("No options:");
Js.log(CleanDeep.cleanDeep(s));

Js.log("\nWith empty objects preserved:");
Js.log(s |> CleanDeep.cleanDeep(~emptyObjects=false));

Js.log("\nWith empty objects and strings preserved:");
Js.log(CleanDeep.cleanDeep(~emptyObjects=false, ~emptyStrings=false, s));
39 changes: 39 additions & 0 deletions example/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


bs-clean-deep@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/bs-clean-deep/-/bs-clean-deep-0.1.0.tgz#01cfe17d1706cfa1cecb80c7b16b695e2683f758"
integrity sha512-W6zbZIHwDUylG4oBNAt+98tkMXOgD3MPCFPnQZdsz1XvXj17cY23vhgTmGON2TbiQc3vvm1bYSo3LjZhIe5PdQ==
dependencies:
clean-deep "^3.0.2"

bs-platform@^5:
version "5.0.0"
resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-5.0.0.tgz#f9fded818bafc3891aeb85eb4e0d95b8d8f8b4d7"
integrity sha512-zxLobdIaf/r7go47hOgxcd6C0ANh7MYMEtZNb9Al7JdoekzFZI50F4GpZpP8kMh9Z+M5PoPE1WuryT4S8mT8Kg==

clean-deep@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/clean-deep/-/clean-deep-3.0.2.tgz#1b7096822f289cc491ca6d85af5c028cbb22fc23"
integrity sha512-sLUtFxYtHc3jM9pmwyYXOLln0nnQ1OhFrefQ7nqUlva1crHDbi4gVO+nnMSm5jztFXIRDMt+kMNh0mOscbARow==
dependencies:
lodash.isempty "^4.4.0"
lodash.isplainobject "^4.0.6"
lodash.transform "^4.6.0"

lodash.isempty@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e"
integrity sha1-b4bL7di+TsmHvpqvM8loTbGzHn4=

lodash.isplainobject@^4.0.6:
version "4.0.6"
resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"
integrity sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=

lodash.transform@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.transform/-/lodash.transform-4.6.0.tgz#12306422f63324aed8483d3f38332b5f670547a0"
integrity sha1-EjBkIvYzJK7YSD0/ODMrX2cFR6A=
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bs-clean-deep",
"version": "1.0.0",
"version": "1.0.1",
"scripts": {
"build": "bsb -make-world",
"start": "bsb -make-world -w",
Expand Down

0 comments on commit fab5434

Please sign in to comment.