detect-conflict

Small utility library that check if a new file content can be merged safely in the on-disk existing file.

MIT 2 个版本
安装
npm install detect-conflict
yarn add detect-conflict
pnpm add detect-conflict
bun add detect-conflict
README

detect-conflict Build Status

Small utility library that check if a new file content can be merged safely in the on-disk existing file.

Usage

Example

var conflict = require('detect-conflict');

var 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.

版本列表
1.0.1 2016-07-04
1.0.0 2014-11-02