New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

js-core-data

Package Overview
Dependencies
Maintainers
1
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-core-data - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

15

lib/ManagedObject.js

@@ -49,2 +49,17 @@ // Generated by CoffeeScript 1.6.3

ManagedObject.prototype.setValues = function(values) {
var attributeDescription, _i, _len, _ref, _results;
_ref = this.entity.attributes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
attributeDescription = _ref[_i];
if (values[attributeDescription.name] != null) {
_results.push(this[attributeDescription.name] = values[attributeDescription.name]);
} else {
_results.push(void 0);
}
}
return _results;
};
ManagedObject.addAttributeDescription = function(attributeDescription) {

@@ -51,0 +66,0 @@ var capitalizedName;

2

package.json
{
"name": "js-core-data",
"description": "ORM inspired by Apple's Objective-C CoreData",
"version": "0.0.5",
"version": "0.0.6",
"dependencies":{

@@ -6,0 +6,0 @@ "moment":"x",

@@ -92,2 +92,38 @@ var assert = require("assert"),

})
it('should create object and assign all valid values from object',function(done){
var context = new ManagedObjectContext(storeCoordinator)
var obj = context.createObjectWithName('Hello')
assert.doesNotThrow(function(){
obj.setValues({
bool:true,
name:'test',
int:1600,
decim: 0.55,
float: 10.505,
double: 100.5054,
email:'jackie@gmail.com',
url:'http://www.google.com',
timestamp: timestamp
})
})
context.save(done);
})
it('should load all attributes',function(done){
var context = new ManagedObjectContext(storeCoordinator)
context.getObjects('Hello',null,null,function(err,objects){
if(err)return done(err);
var obj = objects[0];
assert.strictEqual(obj.bool,true);
assert.strictEqual(obj.name,'test');
assert.strictEqual(obj.int,1600);
assert.strictEqual(obj.decim,0.55);
assert.strictEqual(obj.float,10.505);
assert.strictEqual(obj.double,100.5054);
assert.strictEqual(obj.email,'jackie@gmail.com');
assert.strictEqual(obj.url,'http://www.google.com');
assert.equal(obj.date.toISOString(),date.toISOString())
assert.equal(obj.timestamp,timestamp)
done();
})
})
it('shouldn\'t assign (in)valid date value',function(){

@@ -132,3 +168,3 @@ var context = new ManagedObjectContext(storeCoordinator)

})
it('shouldn pass invalid string',function(){
it('shouldn\'t pass invalid string',function(){
var context = new ManagedObjectContext(storeCoordinator)

@@ -172,2 +208,5 @@ var obj = context.createObjectWithName('Hello')

})
assert.throws(function(){
obj.setValues({url:'sfgsg://www.google.com/aadfsdg'});
})
assert.doesNotThrow(function(){

@@ -186,2 +225,5 @@ obj.url = 'http://www.google.com';

assert.doesNotThrow(function(){
obj.setValues({url:'ftp://www.google.com/test/com.abcd?testmy&arg2=a'});
})
assert.doesNotThrow(function(){
obj.url = 'http://john:doe@www.google.com';

@@ -206,2 +248,5 @@ })

})
assert.throws(function(){
obj.setValues({email:'john@doe.'});
})
assert.doesNotThrow(function(){

@@ -250,2 +295,5 @@ obj.email = 'john@doe.com';

})
assert.throws(function(){
obj.setValues({int:'25.689'});
})
assert.doesNotThrow(function(){

@@ -270,2 +318,5 @@ obj.int = 25;

})
assert.throws(function(){
obj.setValues({bool:'my false'});
})
assert.doesNotThrow(function(){

@@ -272,0 +323,0 @@ obj.bool = true;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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