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

divhide

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

divhide - npm Package Compare versions

Comparing version 1.0.6 to 2.0.0

.coveralls.yml

2

.readme/badges/travis.md

@@ -1,1 +0,1 @@

[![Build Status](https://travis-ci.org/divhide/divhide-core.png?branch=master)](https://travis-ci.org/divhide/divhide-core)
[![Build Status](https://travis-ci.org/divhide/node-divhide.png?branch=master)](https://travis-ci.org/divhide/node-divhide)

@@ -9,6 +9,5 @@

# open http://localhost:8585/test/ to run the tests on your browser
grunt
grunt dev
```

@@ -28,6 +27,4 @@

grunt build
grunt
```

@@ -40,6 +37,6 @@

# change the package.json, bower.json pre-release version (v1.0.0-1)
grunt pre-release
grunt bump:prerelease
# change the package.json, bower.json minor version (v1.0.1)
grunt patch
grunt bump:patch

@@ -46,0 +43,0 @@ # Publish current version to npm and bower

@@ -13,3 +13,3 @@

var value = schema.value(3);
expect(value).toBe(3)
expect(value).toBe(3);

@@ -16,0 +16,0 @@

@@ -12,3 +12,3 @@

/// every other object key is optional
"/.*/": Schema.string().optional()
"/.*/": Schema.number().optional()

@@ -19,14 +19,12 @@ }).required();

/// apply the schema to the value
var value = schema.value(
{
data: [ 1, 2, 3, 4, 5 , 6],
timestamp: "1404373579473"
});
var value = schema.value({
data: [ 1, 2, 3, 4, 5, 6],
timestamp: "1404373579473"
});
/// test the value
expect(value).equals(
{
data: [ '1', '2', '3', '4', '5' , '6'],
timestamp: "1404373579473"
});
expect(value).equals({
data: [ '1', '2', '3', '4', '5' , '6'],
timestamp: 1404373579473
});

@@ -22,3 +22,3 @@

})
.toThrow(new Error("Value is required."));
.toThrowError("Value is required., The minimum value allowed is 3.");

@@ -25,0 +25,0 @@

@@ -63,1 +63,4 @@

expect(isEmpty).toBe(true);
var isString = Type.instanceOf("string", String);
expect(isString).toBe(true);
# [![Divhide](http://blog.divhide.com/assets/images/divhide_128px.png)](http://divhide.com/) divhide-core
{%= _.badge("travis") %} {%= _.badge("fury") %} {%= _.badge("gemnasium") %}
{%= _.badge("travis") %} {%= _.badge("coveralls") %} {%= _.badge("fury") %} {%= _.badge("gemnasium") %}

