Skip to content

Commit

Permalink
Disable lint
Browse files Browse the repository at this point in the history
  • Loading branch information
shoonia committed Jul 24, 2023
1 parent f3b3844 commit a2e0026
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 84 deletions.
64 changes: 22 additions & 42 deletions dist/index.cjs
Original file line number Diff line number Diff line change
@@ -1,72 +1,52 @@
'use strict';

var createScope = function createScope(getData) {
return function (event) {
var ctx = event.context;

var find = function find(i) {
return i._id === ctx.itemId;
};

return {
$item: $w.at(ctx),

get itemData() {
return getData().find(find);
},

get index() {
return getData().findIndex(find);
},

get data() {
return getData();
}

};
const createScope = getData => event => {
const ctx = event.context;
const find = i => i._id === ctx.itemId;
return {
$item: $w.at(ctx),
get itemData() {
return getData().find(find);
},
get index() {
return getData().findIndex(find);
},
get data() {
return getData();
}
};
};

var getRepeater = function getRepeater(event) {
var node = event.target;

const getRepeater = event => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let node = event.target;
if (event.context.type !== 'COMPONENT_SCOPE') {
console.error("repeater-scope: \"#" + node.id + "\" outside of any $w.Repeater context");
console.error(`repeater-scope: "#${node.id}" outside of any $w.Repeater context`);
}

while ((node = node.parent).type !== '$w.Repeater') {
/**/
}

return node;
};

var useScope = function useScope(event) {
var ctx = event.context;

var find = function find(i) {
return i._id === ctx.itemId;
};

const useScope = event => {
const ctx = event.context;
const find = i => i._id === ctx.itemId;
return {
$item: $w.at(ctx),

get itemData() {
return getRepeater(event).data.find(find);
},

get index() {
return getRepeater(event).data.findIndex(find);
},

get data() {
return getRepeater(event).data;
}

};
};

var updateItem = function updateItem(event, callback) {
const updateItem = (event, callback) => {
getRepeater(event).forItems([event.context.itemId], callback);
};

Expand Down
64 changes: 22 additions & 42 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,50 @@
var createScope = function createScope(getData) {
return function (event) {
var ctx = event.context;

var find = function find(i) {
return i._id === ctx.itemId;
};

return {
$item: $w.at(ctx),

get itemData() {
return getData().find(find);
},

get index() {
return getData().findIndex(find);
},

get data() {
return getData();
}

};
const createScope = getData => event => {
const ctx = event.context;
const find = i => i._id === ctx.itemId;
return {
$item: $w.at(ctx),
get itemData() {
return getData().find(find);
},
get index() {
return getData().findIndex(find);
},
get data() {
return getData();
}
};
};

var getRepeater = function getRepeater(event) {
var node = event.target;

const getRepeater = event => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let node = event.target;
if (event.context.type !== 'COMPONENT_SCOPE') {
console.error("repeater-scope: \"#" + node.id + "\" outside of any $w.Repeater context");
console.error(`repeater-scope: "#${node.id}" outside of any $w.Repeater context`);
}

while ((node = node.parent).type !== '$w.Repeater') {
/**/
}

return node;
};

var useScope = function useScope(event) {
var ctx = event.context;

var find = function find(i) {
return i._id === ctx.itemId;
};

const useScope = event => {
const ctx = event.context;
const find = i => i._id === ctx.itemId;
return {
$item: $w.at(ctx),

get itemData() {
return getRepeater(event).data.find(find);
},

get index() {
return getRepeater(event).data.findIndex(find);
},

get data() {
return getRepeater(event).data;
}

};
};

var updateItem = function updateItem(event, callback) {
const updateItem = (event, callback) => {
getRepeater(event).forItems([event.context.itemId], callback);
};

Expand Down
1 change: 1 addition & 0 deletions src/getRepeater.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const getRepeater = (event: $w.Event): $w.Repeater => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let node: any = event.target;

if (event.context.type !== 'COMPONENT_SCOPE') {
Expand Down

0 comments on commit a2e0026

Please sign in to comment.