![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
periscopic
Advanced tools
The 'periscopic' npm package is primarily used for calculating the potential life expectancy of individuals based on statistical data. It provides a way to estimate how many years of life are lost due to premature death, which can be a powerful tool for research and analysis in public health and social sciences.
Calculate Life Expectancy Loss
This feature allows the calculation of lost years of life by providing the age at death and the average life expectancy for the gender. The code sample demonstrates how to use the package to estimate how many years a male who died at age 47 has lost, given the average life expectancy.
const periscopic = require('periscopic');
const lifeExpectancyData = { male: 76, female: 81 };
const person = { gender: 'male', ageAtDeath: 47 };
const yearsLost = periscopic(person, lifeExpectancyData);
console.log(yearsLost);
Similar to 'periscopic', this package provides tools for calculating life expectancy and potential years lost. However, it might offer different methodologies or additional demographic factors for more detailed analysis.
Utility for analyzing scopes belonging to an ESTree-compliant AST.
import { analyze } from 'periscopic';
const ast = acorn.parse(`
const a = b;
console.log(a);
`);
const { map, globals, scope } = analyze(ast);
map
is a WeakMap<Node, Scope>
, where the keys are the nodes of your AST that create a scopeglobals
is a Map<string, Node>
of all the identifiers that are referenced without being declared anywhere in the program (in this case, b
and console
)scope
is the top-level Scope
belonging to the programEach Scope
instance has the following properties:
scope.block
— true if the scope is created by a block statement (i.e. let
, const
and class
are contained to it), false otherwisescope.parent
— the parent scope objectscope.declarations
— a Map<string, Node>
of all the variables declared in this scope, the node value referes to the declaration statementscope.initialised_declarations
— a Set<string>
of all the variables declared and initialised in this scopescope.references
— a Set<string>
of all the names referenced in this scope (or child scopes)It also has two methods:
scope.has(name)
— returns true
if name
is declared in this scope or an ancestor scopescope.find_owner(name)
— returns the scope object in which name
is declared (or null
if it is not declared)extract_identifiers
and extract_names
This package also exposes utilities for extracting the identifiers contained in a declaration or a function parameter:
import { extract_identifiers, extract_names } from 'periscopic';
const ast = acorn.parse(`
const { a, b: [c, d] = e } = opts;
`);
const lhs = ast.body[0].declarations[0].id;
extract_identifiers(lhs);
/*
[
{ type: 'Identifier', name: 'a', start: 9, end: 10 },
{ type: 'Identifier', name: 'c', start: 16, end: 17 },
{ type: 'Identifier', name: 'd', start: 19, end: 20 }
]
*/
extract_names(lhs);
/*
['a', 'c', 'd']
*/
4.0.2
FAQs
periscopic
The npm package periscopic receives a total of 1,656,161 weekly downloads. As such, periscopic popularity was classified as popular.
We found that periscopic 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.