Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Use Array.prototype.includes in tutorial #1263

Merged
merged 1 commit into from
Mar 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/tutorials/dependencies.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ schedule(async () => {

if (packageDiff.dependencies) {
const newDependencies = packageDiff.dependencies.added
if (includes(newDependencies, blacklist)) {
if (newDependencies.includes(blacklist)) {
fail(`Do not add ${blacklist} to our dependencies, see CVE #23")
}
}
Expand Down Expand Up @@ -107,12 +107,11 @@ dependency is one that comes in as a dependency of a dependency, one which isn't

```js
import fs from "fs"
import includes from "lodash.includes"

const blacklist = "spaced-between"
const lockfile = fs.readFileSync("yarn.lock").toString()

if (includes(lockfile, blacklist)) {
if (lockfile.includes(blacklist)) {
const message = `${blacklist} was added to our dependencies, see CVE #23`
const hint = `To find out what introduced it, use \`yarn why ${blacklist}\`.`
fail(`${message}<br/>${hint}`)
Expand Down