
Security News
Insecure Agents Podcast: How to Keep AI Agents From Bypassing Security Controls
Socket CTO Ahmad Nassri discusses how to keep AI agents from bypassing package blocks, limit credential access, and monitor their actions.
Continu is a powerful tool for managing key-value pairs in an application. Its simple and lightweight design makes it easy to use. Besides, defining default values it is also possible to execute transformations & validations before setting any value.
Table of Contents
npm install continu --save
On the basic level, this library can be used as container for arbitrary key value pairs.
import { Continu } from 'continu';
type Options = {
foo: string
}
const continu = new Continu<Options>();
console.log(continu.has('foo'));
// false
console.log(continu.get('foo'));
// undefined
continu.set('foo', 'bar');
console.log(continu.has('foo'));
// true
console.log(continu.get('foo'));
// bar
continu.reset('foo');
console.log(continu.has('foo'));
// false
It is also possible to define default values which are returned if a given value is not set.
import { Continu } from 'continu';
type Options = {
foo: string
}
const continu = new Continu<Options>({
defaults: {
foo: 'bar'
}
});
console.log(continu.has('foo'));
// false
console.log(continu.get('foo'));
// 'bar'
continu.set('foo', 'baz');
console.log(continu.has('foo'));
// true
console.log(continu.get('foo'));
// 'baz'
Transformers can be used to accept multiple input formats.
The data can than be converted to the appropriate format before setting.
Therefore, the setRaw method must be used.
import { Continu } from 'continu';
type Options = {
foo: string
}
const continu = new Continu<Options>({
transformers: {
foo: (value) => {
if(typeof value === 'number') {
return `${value}`;
}
if(typeof value === 'string') {
return value;
}
throw new Error('Option could not be transformed.')
}
}
});
continu.set('foo', '123');
console.log(continu.get('foo'));
// '123'
continu.set('foo', 456);
console.log(continu.get('foo'));
// '456'
continu.set('foo', {bar: 'baz'});
// this statement will throw an error!
Validators can be useful for defining constraints and prevent values from being set, if they don't match specific criteria.
import { Continu } from 'continu';
type Options = {
foo: string
}
const continu = new Continu<Options>({
validators: {
foo: (value) => typeof value === 'string' && value.length > 3,
}
});
continu.set('foo', 'bar');
console.log(continu.get('foo'));
// undefined
continu.set('foo', 'bar-baz');
console.log(continu.get('foo'));
// 'bar-baz'
When using nested object types, it is also possible to use key paths (separated by .) to
access properties in depth.
import { Continu } from 'continu';
type Options = {
nested: {
foo: string
}
}
const continu = new Continu<Options>();
console.log(continu.has('nested.foo'));
// false
console.log(continu.get('nested.foo'));
// undefined
continu.set('nested.foo', 'bar');
console.log(continu.has('nested.foo'));
// true
console.log(continu.get('nested.foo'));
// 'bar'
console.log(continu.has('nested'));
// true;
console.log(continu.get('nested'));
// { foo: 'bar' }
Before starting to work on a pull request, it is important to review the guidelines for contributing and the code of conduct. These guidelines will help to ensure that contributions are made effectively and are accepted.
Made with 💚
Published under MIT License.
FAQs
Zero dependency container/config library.
The npm package continu receives a total of 16 weekly downloads. As such, continu popularity was classified as not popular.
We found that continu 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.

Security News
Socket CTO Ahmad Nassri discusses how to keep AI agents from bypassing package blocks, limit credential access, and monitor their actions.

Security News
GPT-6 Astra tried to plant malicious code in simulated open source projects using fake GitHub accounts and deceptive PRs during an assigned CTF challenge.

Security News
upm uses Node.js to deliver fast npm installs in about 250 KB, with a JavaScript API and security defaults.