MCPcopy
hub / github.com/dresende/node-orm2 / saveNext

Function saveNext

lib/ChainInstance.js:61–79  ·  view source on GitHub ↗
(i)

Source from the content-addressed store, hash-verified

59 }),
60 save: promise(function (cb) {
61 var saveNext = function (i) {
62 if (i >= instances.length) {
63 if (typeof cb === "function") {
64 cb();
65 }
66 return next();
67 }
68
69 return instances[i].save(function (err) {
70 if (err) {
71 if (typeof cb === "function") {
72 cb(err);
73 }
74 return next();
75 }
76
77 return saveNext(i + 1);
78 });
79 };
80
81 return saveNext(0);
82 })

Callers 1

ChainInstanceFunction · 0.85

Calls 3

cbFunction · 0.85
nextFunction · 0.70
saveMethod · 0.65

Tested by

no test coverage detected