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.
the-lopster
Advanced tools
Readme
A small library for manipulating json files and using them to save data.
import DB from "the-lopster";
const DB = require("the-lopster/dist/cjs").default;
let db = new DB.DB(src, value);
src - is the path to your JSON file. (A mandatory parameter, but the file does not have to exist, but if it exists, it
should contain
{}
as a minimum)
value - this is a preset, the value of which will be set in the file, but if the file already contains the data, the preference will be given to the data entered in this parameter (optional parameter)
That is, if in the file:
{
"age": 25
}
And in the code:
const db = new DB.DB("path/to/file.js", {age: 20});
Then the file will be overwritten:
{
"age": 20
}
This is a field in which the values from the file are stored, through it you can get the values of the file and also change them, but it is not recommended to change them.
Through this method, you can change the value of the file. Use exactly this method to change data.
const db = new DB.DB("path/to/file.json", {age: 20});
db.set(callback);
callback - This is a function:
db.set(function () {
this.age = 25;
})
Or:
db.set((data) => {
data.age = 25;
})
This function enables synchronization with the file in the group will automatically change this.data
if there were any
variables in the file. Calling again will disable sync.
Any data changes are automatically written to the file. If the watch
function is enabled, when changing the file, the
variables from the file will be automatically pulled up.
If you need to use other data storage methods, you can use extensions based on the DB.Extension class.
At the moment, there is support for such files as JSON
(default), INI
, YAML
, TOML
, XML
.
To use the extension there is a function .use
Example:
import DB from "the-lopster";
DB.use(DB.XML);
This is an extension class that accepts three parameters ext
, parse
, stringify
.
string
and returns an Object
Object
and returns an string
import DB from "the-lopster";
function parse(value: string): Object {
}
function stringify(value: Object): string {
}
let EXT = new DB.Extension(".ext", parse, stringify);
Using:
DB.use(EXT);
FAQs
A small library for manipulating json files and using them to save data.
The npm package the-lopster receives a total of 40 weekly downloads. As such, the-lopster popularity was classified as not popular.
We found that the-lopster 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.