Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

utilium

Package Overview
Dependencies
Maintainers
0
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utilium - npm Package Compare versions

Comparing version 0.8.2 to 0.8.3

4

dist/dom.d.ts

@@ -10,1 +10,5 @@ /**

export declare function download(data: BlobPart, name: string): void;
/**
* Create an instance of a `<template>`
*/
export declare function cloneTemplate(selector: string): DocumentFragment;

@@ -30,1 +30,11 @@ /* eslint-disable @typescript-eslint/no-unused-expressions */

}
/**
* Create an instance of a `<template>`
*/
export function cloneTemplate(selector) {
const template = document.querySelector(selector);
if (!template) {
throw new ReferenceError('Template does not exist: ' + selector);
}
return template.content.cloneNode(true);
}

@@ -23,1 +23,3 @@ import type { UnionToTuple } from './types.js';

export declare function map<const T extends Partial<Record<any, any>>>(items: T): Map<keyof T, T[keyof T]>;
export declare function getByString(object: Record<string, any>, path: string, separator?: RegExp): Record<string, any>;
export declare function setByString(object: Record<string, any>, path: string, value: unknown, separator?: RegExp): Record<string, any>;

@@ -47,1 +47,13 @@ export function filterObject(object, predicate) {

}
export function getByString(object, path, separator = /[.[\]'"]/) {
return path
.split(separator)
.filter(p => p)
.reduce((o, p) => o?.[p], object);
}
export function setByString(object, path, value, separator = /[.[\]'"]/) {
return path
.split(separator)
.filter(p => p)
.reduce((o, p, i) => (o[p] = path.split(separator).filter(p => p).length === ++i ? value : o[p] || {}), object);
}

2

dist/shell.d.ts

@@ -37,2 +37,2 @@ import type { Terminal } from '@xterm/xterm';

*/
export declare function createShell({ terminal, prompt, onLine }: ShellOptions): ShellContext;
export declare function createShell(options: ShellOptions): ShellContext;

@@ -67,7 +67,9 @@ function handleData($, data) {

*/
export function createShell({ terminal, prompt = '', onLine = () => { } }) {
export function createShell(options) {
const context = {
terminal,
prompt,
onLine,
terminal: options.terminal,
get prompt() {
return options.prompt ?? '';
},
onLine: options.onLine ?? (() => { }),
input: '',

@@ -78,4 +80,4 @@ index: -1,

};
terminal.onData(data => handleData(context, data));
options.terminal.onData(data => handleData(context, data));
return context;
}
{
"name": "utilium",
"version": "0.8.2",
"version": "0.8.3",
"description": "Typescript utilities",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -33,1 +33,12 @@ /* eslint-disable @typescript-eslint/no-unused-expressions */

}
/**
* Create an instance of a `<template>`
*/
export function cloneTemplate(selector: string): DocumentFragment {
const template = document.querySelector<HTMLTemplateElement>(selector);
if (!template) {
throw new ReferenceError('Template does not exist: ' + selector);
}
return template.content.cloneNode(true) as DocumentFragment;
}

@@ -67,1 +67,15 @@ import type { UnionToTuple } from './types.js';

}
export function getByString(object: Record<string, any>, path: string, separator = /[.[\]'"]/) {
return path
.split(separator)
.filter(p => p)
.reduce((o, p) => o?.[p], object);
}
export function setByString(object: Record<string, any>, path: string, value: unknown, separator = /[.[\]'"]/) {
return path
.split(separator)
.filter(p => p)
.reduce((o, p, i) => (o[p] = path.split(separator).filter(p => p).length === ++i ? value : o[p] || {}), object);
}

@@ -111,7 +111,9 @@ /* A simple wrapper for xterm.js that makes implementing shells easier */

*/
export function createShell({ terminal, prompt = '', onLine = () => {} }: ShellOptions): ShellContext {
export function createShell(options: ShellOptions): ShellContext {
const context: ShellContext = {
terminal,
prompt,
onLine,
terminal: options.terminal,
get prompt() {
return options.prompt ?? '';
},
onLine: options.onLine ?? (() => {}),
input: '',

@@ -122,4 +124,4 @@ index: -1,

};
terminal.onData(data => handleData(context, data));
options.terminal.onData(data => handleData(context, data));
return context;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc