Travis build: 590 [cron]
This commit is contained in:
0
isDuplexStream.js
Normal file
0
isDuplexStream.js
Normal file
@ -2929,6 +2929,27 @@
|
||||
"hash": "660aff9a5f540384603a2ab18d24e933b37e71972bd6bbc708b7bfb77ac13a50"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "isDuplexStream",
|
||||
"type": "snippet",
|
||||
"attributes": {
|
||||
"fileName": "isDuplexStream.md",
|
||||
"text": "Checks if the given argument is a duplex (readable and writable) stream.\n\nCheck if the value is different from `null`, use `typeof` to check if a value is of type `object` and the `pipe` property is of type `function`.\nAdditionally check if the `typeof` the `_read`, `_write` and `_readableState`, `_writableState` properties are `function` and `object` respectively.",
|
||||
"codeBlocks": [
|
||||
"const isDuplexStream = val =>\n val !== null &&\n typeof val === 'object' &&\n typeof val.pipe === 'function' &&\n typeof val._read === 'function' &&\n typeof val._readableState === 'object' &&\n typeof val._write === 'function' &&\n typeof val._writableState === 'object';",
|
||||
"const Stream = require('stream');\nisDuplexStream(new Stream.Duplex()); // true"
|
||||
],
|
||||
"tags": [
|
||||
"node",
|
||||
"type",
|
||||
"intermediate"
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"archived": false,
|
||||
"hash": "b774dbb0eb7647839be1b680627c1890fa4e1dee70b1a627fc6a1c9c0e9f3415"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "isEmpty",
|
||||
"type": "snippet",
|
||||
@ -3204,6 +3225,27 @@
|
||||
"hash": "fa8bfc91bfa09eb76f7131c3cc7b890598f8a30ec9e9872f7ffd9c282d37ba72"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "isReadableStream",
|
||||
"type": "snippet",
|
||||
"attributes": {
|
||||
"fileName": "isReadableStream.md",
|
||||
"text": "Checks if the given argument is a readable stream.\n\nCheck if the value is different from `null`, use `typeof` to check if the value is of type `object` and the `pipe` property is of type `function`.\nAdditionally check if the `typeof` the `_read` and `_readableState` properties are `function` and `object` respectively.",
|
||||
"codeBlocks": [
|
||||
"const isReadableStream = val =>\n val !== null &&\n typeof val === 'object' &&\n typeof val.pipe === 'function' &&\n typeof val._read === 'function' &&\n typeof val._readableState === 'object';",
|
||||
"const fs = require('fs');\nisReadableStream(fs.createReadStream('test.txt')); // true"
|
||||
],
|
||||
"tags": [
|
||||
"node",
|
||||
"type",
|
||||
"intermediate"
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"archived": false,
|
||||
"hash": "80e8196a7d4a8b335b30d050608b3d901178ba931ce1e51b7f44a9991a53b825"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "isSameDate",
|
||||
"type": "snippet",
|
||||
@ -3245,6 +3287,27 @@
|
||||
"hash": "2dfe9101a9ab2945ffddb46ecbca0fdd5dea384683d310e8adb852ac9c51970f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "isStream",
|
||||
"type": "snippet",
|
||||
"attributes": {
|
||||
"fileName": "isStream.md",
|
||||
"text": "Checks if the given argument is a stream.\n\nCheck if the value is different from `null`, use `typeof` to check if the value is of type `object` and the `pipe` property is of type `function`.",
|
||||
"codeBlocks": [
|
||||
"const isStream = val => val !== null && typeof val === 'object' && typeof val.pipe === 'function';",
|
||||
"const fs = require('fs');\nisStream(fs.createReadStream('test.txt')); // true"
|
||||
],
|
||||
"tags": [
|
||||
"node",
|
||||
"type",
|
||||
"intermediate"
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"archived": false,
|
||||
"hash": "926ac2fcee035747468a7dd0bbb57074b33242a2b65eff839b5b4ed47c6341e3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "isString",
|
||||
"type": "snippet",
|
||||
@ -3368,6 +3431,27 @@
|
||||
"hash": "b4417a972f391836241e88587797a8cd995f32ee71fbfcfe9e590c8fa8675558"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "isWritableStream",
|
||||
"type": "snippet",
|
||||
"attributes": {
|
||||
"fileName": "isWritableStream.md",
|
||||
"text": "Checks if the given argument is a writable stream.\n\nCheck if the value is different from `null`, use `typeof` to check if the value is of type `object` and the `pipe` property is of type `function`.\nAdditionally check if the `typeof` the `_write` and `_writableState` properties are `function` and `object` respectively.",
|
||||
"codeBlocks": [
|
||||
"const isWritableStream = val =>\n val !== null &&\n typeof val === 'object' &&\n typeof val.pipe === 'function' &&\n typeof val._write === 'function' &&\n typeof val._writableState === 'object';",
|
||||
"const fs = require('fs');\nisWritableStream(fs.createWriteStream('test.txt')); // true"
|
||||
],
|
||||
"tags": [
|
||||
"node",
|
||||
"type",
|
||||
"intermediate"
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"archived": false,
|
||||
"hash": "8334e570a144bb5cb8cf971d734b15c70b0912c32c3103ff05b0c1ee60e0c353"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "join",
|
||||
"type": "snippet",
|
||||
@ -6232,7 +6316,7 @@
|
||||
"fileName": "triggerEvent.md",
|
||||
"text": "Triggers a specific event on a given element, optionally passing custom data.\n\nUse `new CustomEvent()` to create an event from the specified `eventType` and details.\nUse `el.dispatchEvent()` to trigger the newly created event on the given element.\nOmit the third argument, `detail`, if you do not want to pass custom data to the triggered event.",
|
||||
"codeBlocks": [
|
||||
"const triggerEvent = (el, eventType, detail = undefined) =>\n el.dispatchEvent(new CustomEvent(eventType, { detail: detail }));",
|
||||
"const triggerEvent = (el, eventType, detail) =>\n el.dispatchEvent(new CustomEvent(eventType, { detail }));",
|
||||
"triggerEvent(document.getElementById('myId'), 'click');\ntriggerEvent(document.getElementById('myId'), 'click', { username: 'bob' });"
|
||||
],
|
||||
"tags": [
|
||||
@ -6243,7 +6327,7 @@
|
||||
},
|
||||
"meta": {
|
||||
"archived": false,
|
||||
"hash": "0089f0db0ccfaae631ff2935a1eb7b5ff38d789255777a8f05188552a527520c"
|
||||
"hash": "f7aec80ce75a7058fe94c36ea21c4db37aa46bcf114817b2d9dc4a71c16b62ba"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -194,14 +194,14 @@
|
||||
"fileName": "isSimilar.md",
|
||||
"text": "Determines if the `pattern` matches with `str`.\n\nUse `String.toLowerCase()` to convert both strings to lowercase, then loop through `str` and determine if it contains all characters of `pattern` and in the correct order.\nAdapted from [here](https://github.com/forrestthewoods/lib_fts/blob/80f3f8c52db53428247e741b9efe2cde9667050c/code/fts_fuzzy_match.js#L18).",
|
||||
"codeBlocks": [
|
||||
"const isSimilar = (pattern, str) =>\n [...str].reduce(\n (matchIndex, char) =>\n char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase()\n ? matchIndex + 1\n : matchIndex,\n 0\n ) === pattern.length\n ? true\n : false;",
|
||||
"const isSimilar = (pattern, str) =>\n [...str].reduce(\n (matchIndex, char) =>\n char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase()\n ? matchIndex + 1\n : matchIndex,\n 0\n ) === pattern.length;",
|
||||
"isSimilar('rt','Rohit'); // true\nisSimilar('tr','Rohit'); // false"
|
||||
],
|
||||
"tags": []
|
||||
},
|
||||
"meta": {
|
||||
"archived": true,
|
||||
"hash": "570b1b21e29f3793d7c1f001958ec68a7c27b913d65e37cf5f078b1e6a839437"
|
||||
"hash": "7a3643ea48d34cc34e33f256cb41ca6a8ad1b8a8830ba2ed3e2354aea3a7bb52"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -2,7 +2,6 @@ const isDuplexStream = val =>
|
||||
val !== null &&
|
||||
typeof val === 'object' &&
|
||||
typeof val.pipe === 'function' &&
|
||||
typeof val.pipe === 'function' &&
|
||||
typeof val._read === 'function' &&
|
||||
typeof val._readableState === 'object' &&
|
||||
typeof val._write === 'function' &&
|
||||
|
||||
2473
test/testlog
2473
test/testlog
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,3 @@
|
||||
const triggerEvent = (el, eventType, detail = undefined) =>
|
||||
el.dispatchEvent(new CustomEvent(eventType, { detail: detail }));
|
||||
const triggerEvent = (el, eventType, detail) =>
|
||||
el.dispatchEvent(new CustomEvent(eventType, { detail }));
|
||||
module.exports = triggerEvent;
|
||||
|
||||
Reference in New Issue
Block a user