Skip to content

Commit

Permalink
feat: add upsert method
Browse files Browse the repository at this point in the history
Most `PropertiesEditor` methods now return booleans depending on the result of each action.

BREAKING CHANGE: - re-aligned method names to be closer to SQL conventions since using `upsert`
  - the `PropertiesEditor` `remove` method was renamed to `delete`
  - the `PropertiesEditor` `edit` method was renamed to `update`
  • Loading branch information
nbouvrette committed Apr 25, 2023
1 parent 5a0d36e commit 8a356fc
Show file tree
Hide file tree
Showing 6 changed files with 281 additions and 149 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ properties.insert('newKey2', 'こんにちは', {
escapeUnicode: true,
})

properties.remove('hello')
properties.delete('hello')
console.log(properties.format())

/**
Expand All @@ -184,6 +184,8 @@ console.log(properties.format())
*/
```

We were not able to show all methods in the example, but the `update` and `upsert` methods can also be useful to modify content.

### Webpack File Loader

If you would like to import `.properties` directly using `import`, this package comes with its own Webpack file loader located under `properties-file/webpack-loader`. Here is an example of how to configure it:
Expand Down
164 changes: 82 additions & 82 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"devDependencies": {
"@release-it/conventional-changelog": "5.1.1",
"@types/jest": "29.5.1",
"@typescript-eslint/eslint-plugin": "5.59.0",
"@typescript-eslint/parser": "5.59.0",
"@typescript-eslint/eslint-plugin": "5.59.1",
"@typescript-eslint/parser": "5.59.1",
"dotenv-cli": "7.2.1",
"eslint": "8.39.0",
"eslint-config-prettier": "8.8.0",
Expand Down
Loading

0 comments on commit 8a356fc

Please sign in to comment.