https://github.com/sboudrias/detect-conflict
Small utility library that check if a new file content can be merged safely in the on-disk existing file.
https://github.com/sboudrias/detect-conflict
Last synced: 7 months ago
JSON representation
Small utility library that check if a new file content can be merged safely in the on-disk existing file.
- Host: GitHub
- URL: https://github.com/sboudrias/detect-conflict
- Owner: SBoudrias
- License: mit
- Created: 2014-11-02T02:00:58.000Z (almost 11 years ago)
- Default Branch: main
- Last Pushed: 2025-01-31T21:20:24.000Z (8 months ago)
- Last Synced: 2025-03-10T12:53:12.448Z (7 months ago)
- Language: JavaScript
- Size: 670 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
- Security: SECURITY.md
Awesome Lists containing this project
README
detect-conflict
=================Small utility library that check if a new file content can be merged safely in the on-disk existing file.
## Usage
### Example
```js
import conflict from 'detect-conflict';const isConflicting = conflict('some-file-name.js', 'var newContent;');
```It'll return `true` if a conflict is found, `false` otherwise.
### API
#### `conflict(filepath : string, contents : Buffer | String)`
If the `contents` is passed as a string, we assume it is utf8 encoded. Pass a `Buffer` if you want to compare special encoding.
If `filepath` points to a directory, we'll always return `true`.