Giter VIP home page Giter VIP logo

check-more-types's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

check-more-types's Issues

Add equality check

useful for schema checks, should be curried, for example

var foo = ...;
console.assert(check.eq(foo, 'foo'), 'invalid foo', foo);
// similar feature using ramda
var storage = ...;
var isValidStorage = R.partial(check.schema, {
  type: R.eq('S3'),
  accessKeyId: check.unemptyString,
  secretAccessKey: check.unemptyString
});
la(isValidStorage(storage), 'invalid storage', storage);

crash with TypeError when requiring library

npm i check-more-types gives me 1.6.1. I create a file z.js containing

dmr@lapy:~/whale/node/web-hooks$ cat z.js 
var check = require('check-more-types');

dmr@lapy:~/whale/node/web-hooks$ node z.js 

/home/dmr/whale/node/web-hooks/node_modules/check-more-types/check-more-types.js:397
      check.verify.fn(fn, 'expected predicate function');
                   ^
TypeError: Cannot call method 'fn' of undefined
    at Object.mixin (/home/dmr/whale/node/web-hooks/node_modules/check-more-types/check-more-types.js:397:20)
    at module.exports (/home/dmr/whale/node/web-hooks/node_modules/check-more-types/check-more-types.js:537:11)
    at Array.forEach (native)
    at checkMoreTypes (/home/dmr/whale/node/web-hooks/node_modules/check-more-types/check-more-types.js:536:27)
    at Object.<anonymous> (/home/dmr/whale/node/web-hooks/node_modules/check-more-types/check-more-types.js:543:2)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

Add found method

Which should work with string.indexOf result

var str = 'foo';
if (check.found(str.indexOf('oo'))) {
}

Add bower

Register with bower, add instructions.

Curry methods by default

To avoid needing separate bind or partial calls (for methods that take more than 1 argument)

var isTitle = check.oneOf(['Mr', 'Dr', 'Ms', 'Mss']);
la(isTitle(foo), 'invalid title', foo);

Allow messages in check.defend

Allow passing predicates and strings into check.defend

function add(a, b) { return a+b; }
check.defend(add, 
  check.number, 'first argument should be a number',
  check.number, 'second argument should be a number');

Add check.or predicate

For simpler combination of checks

check.or(check.unemptyString, check.number)(x);
// true if x is "foo" or 42

Add check.oneOf

To test if an item is one of items in the list

var color = ...
la(check.oneOf(['red', 'blue', 'green'], color));

Uncaught TypeError: Cannot read property 'fn' of undefined

Hi,

I'm attempting to use check-more-types within karma. I'm getting the following error:

Uncaught TypeError: Cannot read property 'fn' of undefined
at /node_modules/check-more-types/check-more-types.min.js:5

I'm a little stuck n this - any ideas?

Thanks,

API doc

Generate API docs, add to README

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.