forked from enviPath/enviPy
Current Dev State
This commit is contained in:
19
static/js/ketcher2/node_modules/from2-string/index.js
generated
vendored
Normal file
19
static/js/ketcher2/node_modules/from2-string/index.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
const assert = require('assert')
|
||||
const from = require('from2')
|
||||
|
||||
module.exports = fromString
|
||||
|
||||
// create a stream from a string
|
||||
// str -> stream
|
||||
function fromString (string) {
|
||||
assert.equal(typeof string, 'string')
|
||||
|
||||
return from(function (size, next) {
|
||||
if (string.length <= 0) return this.push(null)
|
||||
|
||||
const chunk = string.slice(0, size)
|
||||
string = string.slice(size)
|
||||
|
||||
next(null, chunk)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user