forked from enviPath/enviPy
Current Dev State
This commit is contained in:
12
static/js/ketcher2/node_modules/patch-text/index.js
generated
vendored
Normal file
12
static/js/ketcher2/node_modules/patch-text/index.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = function replaceCode (text, replacements) {
|
||||
var offset = 0
|
||||
return replacements.reduce(function (text, update) {
|
||||
var start = update.start + offset
|
||||
var end = update.end + offset
|
||||
var replacement = update.replacement
|
||||
offset += (replacement.length - (end - start))
|
||||
return text.slice(0, start) + replacement + text.slice(end)
|
||||
}, text)
|
||||
}
|
||||
21
static/js/ketcher2/node_modules/patch-text/license
generated
vendored
Normal file
21
static/js/ketcher2/node_modules/patch-text/license
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Ben Drucker <bvdrucker@gmail.com> (bendrucker.me)
|
||||
|
||||
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.
|
||||
65
static/js/ketcher2/node_modules/patch-text/package.json
generated
vendored
Normal file
65
static/js/ketcher2/node_modules/patch-text/package.json
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
{
|
||||
"_from": "patch-text@~1.0.2",
|
||||
"_id": "patch-text@1.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-S/NuZeUXM9bpjwz2LgkDTaoDSKw=",
|
||||
"_location": "/patch-text",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "patch-text@~1.0.2",
|
||||
"name": "patch-text",
|
||||
"escapedName": "patch-text",
|
||||
"rawSpec": "~1.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/replace-requires"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/patch-text/-/patch-text-1.0.2.tgz",
|
||||
"_shasum": "4bf36e65e51733d6e98f0cf62e09034daa0348ac",
|
||||
"_spec": "patch-text@~1.0.2",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/replace-requires",
|
||||
"author": {
|
||||
"name": "Ben Drucker",
|
||||
"email": "bvdrucker@gmail.com",
|
||||
"url": "bendrucker.me"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/bendrucker/patch-text/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Make multiple changes to a block of text by providing start and end indices and replacement text",
|
||||
"devDependencies": {
|
||||
"standard": "^4.0.0",
|
||||
"tape": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"readme.md"
|
||||
],
|
||||
"homepage": "https://github.com/bendrucker/patch-text#readme",
|
||||
"keywords": [
|
||||
"replace",
|
||||
"code",
|
||||
"index"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "patch-text",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/bendrucker/patch-text.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && tape test.js"
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
||||
60
static/js/ketcher2/node_modules/patch-text/readme.md
generated
vendored
Normal file
60
static/js/ketcher2/node_modules/patch-text/readme.md
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
# patch-text [](https://travis-ci.org/bendrucker/patch-text)
|
||||
|
||||
> Make multiple changes to a block of text by providing start and end indices and replacement text
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save patch-text
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var patch = require('patch-text');
|
||||
var text = 'Hello guys!'
|
||||
var updated = patch(text, [
|
||||
{
|
||||
start: 0,
|
||||
end: 5,
|
||||
replacement: 'Hi'
|
||||
},
|
||||
{
|
||||
start: 7,
|
||||
end: 9,
|
||||
replacement: 'al'
|
||||
}
|
||||
])
|
||||
// => 'Hi gals!'
|
||||
```
|
||||
|
||||
Your patches shouldn't overlap, but they can shrink or increase the character count and your patches will still apply to the right text.
|
||||
|
||||
## API
|
||||
|
||||
#### `patch(text, patches)` -> `string`
|
||||
|
||||
##### text
|
||||
|
||||
*Required*
|
||||
Type: `string`
|
||||
|
||||
The text to patch.
|
||||
|
||||
##### patches
|
||||
|
||||
*Required*
|
||||
Type: `array[object]`
|
||||
|
||||
The patches to apply to the text, each with:
|
||||
|
||||
* start (number)
|
||||
* end (number)
|
||||
* replacement (string)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Ben Drucker](http://bendrucker.me)
|
||||
Reference in New Issue
Block a user