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

@cicada/render

Package Overview
Dependencies
Maintainers
6
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cicada/render - npm Package Compare versions

Comparing version 1.1.16-alpha to 1.1.16-alpha2

8

lib/__test__/statePath.test.js

@@ -12,6 +12,10 @@ 'use strict';

expect(statePath('repeat.items.0').relativeBind().toString()).toEqual('repeat.items.0');
expect(statePath('repeat.items.0.INNER-xxx-xxx.Col(_2)').relativeBind().toString()).toEqual('repeat.items.0');
});
it('statePath.index', function () {
expect(statePath('repeat.items.0.Col(_2).abc').index()).toEqual(0);
expect(statePath('repeat.items.0').index()).toEqual(0);
expect(statePath('repeat.items.9.Col(_2).1.abc.2').index()).toEqual(2);
expect(statePath('repeat.items.9.Col(_2).1.abc.2').index(1)).toEqual(1);
expect(statePath('repeat.items.9.Col(_2).1.abc.2').index(2)).toEqual(9);
expect(statePath('repeat.items.9.Col(_2).1.abc.2').index(3)).toEqual(9);
expect(statePath('repeat.items.9').index()).toEqual(9);
});

@@ -57,5 +57,12 @@ 'use strict';

function remove(inputStatePath) {
var result = _exist2.default.remove(store, inputStatePath);
listeners.notify(inputStatePath);
return result;
}
return {
set: set,
get: get,
remove: remove,
merge: (0, _util.partialRight)(set, true),

@@ -62,0 +69,0 @@ collect: collector.collect,

@@ -128,5 +128,7 @@ 'use strict';

var arr = this.toString().split('.');
// 这里用括号判断是不是引擎生成的bind
while (arr[arr.length - 1] !== undefined && /[()]/.test(arr[arr.length - 1])) {
var lastBind = arr[arr.length - 1];
// 这里用括号判断是不是引擎生成的bind, 用INNER判断是不是自动化测试生成的bind
while (lastBind !== undefined && (/[()]/.test(lastBind) || /^INNER/.test(lastBind))) {
arr.pop();
lastBind = arr[arr.length - 1];
}

@@ -140,9 +142,20 @@ return new StatePath(arr.join('.'));

value: function index() {
var arr = this.toString().split('.');
var i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var arr = this.toString().split('.').filter(function (k) {
return !(/[()]/.test(k) || /^INNER/.test(k));
});
var lastBind = arr[arr.length - 1];
var lastIndex = 0;
// 这里寻找最接近的索引
while (arr[arr.length - 1] !== undefined) {
if (/^[0-9]+$/.test(arr[arr.length - 1])) return Number(arr[arr.length - 1]);
while (lastBind !== undefined) {
if (/^[0-9]+$/.test(lastBind)) {
if (i <= 0) return Number(lastBind);
lastIndex = Number(lastBind);
i--;
}
arr.pop();
lastBind = arr[arr.length - 1];
}
return 0;
return lastIndex;
}

@@ -149,0 +162,0 @@ }, {

{
"name": "@cicada/render",
"version": "1.1.16-alpha",
"version": "1.1.16-alpha2",
"main": "./lib/index.js",

@@ -5,0 +5,0 @@ "scripts": {

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