@@ -58,3 +58,2 @@ {%= _.badge("nodeio") %} ![alt text](https://raw.githubusercontent.com/divhide/divhide-core/master/.readme/assets/bower-logo.jpg) ![alt text](https://raw.githubusercontent.com/divhide/divhide-core/master/.readme/assets/titanium-logo.png)

## Contribute

@@ -61,0 +60,0 @@ {%= _.include("Contribute.md") %}

@@ -6,3 +6,3 @@ {

"license": "MIT",
"version": "1.0.6",
"version": "2.0.0",

@@ -9,0 +9,0 @@ "authors": [

{
"name": "divhide",
"description": "Divhide javascript core components for NodeJs, Browser, Titanium, ... and everything that runs javascript.",
"version": "1.0.6",
"version": "2.0.0",
"author": {

@@ -9,2 +9,3 @@ "name": "Oscar Brito <aetheon@gmail.com>",

},
"keywords": [

@@ -29,9 +30,10 @@ "divhide",

"devDependencies": {
"browserify": "8.1.0",
"browserify": "9.0.7",
"browserify-istanbul": "^0.2.1",
"expect.js": "^0.3.1",
"grunt": "~0.4.5",
"grunt-browserify": "~3.2.1",
"grunt-browserify": "=3.8.0",
"grunt-bump": "0.0.16",
"grunt-cli": "",
"grunt-contrib-jasmine": ">=0.6.3",
"grunt-contrib-jasmine": "*",
"grunt-contrib-jshint": "*",

@@ -41,8 +43,17 @@ "grunt-contrib-watch": "*",

"grunt-http-server": "*",
"grunt-karma": "^0.11.1",
"grunt-karma-coveralls": "^2.5.3",
"grunt-readme": "0.4.5",
"grunt-simple-mocha": ">=0.4.0",
"load-grunt-tasks": "3.0.0"
"karma": "^0.12.37",
"karma-chrome-launcher": "^0.2.0",
"karma-coverage": "^0.4.2",
"karma-jasmine": "^0.3.5",
"karma-phantomjs-launcher": "^0.2.0",
"karma-threshold-reporter": "^0.1.15",
"load-grunt-tasks": "3.0.0",
"phantomjs": "^1.9.17"
},
"dependencies": {
"lodash": "2.4.1"
"lodash": "=3.9.3"
},

@@ -54,4 +65,4 @@ "main": "src/Index.js",

"scripts": {
"test": "grunt travis --verbose"
"test": "grunt --verbose"
}
}
# [![Divhide](http://blog.divhide.com/assets/images/divhide_128px.png)](http://divhide.com/) divhide-core
[![Build Status](https://travis-ci.org/divhide/divhide-core.png?branch=master)](https://travis-ci.org/divhide/divhide-core) [![NPM version](https://badge.fury.io/js/divhide.svg)](http://badge.fury.io/js/divhide) [![Dependency Status](https://gemnasium.com/divhide/divhide-core.svg)](https://gemnasium.com/divhide/divhide-core)
[![Build Status](https://travis-ci.org/divhide/node-divhide.png?branch=master)](https://travis-ci.org/divhide/node-divhide) [![Coverage Status](https://coveralls.io/repos/divhide/divhide-core/badge.svg)](https://coveralls.io/r/divhide/divhide-core) [![NPM version](https://badge.fury.io/js/divhide.svg)](http://badge.fury.io/js/divhide) [![Dependency Status](https://gemnasium.com/divhide/divhide-core.svg)](https://gemnasium.com/divhide/divhide-core)

@@ -322,2 +322,6 @@ [![NPM Stats](https://nodei.co/npm/divhide.png?downloads=true)](https://www.npmjs.com/package/divhide) ![alt text](https://raw.githubusercontent.com/divhide/divhide-core/master/.readme/assets/bower-logo.jpg) ![alt text](https://raw.githubusercontent.com/divhide/divhide-core/master/.readme/assets/titanium-logo.png)

* `.instanceOf(fn)`
<br />
Set the expected value to be an instance of the given function.
* `.regex(value)`

@@ -631,3 +635,3 @@ <br />

/// every other object key is optional
"/.*/": Schema.string().optional()
"/.*/": Schema.number().optional()

@@ -638,15 +642,13 @@ }).required();

/// apply the schema to the value
var value = schema.value(
{
data: [ 1, 2, 3, 4, 5 , 6],
timestamp: "1404373579473"
});
var value = schema.value({
data: [ 1, 2, 3, 4, 5, 6],
timestamp: "1404373579473"
});
/// test the value
expect(value).equals(
{
data: [ '1', '2', '3', '4', '5' , '6'],
timestamp: "1404373579473"
});
expect(value).equals({
data: [ '1', '2', '3', '4', '5' , '6'],
timestamp: 1404373579473
});

@@ -715,3 +717,3 @@

var value = schema.value(3);
expect(value).toBe(3)
expect(value).toBe(3);

@@ -787,3 +789,3 @@

})
.toThrow(new Error("Value is required."));
.toThrowError("Value is required., The minimum value allowed is 3.");

@@ -957,33 +959,34 @@

* `Type.of(value)`
* `.of(value)`
<br />
Gets the string representation of the given value.
* `Type.isArray(value)`
* `.isArray(value)`
* `Type.isBoolean(value)`
* `.isBoolean(value)`
* `Type.isFunction(value)`
* `.isFunction(value)`
* `Type.isString(value)`
* `.isString(value)`
* `Type.isObject(value)`
* `.isObject(value)`
* `Type.isBoolean(value)`
* `.isBoolean(value)`
* `Type.isRegExp(value)`
* `.isRegExp(value)`
* `Type.isRegExpStr(value)`
* `.isRegExpStr(value)`
* `Type.isNumber(value)`
* `.isNumber(value)`
* `Type.isDefined(value)`
* `.instanceOf(value)`
* `.isDefined(value)`
<br />
Checks if the value is defined.
* `Type.isEmpty(value)`
* `.isEmpty(value)`
<br />
Checks if the value is empty (executed in string, list and object context ).
```js

@@ -1054,5 +1057,8 @@

var isString = Type.instanceOf("string", String);
expect(isString).toBe(true);
```

@@ -1451,3 +1457,2 @@

## Contribute

@@ -1462,6 +1467,5 @@

## open http://localhost:8585/test/ to run the tests on your browser
grunt
grunt dev
```

@@ -1481,6 +1485,4 @@

grunt build
grunt
```

@@ -1493,6 +1495,6 @@

## change the package.json, bower.json pre-release version (v1.0.0-1)
grunt pre-release
grunt bump:prerelease
## change the package.json, bower.json minor version (v1.0.1)
grunt patch
grunt bump:patch

@@ -1499,0 +1501,0 @@ ## Publish current version to npm and bower

@@ -34,2 +34,6 @@

* `.instanceOf(fn)`
<br />
Set the expected value to be an instance of the given function.
* `.regex(value)`

@@ -36,0 +40,0 @@ <br />

@@ -26,4 +26,4 @@ 'use strict';

ChainableFns.regex = require("./Assert/Regex");
ChainableFns.instanceOf = require("./Assert/InstanceOf");
/**

@@ -30,0 +30,0 @@ *

'use strict';
var _ = require("lodash"),
Type = require("./Type"),
Safe = require("./Safe"),

@@ -8,4 +9,4 @@ Chain = require("./Chain"),

Types = require("./Schema/Types"),
SchemaDefinition = require("./Schema/Entity/SchemaDefinition"),
SchemaEvaluator = require("./Schema/Utils/SchemaEvaluator");
SchemaDefinition = require("./Schema/SchemaDefinition"),
SchemaEvaluator = require("./Schema/SchemaEvaluator");

@@ -44,2 +45,3 @@ /**

args.shift();
/// last argument is the chain argument option, so discard it

@@ -60,2 +62,39 @@ args.pop();

*
* SchemaDefinition compile options.
*
* @type {Object}
*
*/
Internal.compileOptions = {
/**
*
* Prepare the given value for the SchemaDefinition
* conversion. If the value is instance of Schema get
* its SchemaDefinition value for the conversions
*
* @param {*} val
*
* @return {*}
*
*/
prepare: function(val){
if(Type.instanceOf(val, Types.Schema)){
var schemaData = val.serialize();
val = new SchemaDefinition(schemaData, {
prepare: function(val){
return new SchemaDefinition(val, { compile: false });
}
});
}
return val;
}
};
/**
*
* The Schema Chainable functions

@@ -169,3 +208,3 @@ *

return new SchemaEvaluator(this, argument);
return new SchemaEvaluator(this, argument, Internal.compileOptions);

@@ -192,3 +231,3 @@ },

var r = new SchemaEvaluator(this, argument);
var r = new SchemaEvaluator(this, argument, Internal.compileOptions);
return r.value(result);

@@ -214,3 +253,3 @@

var r = new SchemaEvaluator(this, argument);
var r = new SchemaEvaluator(this, argument, Internal.compileOptions);
return r.errors(result);

@@ -236,3 +275,3 @@

var r = new SchemaEvaluator(this, argument);
var r = new SchemaEvaluator(this, argument, Internal.compileOptions);
return r.isValid(result);

@@ -251,3 +290,3 @@

var evaluator = new SchemaEvaluator(this, argument);
var evaluator = new SchemaEvaluator(this, argument, Internal.compileOptions);
return evaluator.serialize();

@@ -266,3 +305,3 @@

var evaluator = new SchemaEvaluator(this, argument);
var evaluator = new SchemaEvaluator(this, argument, Internal.compileOptions);
return evaluator.deserialize(value);

@@ -330,3 +369,3 @@

scope: function() {
return new SchemaDefinition();
return new SchemaDefinition(null, { compile: false });
},

@@ -333,0 +372,0 @@

@@ -76,3 +76,11 @@ "use strict";

/**
*
* Invalid List
*
* @type {String}
*
*/
Messages.VALIDATION_INSTANCEOF = "Expected instance of '<%= value %>'.";
module.exports = Messages;

@@ -41,3 +41,3 @@ "use strict";

return _.template(tmplStr, data);
return _.template(tmplStr)(data);

@@ -85,3 +85,3 @@ };

var error = _.template(
"Error on template '<%= name %>': <%= error %>", {
"Error on template '<%= name %>': <%= error %>")({
name: name,

@@ -88,0 +88,0 @@ error: e.message

@@ -21,3 +21,3 @@ "use strict";

*/
Schema: function(options){ _.extend(this, options); },
Schema: function Schema(options){ _.extend(this, options); },

@@ -27,9 +27,33 @@ /**

* @class
* Schema
*
*/
SchemaDefinition: function SchemaDefinition(options){ _.extend(this, options); },
/**
*
* @class
* SchemaEvaluator
*
*/
SchemaEvaluator: function(options){ _.extend(this, options); }
SchemaEvaluator: function SchemaEvaluator(options){ _.extend(this, options); },
/**
*
* @class
* SchemaResult
*
*/
SchemaResult: function SchemaResult(options){ _.extend(this, options); },
/**
*
* @class
* SchemaResultNode
*
*/
SchemaResultNode: function SchemaResultNode(options){ _.extend(this, options); }
};
module.exports = Types;

@@ -190,2 +190,30 @@ 'use strict';

*
* Test if value is instanceOf 'fn'
*
* @param {*} value
* @param {*} fn
*
* @return {Boolean}
*
*/
Type.instanceOf = function(value, fn){
/// take care of javascript quirks first!
if(Type.isString(value) && fn == String){
return true;
}
else if(Type.isNumber(value) && fn == Number){
return true;
}
else if(Type.isBoolean(value) && fn == Boolean){
return true;
}
return (value instanceof fn);
};
/**
*
* Tests if the value is Empty

@@ -192,0 +220,0 @@ *

@@ -7,33 +7,34 @@

* `Type.of(value)`
* `.of(value)`
<br />
Gets the string representation of the given value.
* `Type.isArray(value)`
* `.isArray(value)`
* `Type.isBoolean(value)`
* `.isBoolean(value)`
* `Type.isFunction(value)`
* `.isFunction(value)`
* `Type.isString(value)`
* `.isString(value)`
* `Type.isObject(value)`
* `.isObject(value)`
* `Type.isBoolean(value)`
* `.isBoolean(value)`
* `Type.isRegExp(value)`
* `.isRegExp(value)`
* `Type.isRegExpStr(value)`
* `.isRegExpStr(value)`
* `Type.isNumber(value)`
* `.isNumber(value)`
* `Type.isDefined(value)`
* `.instanceOf(value)`
* `.isDefined(value)`
<br />
Checks if the value is defined.
* `Type.isEmpty(value)`
* `.isEmpty(value)`
<br />
Checks if the value is empty (executed in string, list and object context ).
```js

@@ -40,0 +41,0 @@

@@ -38,2 +38,3 @@ "use strict";

Object: require("./Common/Assert/Object"),
InstanceOf: require("./Common/Assert/InstanceOf"),
},

@@ -48,8 +49,7 @@

Entity: {
SchemaDefinition : require("./Common/Schema/Entity/SchemaDefinition")
},
Utils: {
Compilation : require("./Common/Schema/Utils/Compilation"),
Execution : require("./Common/Schema/Utils/Execution")
SchemaDefinition: require("./Common/Schema/SchemaDefinition"),
Mixins: {
SchemaExecution: require("./Common/Schema/Mixins/SchemaExecution"),
SchemaExecutionHelper: require("./Common/Schema/Mixins/SchemaExecutionHelper")
}

@@ -56,0 +56,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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