Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
word-detect.js
Advanced tools
Readme
A (super) small library for intelligently detecting words in strings.
NOTE: none of these functions are case sensitive. Also, this library currently only works in English.
Install with:
npm i word-detect.js
word-detect has three main functions:
includesWord()
includesAllWords()
includesAnyWords()
includesWord()
includesWord()
searches for a word inside of a string. If the word is inside of another word (e.g. Rat inside of Crate),
it will be ignored.
The function takes in 2 parameters; The string, and the word to be searched for.
const wordDetect = require('word-detect.js');
// This will return true:
wordDetect.includesWord('Hello World!', "hello");
// Even though 'hell' is inside 'hello', this will still return false:
wordDetect.includesWord('Hello World!', "hell");
includesAllWords()
includesAllWords
searches for an array of words inside of a string. If the words are inside of other words (e.g. Ten inside of Tent),
it will be ignored.
The function takes in 2 parameters; the string, and an array of words to be searched for.
const wordDetect = require('word-detect.js');
// This will return true:
wordDetect.includesAllWords('Gavin waited for the train', ['gavin', 'waited']);
// This will return false, because the string only contains one of the words:
wordDetect.includesAllWords('Gavin waited for the train', ['wait', 'the']);
includesAnyWords()
includesAnyWords()
searches for any of the words in an array, inside of a string. If the words are inside of other words (e.g. Owl inside of Bowl),
it will be ignored.
The function takes in 2 parameters; the string, and an array of words to be searched for.
const wordDetect = require('word-detect.js');
// This will return true:
wordDetect.includesAnyWords('Where do you live?', ['how', 'do', 'you']);
// This will return false:
wordDetect.includesAnyWords('Where do you live?', ['what', 'your', 'name']);
FAQs
A (super) small library for intelligently detecting words in strings.
The npm package word-detect.js receives a total of 1 weekly downloads. As such, word-detect.js popularity was classified as not popular.
We found that word-detect.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.