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

ant-ai

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ant-ai - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

57

index.js

@@ -39,1 +39,58 @@ export function setValueToState(params) {

}
const parsePath = function(path) {
if (typeof path !== "string") return path;
let paths = path
.replace(/\[/g, ".")
.replace(/\]/g, ".")
.split(".");
return paths;
};
class Jter {
constructor(ins) {
this.ins = ins;
}
get(path) {
const paths = Array.isArray(path) ? path : parsePath(path);
try {
let value = this.ins;
paths.forEach(item => {
value = value[item];
});
return value;
} catch (e) {
return undefined;
}
}
getJ(path) {
const value = this.get(path);
return new Jter(value);
}
set(path, val) {
if (typeof this.ins !== "object") return false;
const paths = parsePath(path);
let value = this.ins;
const lastKey = paths.pop();
paths.forEach(item => {
if (!value[item]) value[item] = {};
value = value[item];
});
value[lastKey] = val;
return true;
}
delete(path) {
const paths = parsePath(path);
const lastKey = paths.pop();
const target = this.get(paths);
if (typeof target === "object" && target[lastKey] !== undefined)
delete target[lastKey];
}
value() {
return this.ins;
}
}
export function jter(ins) {
return new Jter(ins);
}

2

package.json
{
"name": "ant-ai",
"version": "1.0.0",
"version": "1.0.1",
"description": "Common tools for AI-FE.",

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

@@ -6,1 +6,3 @@ ## functions

#### asyncClass
#### jter
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