Not Preposterously Macho
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    hoistpublic

    Hoist makes it easy to transform your objects.

    Hoist Transformer

    Synchronous mappings:

    var hoist = require("hoist");
    var castNumValue = hoist.cast(Number).map(function(num) {
      return {
        value: num
      }
    });
     
    var castArray = house.cast(Array);
     
    console.log(castNumValue("5")); //{ value: 5 }
    console.log(castNumValue({ value: 5 })); //{ value: 5 }
    console.log(castArray(5)); //[5]
    console.log(castArray([5])); //5
     

    Asynchronous mappings:

    var castNumValue = hoist.cast(Number).map(function(num, next) {
      setTimeout(next, 500, null, { value: num });
    });
     
    castNumValue("5", function(err, result) {
      console.log(result); //{ value: 5 }
    })
     
    castNumValue("5"); //error thrown for casting against asynchronous caster

    Keywords

    none

    install

    npm i hoist

    Downloadsweekly downloads

    11

    version

    0.0.6

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar