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.
if-follow-package
Advanced tools
Changelog
[v3.0.0] - [2024-02-24]
Readme
if-follow-package
is aJavaScript library
that provides APIs formanaging followers and followings on GitHub
.
if-follow-package
allows you the following:
find users who are not following you back
find users who are following you back
unfollow users who are not following you back
check if a user is following you
check if you are following a user
get the exact total number of followings
get the exact total number of followers
and other follow control features
npm registry
(Preference)
npm install if-follow-package
Github Packages registry
(require authentication)
npm install @farhan7reza7/if-follow-package
Github Packages registry
:CDN
OR
for version 2.1.3
and above
Can include in page using script tag
from CDN
<script src="https://cdn.jsdelivr.net/npm/axios@1.6.7/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/if-follow-package@3.0.0/lib/index.min.js"></script>
Get any supported version script tag
Initialize:
//const ifFollow = require('@farhan7reza7/if-follow-package'); //or
const ifFollow = require('if-follow-package'); // can use any if authenticated
OR
for version 2.1.3
and above
Can include in html page using script tag
from CDN
<script src="https://cdn.jsdelivr.net/npm/axios@1.6.7/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/if-follow-package@3.0.0/lib/index.min.js"></script>
Create an instance:
const yourUsername = 'username'; // replace with your username
const yourToken = 'access-token' // replace with your access token
const followController = ifFollow(yourUsername, yourToken);
Note: For CDN based, only ifFollow function name creates an instance
See an example of using CDN based
Use Methods to manage follow:
const notFollowingBackList = followController.whoNotFollowingBack();
const followingBackList = followController.whoFollowingBack();
const isFollowingBackMessage = followController.isFollowingBack('username');
followController.unfollowNotFollowingBack('username');
followController.unfollowAllNotFollowingBack();
const isFollowerMessage = followController.isFollower('username');
const isFollowingMessage = followController.isFollowing('username');
const totalFollowersMessage = followController.totalFollowers();
const totalFollowingsMessage = followController.totalFollowings();
Get Built in codes
for using
if-follow-package any Method
on created instance(followController)
Managed Outputs (example user outputs):
isFollower(username)
// Test case: user is a follower
const result1 = followController.isFollower('farhan7reza7');
result1.then((result) => {
console.log(result); // Output: "Yes, farhan7reza7 follows you!"
});
// Test case: user is not a follower
const result2 = followController.isFollower('diff-ymd-package');
result2.then((result) => {
console.log(result); // Output: "No, diff-ymd-package does not follow you!"
});
isFollowing(username)
// Test case: user is followed
const result3 = followController.isFollowing('farhan7reza7');
result3.then((result) => {
console.log(result); // Output: "Yes, you follow farhan7reza7!"
});
// Test case: user is not followed
const result4 = followController.isFollowing('anaseem80');
result4.then((result) => {
console.log(result); // Output: "No, you do not follow anaseem80!"
});
totalFollowers()
const result5 = followController.totalFollowers();
result5.then((result) => {
console.log(result); // Output: "Your total Followers: 1657"
});
totalFollowings()
const result6 = followController.totalFollowings();
result6.then((result) => {
console.log(result); // Output: "Your total Followings: 1067`
});
whoNotFollowingBack()
const result7 = followController.whoNotFollowingBack();
result7.then((result) => {
console.log(result); // Output: ["diff-ymd-package", "Open-Sourced-Org", "username4", "usernameN"]
});
whoFollowingBack()
const result8 = followController.whoFollowingBack();
result8.then((result) => {
console.log(result); // Output: ["farhan7reza7", "username2", "username3", "usernameN"]
});
isFollowingBack(username)
// Test case: user is following back
const result9 = followController.isFollowingBack('farhan7reza7');
result9.then((result) => {
console.log(result); // Output: "Yes, farhan7reza7 following back!"
});
// Test case: user is not following back
const result10 = followController.isFollowingBack('diff-ymd-package');
result10.then((result) => {
console.log(result); // Output: "No, diff-ymd-package does not following back!"
});
unfollowNotFollowingBack(username)
// Test case: unfollow a user who is not following back
const result11 = followController.unfollowNotFollowingBack('diff-ymd-package');
//Console Output: "Unfollowed: diff-ymd-package"
// not needed to console, because internally log message, just only call
result11.then((result) => {
console.log(result); // Output: "undefined"
});
unfollowAllNotFollowingBack()
// Test case: unfollow all users who are not following back
const result12 = followController.unfollowAllNotFollowingBack();
/* Console Output: "Unfollowed: Open-Sourced-Org"
"Unfollowed: username2"
"Unfollowed: username3"
"Unfollowed: usernameN"*/
// not return anything, and internally log message, just only call
result12.then((result) => {
console.log(result); // Output: "undefined"
});
if-follow-package
IfFollow
Represents a class for managing followers and followings on GitHub.
const ifFollow = require('if-follow-package');
IfFollow
:
const followController = ifFollow(yourUsername, yourToken);
yourUsername
: Your GitHub username.
yourToken
: Your GitHub personal access token.
Returns:
An object containing functions to interact with followers and followings on Github.
Methods:
isFollower(username)
Check if a user is following you.
const isFollowerMessage = followController.isFollower('username');
username
: The username of the user you want to check.
Returns:
A message indicating if the user is following you.
isFollowing(username)
Check if you are following a user.
const isFollowingMessage = followController.isFollowing('username');
username
: The username of the user you want to check.
Returns:
A message indicating if you are following the user.
totalFollowers()
Get the total number of followers.
const totalFollowersMessage = followController.totalFollowers();
Returns:
A message with the total number of followers.
totalFollowings()
Get the total number of followings.
const totalFollowingsMessage = followController.totalFollowings();
Returns:
A message with the total number of followings.
whoNotFollowingBack()
Get a list of users who are not following you back.
const notFollowingBackList = followController.whoNotFollowingBack();
Returns:
An array of usernames who are not following you back.
whoFollowingBack()
Get a list of users who are following you back.
const followingBackList = followController.whoFollowingBack();
Returns:
An array of usernames who are following you back.
isFollowingBack(username)
Check if a specific user is following you back.
const isFollowingBackMessage = followController.isFollowingBack('username');
username
: The username of the user you want to check.
Returns:
A message indicating if the user is following you back.
unfollowNotFollowingBack(username)
Unfollow a user who is not following you back.
followController.unfollowNotFollowingBack('username');
username
: The username of the user you want to unfollow.
Returns:
{Promise} A promise that resolves once the user is unfollowed.
Special case: It outputs message in console/terminal indicating which user unfollowed
unfollowAllNotFollowingBack()
Unfollow all users who are not following you back.
followController.unfollowAllNotFollowingBack();
Returns:
{Promise} A promise that resolves once all users are unfollowed.
Special case: It outputs messages in console/terminal indicating which users unfollowed
For more information:
See if-follow-package Documentation
If you find any issues or have suggestions for improvement, please open an issue or create a pull request on the GitHub repository.
See CONTRIBUTING guidelines for more information.
See mdn guidelines for more information.
This project is licensed under the MIT License - see the LICENSE file for details.
For more details about what has changed in each version of this project.
FAQs
if-follow-package is a JavaScript library that provides APIs for managing followers and followings on GitHub. This package allows you to find users who are not following you back, find users who are following you back, unfollow users who are not following
The npm package if-follow-package receives a total of 9 weekly downloads. As such, if-follow-package popularity was classified as not popular.
We found that if-follow-package demonstrated a healthy version release cadence and project activity because the last version was released less than 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.