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

Update documentation to reflect the new organization and new features #172

Merged
merged 13 commits into from
Jan 3, 2018
Merged
Show file tree
Hide file tree
Changes from 6 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
7 changes: 5 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ Once you have cloned the project, run `yarn` to install all the dependencies.
If you encounter trouble in the post-install phase involving `node-sass`, make sure you are building with VC++ 2013: `yarn config set msvs_version 2013`.

#### Architecture :house:
We have only one peer dependency on [lodash](https://lodash.com/) and we intend to keep it that way.<br />
immutad●t is organized in namespaces (array, collection, lang, etc.), a lot like lodash, please try to respect this organization; if you are not sure where to put your code, ask for the right place in your issue or PR.
immutad●t is managed as a [monorepo](https://medium.com/netscape/the-case-for-monorepos-907c1361708a) using [lerna](https://lernajs.io/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would mention yarn workspaces with a link to https://yarnpkg.com/lang/en/docs/workspaces/ before lerna.


The main package has no peer dependency and we intend to keep it that way.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I had to add a dependency on babel-runtime, we should either change this sentence or remove it.


Each package of immutad●t is organized in namespaces (array, collection, lang, etc.), a lot like lodash. Please try to respect this organization; if you are not sure where to put your code, ask for the right place in your issue or PR.

#### Tests and Code style :policeman:
If you write any code, be sure to write the test that goes with it in a file located at the same place and named `<something>.spec.js`; we have a coverage of a :100: percent and we would like to keep it :wink:.<br />
Expand Down
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ immutad●t uses plain JavaScript objects so you can access your data using stan

### Exhaustive and yet extensible

immutad●t comes with a large set of built-in utilities, mostly based on [lodash](https://lodash.com/). You haven't found what you're looking for? Do it yourself with the `convert` feature.
immutad●t comes with a large set of built-in utilities, mostly based on [ES2015+](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux). You can also find a package called [immutadot-lodash](https://github.com/Zenika/immutadot/tree/master/packages/immutadot-lodash) with some of [lodash](https://lodash.com/)'s utilities. You haven't found what you're looking for? Do it yourself with the `convert` feature.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use MDN short links https://mdn.io/... which will redirect to a full URL in the user's language.
And I'd rather link to JavaScript reference instead of global objects : https://mdn.io/JavaScript/Reference


### Learning curve

If you are already familiar with [lodash](https://lodash.com/) and [ES2015+](https://github.com/tc39/ecma262#ecmascript) then you should be able to use immutad●t quickly.
If you are already familiar with [ES2015+](https://github.com/tc39/ecma262#ecmascript) and [lodash](https://lodash.com/) then you should be able to use immutad●t quickly.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are using two different links for the same name "ES2015+", this one doesn't seem really appropriate, maybe use the link to MDN ?
I'm having doubts, should we really mention lodash here ?

Copy link
Contributor Author

@frinyvonnick frinyvonnick Dec 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should mention lodash because we have some features in our main packages that are directly inspired from lodash like chain, toggle, set, get, ...


## Installation

Expand Down Expand Up @@ -90,6 +90,41 @@ in node:

Feel free to [try immutad●t on runkit](https://npm.runkit.com/immutadot).

## Dot notation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use "Path notation" instead of "Dot notation" ?


immutad●t brings a few improvements to the classic dot notation:

### Slice notation

The slice notation let you go trough arrays to apply operations without having to map arrays at each level of imbrication.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer "The slice notation lets you iterate over arrays...", what do you think ?


```js
add({ nested: { prop: [{ val: 1 }, { val: 2 }] } }, 'nested.prop[:].val', 1)
// → { nested: { prop: [{ val: 2 }, { val: 3}] } }

divide({ nested: { prop: [{ val: 1 }, { val: 2 }] } }, 'nested.prop[1:].val', 2)
// → { nested: { prop: [{ val: 1 }, { val: 1}] } }

multiply({ nested: { prop: [{ val: 1 }, { val: 2 }, { val: 3 }, { val: 4 }] } }, 'nested.prop[1:2].val', 2)
// → { nested: { prop: [{ val: 1 }, { val: 4 }, { val: 6 }, { val: 4 }] } }
```

### List notation

The list notation let you go trough each keys of objects used as collection or map to apply operations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about "The list notation lets you iterate over the keys..."
It's not necessarily each keys...


```js
toggle({ nested: { prop: { 1: { active: true }, 2: { active: false } } } }, 'nested.prop.{*}.active')
// { nested: { prop: { 1: { active: false }, 2: { active: true }] } }

toLowerCase({ nested: { prop: { 1: { msg: 'Hello' }, 2: { msg: 'Hi' }, 3: { msg: 'Good morning' } } } }, 'nested.prop{2, 3}.active')
// { nested: { prop: { 1: { msg: 'Hello' }, 2: { msg: 'hi' }, 3: { msg: 'good morning' } } } }
```

### Performances

When appling operations on a path immutad●t creates the minimum of objects or arrays needed to guarantee your data structure to be immutable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appling -> applying
We have to be careful about that, immutadot doesn't actually create the minimum instances. It tries to do it, and further improvements are planned on this.
So maybe be more qualified about this ?


## Documentation

The full list of immutad●t's features is available in our [documentation](https://zenika.github.io/immutadot).
Expand Down
4 changes: 3 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Latest documentation is available at [zenika.github.io/immutadot](https://zenika.github.io/immutadot).
Latest documentation for our different packages are available at the following links:
- [immutadot](https://zenika.github.io/immutadot)
- [immutadot-lodash](https://zenika.github.io/immutadot-lodash)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.