divhide@1.0.0 #javascript library released #nodejs @tidev

Oscar Brito

Several months of work wrapped into a javascript library that you can use on the browser, nodejs, appcelarator titanium, and virtually every platform that runs javascript.

Divhide library is the open source release of some private code that I've been using on my side projects.

By doing this I'm trying to separate and reuse code across my divhide packages and at the same time contribute to the javascript ecosystem.


Please follow the information available on divhide github page. The library has support to:

  • Node.js, using npm
  • Browser, using bower
  • Appcelarator Titanium
  • Phonegap
  • ... other javascript platforms


Some of the main module provided by Divhide are listed next. You can check the full API here.


Internationalization is supported by default on all Divhide modules. You can find it being used on the Schema, Exception and Assertion modules.


Implementation of Exception and ExceptionList classes that inherit from javascript Error with full support to internationalization.


Assertions methods are available for you to use on your tests or validation code. Create simple assertions by chaining the rules. You can also extend the assertion methods.

/// apply the assertion rule
var value = Divhide.Assert  
  .max(1) /// will be on array context
  .assert(["first", "second"]);


If you need to create complex validation rules, Schema is your friend. You can even share the same business rules on server and client by serializing and deserializing the Schema object.

Divhide is an alternative for other object schema validators like Joi, js-schema, schema-validator. One of the main differences is that Divhide.Schema works on server and client and is highly customizable.
For example, Divhide.Schema lets you serialize custom validation and share them between server and client. Isn't this awesome!

/// create the validation rule
var schema = Divhide.Schema.object({

    /// array with multiple strings
    data: Schema.array([ "" ]).repeatable().max(10),

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


/// validate the value
var value = schema.value(  
    id: 1,
    name: "record1",
    data: [ 1, 2, 3, 4, 5 , 6],
    timestamp: "1404373579473"


Safe and Type were created to help you write better code on your favourite weakly types language.

If your code is expecting an array and you don't care about validation the input, you can just do foo = Divhide.Safe.array(foo, []).

Don't forget to check the full API here. Feedback is very welcome.

Oscar out.