pd-redis-childize
Advanced tools
Comparing version 0.1.0 to 0.1.1
19
index.js
'use strict'; | ||
var extRemove = require('./lib/extends-remove'); | ||
var extAbandon = require('./lib/extends-abandon'); | ||
var phNm = require('pd-redis-record-parenthood-nm'); | ||
module.exports = function (Child, Parent) { | ||
if (!Child.isRedisModel || Child.childized) { | ||
var flagName = 'isKidOf' + Parent.modelName(); | ||
if (!Child.isRedisModel || Child[flagName]) { | ||
return; | ||
} | ||
extRemove(Child, Parent); | ||
Child.childized = true; | ||
extAbandon(Child, Parent); | ||
Child[Parent.modelName() + 'Kid'] = function (childSid) { | ||
var cSid = (childSid + '').trim(); | ||
return { | ||
abandon: function (parentSid) { | ||
var abandonName = phNm.abandon(Parent.modelName()); | ||
return Child[abandonName](cSid, parentSid); | ||
} | ||
}; | ||
}; | ||
Child[flagName] = true; | ||
}; |
{ | ||
"name": "pd-redis-childize", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "To make a record model relate to its parent record model", | ||
@@ -27,5 +27,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"pd-redis-record-parenthood-nm": "^0.1.0", | ||
"humanize-plus": "^1.5.0", | ||
"pd-redis-record-parenthood-nm": "^0.1.1", | ||
"q": "^1.2.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10056
9
206
3
+ Addedhumanize-plus@^1.5.0