Skip to content

Commit

Permalink
Use lodash from NPM
Browse files Browse the repository at this point in the history
  • Loading branch information
lukejagodzinski committed Apr 18, 2016
1 parent 04dcc13 commit 923df99
Show file tree
Hide file tree
Showing 88 changed files with 139 additions and 4 deletions.
1 change: 1 addition & 0 deletions .npm/package/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
7 changes: 7 additions & 0 deletions .npm/package/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This directory and the files immediately inside it are automatically generated
when you change this package's NPM dependencies. Commit the files in this
directory (npm-shrinkwrap.json, .gitignore, and this README) to source control
so that others run the same versions of sub-dependencies.

You should NOT check in the node_modules directory that Meteor automatically
creates; if you are using git, the .gitignore file tells git to ignore it.
9 changes: 9 additions & 0 deletions .npm/package/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/core/class.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import throwParseError from '../modules/core/utils/throw_parse_error.js';
import cloneDefinition from '../modules/core/utils/clone_definition.js';
import Module from './module.js';
Expand Down
1 change: 1 addition & 0 deletions lib/core/module.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import throwParseError from '../modules/core/utils/throw_parse_error.js';

class Module {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/behaviors/behavior.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import throwParseError from '../core/utils/throw_parse_error.js';

const checkDefinition = function(definition) {
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/behaviors/class_static_methods/has_behavior.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function hasBehavior(behaviorName) {
return _.has(this.schema.behaviors, behaviorName);
};
Expand Down
1 change: 1 addition & 0 deletions lib/modules/behaviors/hooks/apply_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import Behavior from '../behavior.js';

function onApplyDefinition(Class, parsedDefinition, className) {
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/behaviors/hooks/merge_definitions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function onMergeDefinitions(targetDefinition, sourceDefinition, ClassName) {
_.each(sourceDefinition.behaviors, function(behaviors, behaviorName) {
targetDefinition.behaviors[behaviorName] =
Expand Down
1 change: 1 addition & 0 deletions lib/modules/behaviors/hooks/parse_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import throwParseError from '../../core/utils/throw_parse_error.js';
import Behavior from '../behavior.js';

Expand Down
2 changes: 2 additions & 0 deletions lib/modules/core/utils/clone_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function cloneDefinition(definition) {
return _.cloneDeepWith(definition, function(value) {
if (!_.isPlainObject(value) && !_.isArray(value)) {
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/core/utils/override_method.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function overrideMethod(object, methodName, overridingMethod, param) {
// Get original method.
let originalMethod = object[methodName];
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/core/utils/throw_parse_error.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function throwParseError(details) {
let message = '';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import Event from '../event.js';
import throwParseError from '../../core/utils/throw_parse_error.js';
import { default as AstroClass } from '../../../core/class.js';
Expand Down
1 change: 1 addition & 0 deletions lib/modules/events/class_static_methods/dispatch_event.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import Event from '../event.js';
import throwParseError from '../../core/utils/throw_parse_error.js';

Expand Down
2 changes: 2 additions & 0 deletions lib/modules/events/class_static_methods/has_event.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function hasEvent(eventName, eventHandler) {
let Class = this;

Expand Down
2 changes: 2 additions & 0 deletions lib/modules/events/event.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

class Event {
constructor(type, data) {
this.cancelable = false;
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/events/hooks/apply_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function onApplyDefinition(Class, parsedDefinition, className) {
let schema = Class.schema;

Expand Down
2 changes: 2 additions & 0 deletions lib/modules/events/hooks/merge_definitions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function onMergeDefinitions(targetDefinition, sourceDefinition, ClassName) {
_.each(sourceDefinition.events, function(events, eventName) {
eventName = eventName.toLowerCase();
Expand Down
1 change: 1 addition & 0 deletions lib/modules/events/hooks/parse_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import throwParseError from '../../core/utils/throw_parse_error.js';

function onParseDefinition(parsedDefinition, definition, className) {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/class_prototype_methods/set.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import setMany from '../utils/set_many.js';
import setOne from '../utils/set_one.js';

Expand Down
2 changes: 2 additions & 0 deletions lib/modules/fields/class_static_methods/get_fields.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function getFields() {
return _.values(this.schema.fields);
};
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/fields/class_static_methods/get_fields_names.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function getFieldsNames(options) {
// Prepare options.
options = _.extend({
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/fields/class_static_methods/get_list_fields.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

import ListField from '../list_field.js';

function getListFields() {
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/fields/class_static_methods/get_object_fields.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

import ObjectField from '../object_field.js';

function getObjectFields() {
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/fields/class_static_methods/has_field.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function hasField(fieldName) {
return _.has(this.schema.fields, fieldName);
};
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/enum.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import Type from './type.js';
import Validators from '../validators/validators.js';

Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/field.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import Validators from '../validators/validators.js';

class Field {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/hooks/apply_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import throwParseError from '../../core/utils/throw_parse_error.js';
import Type from '../type.js';
import AstroClass from '../../../core/class.js';
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/fields/hooks/merge_definitions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function onMergeDefinitions(targetDefinition, sourceDefinition, className) {
_.each(sourceDefinition.fields, function(fieldDefinition, fieldName) {
targetDefinition.fields[fieldName] = fieldDefinition;
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/hooks/parse_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import throwParseError from '../../core/utils/throw_parse_error.js';
import Class from '../../../core/class.js';
import Type from '../type.js';
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/list_field.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import Field from './field.js';
import AstroClass from '../../core/class.js';
import Validators from '../validators/validators.js';
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/object_field.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import Field from './field.js';
import { Class as AstroClass } from '../../core/class.js';
import Validators from '../validators/validators.js';
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/scalar_field.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import Field from './field.js';

class ScalarField extends Field {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/type.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import Validators from '../validators/validators.js';

const typeDefinitionPattern = {
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/fields/utils/cast_nested.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function castNested(doc) {
let Class = doc.constructor;

Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/utils/get_many.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import getOne from './get_one.js';

function getMany(doc, fieldNames, options) {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/utils/get_one.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import traverse from '../utils/traverse.js';

function getOne(doc, fieldPattern, options) {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/utils/raw_many.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import rawOne from './raw_one.js';

function rawMany(doc, fieldNames, options) {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/utils/raw_one.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import AstroClass from '../../../core/class.js';
import traverse from './traverse.js';
import rawAll from './raw_all.js';
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/utils/set_all.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import setOne from './set_one.js';

function setAll(doc, fieldsValues, options) {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/utils/set_many.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import setOne from './set_one.js';

function setMany(doc, fieldsValues, options) {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/fields/utils/traverse.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import isNestedFieldName from './is_nested_field_name.js';
import AstroClass from '../../../core/class.js';

Expand Down
2 changes: 2 additions & 0 deletions lib/modules/indexes/class_static_methods/has_index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function hasIndex(indexName) {
return _.has(this.schema.indexes, indexName);
};
Expand Down
1 change: 1 addition & 0 deletions lib/modules/indexes/hooks/apply_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import throwParseError from '../../core/utils/throw_parse_error.js';

function onApplyDefinition(Class, parsedDefinition, className) {
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/indexes/hooks/merge_definitions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function onMergeDefinitions(targetDefinition, sourceDefinition, ClassName) {
_.each(sourceDefinition.indexes, function(index, indexName) {
targetDefinition.indexes[indexName] = index;
Expand Down
1 change: 1 addition & 0 deletions lib/modules/indexes/hooks/parse_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import throwParseError from '../../core/utils/throw_parse_error.js';

const fieldDefinitionPattern = Match.ObjectIncluding({
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/methods/class_static_methods/has_method.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function hasMethod(methodName) {
return _.has(this.schema.methods, methodName);
};
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/methods/hooks/apply_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function onApplyDefinition(Class, parsedDefinition, className) {
let schema = Class.schema;

Expand Down
2 changes: 2 additions & 0 deletions lib/modules/methods/hooks/merge_definitions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function onMergeDefinitions(targetDefinition, sourceDefinition, ClassName) {
_.each(sourceDefinition.methods, function(method, methodName) {
targetDefinition.methods[methodName] = method;
Expand Down
1 change: 1 addition & 0 deletions lib/modules/methods/hooks/parse_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import throwParseError from '../../core/utils/throw_parse_error.js';

function onParseDefinition(parsedDefinition, definition, className) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import utilGetModified from '../utils/get_modified.js';
import rawOne from '../../fields/utils/raw_one.js';

Expand Down
1 change: 1 addition & 0 deletions lib/modules/storage/class_prototype_methods/reload.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import Event from '../../events/event.js';

function reload() {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/storage/hooks/apply_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
// Utils.
import hasMeteorMethod from '../utils/has_meteor_method.js';
import transformToClass from '../utils/transform_to_class.js';
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/storage/hooks/merge_definitions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function onMergeDefinitions(targetDefinition, sourceDefinition, ClassName) {
if (sourceDefinition.collection) {
targetDefinition.collection = sourceDefinition.collection;
Expand Down
1 change: 1 addition & 0 deletions lib/modules/storage/hooks/parse_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import throwParseError from '../../core/utils/throw_parse_error.js';

function onParseDefinition(parsedDefinition, definition, className) {
Expand Down
1 change: 1 addition & 0 deletions lib/modules/storage/utils/apply_modifier.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import castNested from '../../fields/utils/cast_nested.js';

function applyModifier({
Expand Down
1 change: 1 addition & 0 deletions lib/modules/storage/utils/document_insert.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import castNested from '../../fields/utils/cast_nested.js';
import rawAll from '../../fields/utils/raw_all.js';
import triggerBeforeSave from './trigger_before_save.js';
Expand Down
1 change: 1 addition & 0 deletions lib/modules/storage/utils/get_modified.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import AstroClass from '../../../core/class.js';
import throwParseError from '../../core/utils/throw_parse_error.js';
import rawAll from '../../fields/utils/raw_all.js';
Expand Down
1 change: 1 addition & 0 deletions lib/modules/storage/utils/get_modifier.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import rawAll from '../../fields/utils/raw_all.js';

function getModifier(options) {
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/storage/utils/has_meteor_method.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function hasMeteorMethod(connection, methodName) {
// There is inconsistency between client and server. On the client connection
// object contains the "_methodHandlers" property and on the server the
Expand Down
1 change: 1 addition & 0 deletions lib/modules/storage/utils/is_modified.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import getModified from './get_modified.js';

function isModified(options = {}) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function validateAll(options = {}, callback) {
let doc = this;
let Class = doc.constructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function getValidationOrder() {
let Class = this;

Expand Down
1 change: 1 addition & 0 deletions lib/modules/validators/hooks/apply_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import hasMeteorMethod from '../../storage/utils/has_meteor_method.js';
import meteorValidate from '../meteor_methods/validate.js';

Expand Down
2 changes: 2 additions & 0 deletions lib/modules/validators/hooks/merge_definitions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _ from 'lodash';

function onMergeDefinitions(targetDefinition, sourceDefinition, ClassName) {
_.each(sourceDefinition.validators, function(validators, fieldName) {
targetDefinition.validators[fieldName] =
Expand Down
1 change: 1 addition & 0 deletions lib/modules/validators/hooks/parse_definition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import throwParseError from '../../core/utils/throw_parse_error.js';
import parseValidators from '../utils/parse_validators.js';

Expand Down
1 change: 1 addition & 0 deletions lib/modules/validators/utils/document_validate.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import AstroClass from '../../../core/class.js';
import throwParseError from '../../core/utils/throw_parse_error.js';
import castNested from '../../fields/utils/cast_nested.js';
Expand Down
1 change: 1 addition & 0 deletions lib/modules/validators/utils/parse_validators.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import throwParseError from '../../core/utils/throw_parse_error.js';
import Validators from '../validators.js';

Expand Down
1 change: 1 addition & 0 deletions lib/modules/validators/validators/comparison/choice.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import Validator from '../../validator.js';

Validator.create({
Expand Down
1 change: 1 addition & 0 deletions lib/modules/validators/validators/logical/and.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import parseValidators from '../../utils/parse_validators.js';
import Validator from '../../validator.js';
import Validators from '../../validators.js';
Expand Down
1 change: 1 addition & 0 deletions lib/modules/validators/validators/logical/or.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import parseValidators from '../../utils/parse_validators.js';
import Validator from '../../validator.js';
import Validators from '../../validators.js';
Expand Down
1 change: 1 addition & 0 deletions lib/modules/validators/validators/size/length.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import Validator from '../../validator.js';

Validator.create({
Expand Down
Loading

0 comments on commit 923df99

Please sign in to comment.