MCPcopy
hub / github.com/tinymce/tinymce / each

Function each

modules/tinymce/src/core/main/ts/util/ArrUtils.ts:33–59  ·  view source on GitHub ↗
(o: ArrayLike<T> | Record<string, T> | null | undefined, cb: ArrayCallback<T, void | boolean> | ObjCallback<T, void | boolean>, s?: any)

Source from the content-addressed store, hash-verified

31 <T>(arr: ArrayLike<T> | null | undefined, cb: ArrayCallback<T, void | boolean>, scope?: any): boolean;
32 <T>(obj: Record<string, T> | null | undefined, cb: ObjCallback<T, void | boolean>, scope?: any): boolean;
33} = <T>(o: ArrayLike<T> | Record<string, T> | null | undefined, cb: ArrayCallback<T, void | boolean> | ObjCallback<T, void | boolean>, s?: any): boolean => {
34 if (!o) {
35 return false;
36 }
37
38 s = s || o;
39
40 if (isArrayLike(o)) {
41 // Indexed arrays, needed for Safari
42 for (let n = 0, l = o.length; n < l; n++) {
43 if ((cb as ArrayCallback<T, void | boolean>).call(s, o[n], n, o) === false) {
44 return false;
45 }
46 }
47 } else {
48 // Hashtables
49 for (const n in o) {
50 if (Obj.has(o, n)) {
51 if ((cb as ObjCallback<T, void | boolean>).call(s, o[n], n, o) === false) {
52 return false;
53 }
54 }
55 }
56 }
57
58 return true;
59};
60
61const map: {
62 <T, R>(arr: ArrayLike<T> | null | undefined, cb: ArrayCallback<T, R>): R[];

Callers 15

mapFunction · 0.70
filterFunction · 0.70
fixLinksFunction · 0.70
getAttribsFunction · 0.50
globalEventDelegateFunction · 0.50
initEditorsFunction · 0.50
removeFunction · 0.50
EditorManager.tsFile · 0.50
saveMethod · 0.50
parseShortcutFunction · 0.50
constructorMethod · 0.50

Calls 2

isArrayLikeFunction · 0.85
hasMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…