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.
call-id
Advanced tools
Readme
Get the location from where you're called from; a minimalist approach.
Supports both V8 (Chrome, Edge, Opera, NodeJS) and SpiderMonkey (FireFox).
Install with npm or yarn:
npm i call-id
# OR
yarn add call-id
This package comes with its TypeScript type declarations included.
// file.js
import { getCallId } from 'call-id';
function it(title, fn) {
const { file, line, column } = getCallId();
// file: file.js, line: 9, column: 0
}
it('should work', () => {}); // <-- this is line 9
The getCallId
function is available in 3 ways:
import { getCallId } from 'call-id'
const { getCallId } = require('call-id')
<script src="node_modules/call-id/dist/browser/index.js">
and use const { getCallId } = window.callId;
Test frameworks might be interested in where you're tests get declared. They can provide a richer user experience. For example, point you to the exact location where your failing tests can be found.
getCallId(distance: number = 1): CallId | null
Gets the location from where you're called. This returns null
if the provided distance
exceeds the call stack, or couldn't be found otherwise.
You can provide a distance
(default is 1
) of larger then 1
if you want to go even further back on the call stack. Use 0
to receive the exact location from where you called getCallId
.
A CallId
object is returned from getCallId
.
/**
* Represents a call location
*/
interface CallId {
/**
* The file name or URL of the call location.
*/
file: string;
/**
* The column number of the call location (or `0` if couldn't be determined).
*/
column: number;
/**
* The line number of the call location (starts at `1`)
*/
line: number;
}
FAQs
📞 Get the location from where you're called from.
The npm package call-id receives a total of 2 weekly downloads. As such, call-id popularity was classified as not popular.
We found that call-id 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.