Skip to content

Commit

Permalink
Removed undefined function, and karma
Browse files Browse the repository at this point in the history
  • Loading branch information
jspears committed May 2, 2016
2 parents 10f3c4f + 7c8a7fa commit e37b6e3
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 102 deletions.
28 changes: 10 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "subschema-injection",
"version": "1.2.0",
"version": "1.2.2",
"description": "Subschema Injection System.",
"webpack": "src/index",
"main": "dist/index",
Expand All @@ -15,35 +15,27 @@
"author": "Justin Spears",
"license": "",
"devDependencies": {
"babel-cli": "^6.7.7",
"babel-core": "^6.3.26",
"babel-loader": "^6.2.0",
"babel-plugin-react-transform": "^2.0.0",
"babel-plugin-transform-runtime": "^6.4.3",
"babel-preset-es2015": "^6.3.13",
"babel-preset-es2015-loose": "^7.0.0",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"expect": "^1.13.4",
"karma": "^0.13.19",
"karma-chrome-launcher": "^0.2.2",
"karma-firefox-launcher": "^0.1.7",
"karma-mocha": "^0.2.1",
"karma-sourcemap-loader": "^0.3.6",
"karma-webpack": "^1.7.0",
"lodash": "^3.10.1",
"mocha": "^2.3.4",
"react": "^15.0.2",
"react-addons-test-utils": "^15.0.2",
"react-dom": "^15.0.2",
"webpack": "^1.12.9"
"react-dom": "^15.0.2"
},
"peerDependencies": {
"react": "^15.0.2"
},
"scripts": {
"karma": "NODE_ENV=test karma start --no-single-run --colors --auto-watch",
"test": "NODE_ENV=test karma start --single-run --browsers Firefox",
"test-dist": "npm run dist && NODE_ENV=test karma start --single-run --browsers Firefox",
"hot": "NODE_ENV=development webpack-dev-server --hot --inline --config ./webpack.config.js --entry ./public/index.jsx --output-filename=app.entry.js",
"demo": "NODE_ENV=production webpack -p --output-path .build --entry ./public/index.jsx --output-filename=app.[hash].js --config ./webpack.config.js",
"dist": "NODE_ENV=production webpack --display-modules -p --output-path dist --entry ./src/index.js --output-library-target=umd --output-library-name subschema-injection --output-filename=index.js --config ./webpack.config.js",
"prepublish": "npm run test-dist"
"dist": "babel src --out-dir dist",
"test": "mocha test/*-test.js",
"prepublish": "npm run dist",
"preversion": "npm run prepublish && npm run test"
}
}
56 changes: 0 additions & 56 deletions public/App.jsx

This file was deleted.

12 changes: 0 additions & 12 deletions public/index.html

This file was deleted.

6 changes: 0 additions & 6 deletions public/index.jsx

This file was deleted.

5 changes: 2 additions & 3 deletions src/injectorFactory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
import React, {Component} from 'react';
import {keyIn, onlyKeys, uniqueKeys, resolveKey, extendPrototype, listener, unmount, prop as property} from './util';
import React, {Component} from "react";
import {keyIn, onlyKeys, uniqueKeys, extendPrototype, listener, unmount, prop as property} from "./util";


export class BaseInjectComponent extends Component {
Expand Down Expand Up @@ -56,7 +56,6 @@ export default function injector(resolvers = new Map()) {
listener,
property,
extendPrototype,
resolveKey,
createWrapperClass(Clazz, copyPropTypeKeys){

const {name, displayName} = Clazz;
Expand Down
7 changes: 1 addition & 6 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,18 @@ function keyIn(key, ...args) {
}
function onlyKeys(keys, ...args) {
const ret = {};
let break_key = false;
for (let key of keys) {
for (let arg of args) {
if (arg == null) continue;
if (key in arg) {
ret[key] = arg[key];
break_key = true;
break;
}
}
if (break_key) {
break;
}
}

return ret;
}

function uniqueKeys(...args) {
const keys = [];
for (let arg of args) {
Expand Down
14 changes: 13 additions & 1 deletion test/util-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
import expect from 'expect';
import {onlyKeys} from "../src/util";
import expect from "expect";

describe('util', function () {

it('should return only unique keys', function () {

const ret = onlyKeys(['stuff', 'me'], {stuff: 1, other: 2}, {more: 3}, {me: 4});

expect(ret.stuff).toBe(1);
expect(ret.me).toBe(4);
expect(Object.keys(ret).length).toBe(2);

});

});

0 comments on commit e37b6e3

Please sign in to comment.