[Pkg-javascript-commits] [node-type-check] 07/13: New upstream version 0.3.2+dfsg

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Wed Oct 12 18:01:17 UTC 2016


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository node-type-check.

commit b05baa6ebc7afb48db17f96c56a7733560ed031a
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Tue Oct 11 17:35:25 2016 +0530

    New upstream version 0.3.2+dfsg
---
 lib/check.js      | 126 -----------------------------------
 lib/index.js      |  16 -----
 lib/parse-type.js | 196 ------------------------------------------------------
 package.json      |  40 -----------
 4 files changed, 378 deletions(-)

diff --git a/lib/check.js b/lib/check.js
deleted file mode 100644
index 0504c8d..0000000
--- a/lib/check.js
+++ /dev/null
@@ -1,126 +0,0 @@
-// Generated by LiveScript 1.4.0
-(function(){
-  var ref$, any, all, isItNaN, types, defaultType, customTypes, toString$ = {}.toString;
-  ref$ = require('prelude-ls'), any = ref$.any, all = ref$.all, isItNaN = ref$.isItNaN;
-  types = {
-    Number: {
-      typeOf: 'Number',
-      validate: function(it){
-        return !isItNaN(it);
-      }
-    },
-    NaN: {
-      typeOf: 'Number',
-      validate: isItNaN
-    },
-    Int: {
-      typeOf: 'Number',
-      validate: function(it){
-        return !isItNaN(it) && it % 1 === 0;
-      }
-    },
-    Float: {
-      typeOf: 'Number',
-      validate: function(it){
-        return !isItNaN(it);
-      }
-    },
-    Date: {
-      typeOf: 'Date',
-      validate: function(it){
-        return !isItNaN(it.getTime());
-      }
-    }
-  };
-  defaultType = {
-    array: 'Array',
-    tuple: 'Array'
-  };
-  function checkArray(input, type){
-    return all(function(it){
-      return checkMultiple(it, type.of);
-    }, input);
-  }
-  function checkTuple(input, type){
-    var i, i$, ref$, len$, types;
-    i = 0;
-    for (i$ = 0, len$ = (ref$ = type.of).length; i$ < len$; ++i$) {
-      types = ref$[i$];
-      if (!checkMultiple(input[i], types)) {
-        return false;
-      }
-      i++;
-    }
-    return input.length <= i;
-  }
-  function checkFields(input, type){
-    var inputKeys, numInputKeys, k, numOfKeys, key, ref$, types;
-    inputKeys = {};
-    numInputKeys = 0;
-    for (k in input) {
-      inputKeys[k] = true;
-      numInputKeys++;
-    }
-    numOfKeys = 0;
-    for (key in ref$ = type.of) {
-      types = ref$[key];
-      if (!checkMultiple(input[key], types)) {
-        return false;
-      }
-      if (inputKeys[key]) {
-        numOfKeys++;
-      }
-    }
-    return type.subset || numInputKeys === numOfKeys;
-  }
-  function checkStructure(input, type){
-    if (!(input instanceof Object)) {
-      return false;
-    }
-    switch (type.structure) {
-    case 'fields':
-      return checkFields(input, type);
-    case 'array':
-      return checkArray(input, type);
-    case 'tuple':
-      return checkTuple(input, type);
-    }
-  }
-  function check(input, typeObj){
-    var type, structure, setting, that;
-    type = typeObj.type, structure = typeObj.structure;
-    if (type) {
-      if (type === '*') {
-        return true;
-      }
-      setting = customTypes[type] || types[type];
-      if (setting) {
-        return setting.typeOf === toString$.call(input).slice(8, -1) && setting.validate(input);
-      } else {
-        return type === toString$.call(input).slice(8, -1) && (!structure || checkStructure(input, typeObj));
-      }
-    } else if (structure) {
-      if (that = defaultType[structure]) {
-        if (that !== toString$.call(input).slice(8, -1)) {
-          return false;
-        }
-      }
-      return checkStructure(input, typeObj);
-    } else {
-      throw new Error("No type defined. Input: " + input + ".");
-    }
-  }
-  function checkMultiple(input, types){
-    if (toString$.call(types).slice(8, -1) !== 'Array') {
-      throw new Error("Types must be in an array. Input: " + input + ".");
-    }
-    return any(function(it){
-      return check(input, it);
-    }, types);
-  }
-  module.exports = function(parsedType, input, options){
-    options == null && (options = {});
-    customTypes = options.customTypes || {};
-    return checkMultiple(input, parsedType);
-  };
-}).call(this);
diff --git a/lib/index.js b/lib/index.js
deleted file mode 100644
index f3316ba..0000000
--- a/lib/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-// Generated by LiveScript 1.4.0
-(function(){
-  var VERSION, parseType, parsedTypeCheck, typeCheck;
-  VERSION = '0.3.2';
-  parseType = require('./parse-type');
-  parsedTypeCheck = require('./check');
-  typeCheck = function(type, input, options){
-    return parsedTypeCheck(parseType(type), input, options);
-  };
-  module.exports = {
-    VERSION: VERSION,
-    typeCheck: typeCheck,
-    parsedTypeCheck: parsedTypeCheck,
-    parseType: parseType
-  };
-}).call(this);
diff --git a/lib/parse-type.js b/lib/parse-type.js
deleted file mode 100644
index 5baf661..0000000
--- a/lib/parse-type.js
+++ /dev/null
@@ -1,196 +0,0 @@
-// Generated by LiveScript 1.4.0
-(function(){
-  var identifierRegex, tokenRegex;
-  identifierRegex = /[\$\w]+/;
-  function peek(tokens){
-    var token;
-    token = tokens[0];
-    if (token == null) {
-      throw new Error('Unexpected end of input.');
-    }
-    return token;
-  }
-  function consumeIdent(tokens){
-    var token;
-    token = peek(tokens);
-    if (!identifierRegex.test(token)) {
-      throw new Error("Expected text, got '" + token + "' instead.");
-    }
-    return tokens.shift();
-  }
-  function consumeOp(tokens, op){
-    var token;
-    token = peek(tokens);
-    if (token !== op) {
-      throw new Error("Expected '" + op + "', got '" + token + "' instead.");
-    }
-    return tokens.shift();
-  }
-  function maybeConsumeOp(tokens, op){
-    var token;
-    token = tokens[0];
-    if (token === op) {
-      return tokens.shift();
-    } else {
-      return null;
-    }
-  }
-  function consumeArray(tokens){
-    var types;
-    consumeOp(tokens, '[');
-    if (peek(tokens) === ']') {
-      throw new Error("Must specify type of Array - eg. [Type], got [] instead.");
-    }
-    types = consumeTypes(tokens);
-    consumeOp(tokens, ']');
-    return {
-      structure: 'array',
-      of: types
-    };
-  }
-  function consumeTuple(tokens){
-    var components;
-    components = [];
-    consumeOp(tokens, '(');
-    if (peek(tokens) === ')') {
-      throw new Error("Tuple must be of at least length 1 - eg. (Type), got () instead.");
-    }
-    for (;;) {
-      components.push(consumeTypes(tokens));
-      maybeConsumeOp(tokens, ',');
-      if (')' === peek(tokens)) {
-        break;
-      }
-    }
-    consumeOp(tokens, ')');
-    return {
-      structure: 'tuple',
-      of: components
-    };
-  }
-  function consumeFields(tokens){
-    var fields, subset, ref$, key, types;
-    fields = {};
-    consumeOp(tokens, '{');
-    subset = false;
-    for (;;) {
-      if (maybeConsumeOp(tokens, '...')) {
-        subset = true;
-        break;
-      }
-      ref$ = consumeField(tokens), key = ref$[0], types = ref$[1];
-      fields[key] = types;
-      maybeConsumeOp(tokens, ',');
-      if ('}' === peek(tokens)) {
-        break;
-      }
-    }
-    consumeOp(tokens, '}');
-    return {
-      structure: 'fields',
-      of: fields,
-      subset: subset
-    };
-  }
-  function consumeField(tokens){
-    var key, types;
-    key = consumeIdent(tokens);
-    consumeOp(tokens, ':');
-    types = consumeTypes(tokens);
-    return [key, types];
-  }
-  function maybeConsumeStructure(tokens){
-    switch (tokens[0]) {
-    case '[':
-      return consumeArray(tokens);
-    case '(':
-      return consumeTuple(tokens);
-    case '{':
-      return consumeFields(tokens);
-    }
-  }
-  function consumeType(tokens){
-    var token, wildcard, type, structure;
-    token = peek(tokens);
-    wildcard = token === '*';
-    if (wildcard || identifierRegex.test(token)) {
-      type = wildcard
-        ? consumeOp(tokens, '*')
-        : consumeIdent(tokens);
-      structure = maybeConsumeStructure(tokens);
-      if (structure) {
-        return structure.type = type, structure;
-      } else {
-        return {
-          type: type
-        };
-      }
-    } else {
-      structure = maybeConsumeStructure(tokens);
-      if (!structure) {
-        throw new Error("Unexpected character: " + token);
-      }
-      return structure;
-    }
-  }
-  function consumeTypes(tokens){
-    var lookahead, types, typesSoFar, typeObj, type;
-    if ('::' === peek(tokens)) {
-      throw new Error("No comment before comment separator '::' found.");
-    }
-    lookahead = tokens[1];
-    if (lookahead != null && lookahead === '::') {
-      tokens.shift();
-      tokens.shift();
-    }
-    types = [];
-    typesSoFar = {};
-    if ('Maybe' === peek(tokens)) {
-      tokens.shift();
-      types = [
-        {
-          type: 'Undefined'
-        }, {
-          type: 'Null'
-        }
-      ];
-      typesSoFar = {
-        Undefined: true,
-        Null: true
-      };
-    }
-    for (;;) {
-      typeObj = consumeType(tokens), type = typeObj.type;
-      if (!typesSoFar[type]) {
-        types.push(typeObj);
-      }
-      typesSoFar[type] = true;
-      if (!maybeConsumeOp(tokens, '|')) {
-        break;
-      }
-    }
-    return types;
-  }
-  tokenRegex = RegExp('\\.\\.\\.|::|->|' + identifierRegex.source + '|\\S', 'g');
-  module.exports = function(input){
-    var tokens, e;
-    if (!input.length) {
-      throw new Error('No type specified.');
-    }
-    tokens = input.match(tokenRegex) || [];
-    if (in$('->', tokens)) {
-      throw new Error("Function types are not supported.\ To validate that something is a function, you may use 'Function'.");
-    }
-    try {
-      return consumeTypes(tokens);
-    } catch (e$) {
-      e = e$;
-      throw new Error(e.message + " - Remaining tokens: " + JSON.stringify(tokens) + " - Initial input: '" + input + "'");
-    }
-  };
-  function in$(x, xs){
-    var i = -1, l = xs.length >>> 0;
-    while (++i < l) if (x === xs[i]) return true;
-    return false;
-  }
-}).call(this);
diff --git a/package.json b/package.json
deleted file mode 100644
index 8c0b021..0000000
--- a/package.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
-  "name": "type-check",
-  "version": "0.3.2",
-  "author": "George Zahariev <z at georgezahariev.com>",
-  "description": "type-check allows you to check the types of JavaScript values at runtime with a Haskell like type syntax.",
-  "homepage": "https://github.com/gkz/type-check",
-  "keywords": [
-    "type",
-    "check",
-    "checking",
-    "library"
-  ],
-  "files": [
-    "lib",
-    "README.md",
-    "LICENSE"
-  ],
-  "main": "./lib/",
-  "bugs": "https://github.com/gkz/type-check/issues",
-  "license": "MIT",
-  "engines": {
-    "node": ">= 0.8.0"
-  },
-  "repository": {
-    "type": "git",
-    "url": "git://github.com/gkz/type-check.git"
-  },
-  "scripts": {
-    "test": "make test"
-  },
-  "dependencies": {
-    "prelude-ls": "~1.1.2"
-  },
-  "devDependencies": {
-    "livescript": "~1.4.0",
-    "mocha": "~2.3.4",
-    "istanbul": "~0.4.1",
-    "browserify": "~12.0.1"
-  }
-}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-type-check.git



More information about the Pkg-javascript-commits mailing list