Skip to content

Commit

Permalink
remove related, unused methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Sawchuk committed Feb 3, 2015
1 parent c2ac209 commit 9ce3484
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 64 deletions.
56 changes: 0 additions & 56 deletions lib/datastore/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@

'use strict';

/** @type {object} */
var entityMeta = {};

/** @const {regexp} Regular expression to verify a field name. */
var FIELD_NAME_REGEX = /^[A-Za-z]*$/;

/** @const {regexp} Regular expression to verify a Kind. */
var KIND_REGEX = /^[A-Za-z]*$/;

/** @const {regexp} Regular Expression to verify a namespace. */
var NAMESPACE_REGEX = /^[A-Za-z]*$/;

/** @const {object} Map for query operation -> operation protocol value. */
var OP_TO_OPERATOR = {
'=': 'EQUAL',
Expand All @@ -43,16 +31,6 @@ var OP_TO_OPERATOR = {
'HAS_ANCESTOR': 'HAS_ANCESTOR'
};

/** @const {array} A list of native objects. */
var PRIMITIVE_KINDS = [
Object,
Boolean,
Number,
String,
Date,
Buffer
];

/** @const {object} Conversion map for query sign -> order protocol value. */
var SIGN_TO_ORDER = {
'-': 'DESCENDING',
Expand Down Expand Up @@ -592,40 +570,6 @@ function queryToQueryProto(q) {

module.exports.queryToQueryProto = queryToQueryProto;

/**
* Validate a field.
*
* @throws Throws an Error if the field doesn't validate.
*
* @param {string} name - Field name.
* @param {object} field - Field metadata object.
* @param {string} field.key - Field key.
* @param {*} field.kind - Field Kind.
*
* @example
* validateField('title', {
* kind: String
* });
* // undefined (no errors thrown.)
*/
function validateField(name, field) {
if (!FIELD_NAME_REGEX.test(name)) {
throw new Error('Field name should match ' + FIELD_NAME_REGEX);
}
if (!field.kind) {
throw new Error('Provide a kind for field ' + name);
}
if (typeof field.kind !== 'object' &&
PRIMITIVE_KINDS.indexOf(field.kind) === -1) {
throw new Error('Unknown kind for field ' + name);
}
if (typeof field.kind === 'object') {
Object.keys(field.key).forEach(function(key) {
validateField(key, field.key[key]);
});
}
}

/**
* Does a value exist?
*
Expand Down
8 changes: 0 additions & 8 deletions test/datastore/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ var entity = require('../../lib/datastore/entity.js');
var datastore = require('../../lib/datastore');
var ByteBuffer = require('bytebuffer');

var blogPostMetadata = {
title: { kind: String, indexed: true },
tags: { kind: String, multi: true, indexed: true },
publishedAt: { kind: Date },
author: { kind: Object, indexed: true },
isDraft: { kind: Boolean, indexed: true }
};

var entityProto = {
'property': [{
'name': 'linkedTo',
Expand Down

0 comments on commit 9ce3484

Please sign in to comment.