@codetanzania/emis-api-states
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -0,1 +1,17 @@ | ||
#### 0.3.2 (2019-01-25) | ||
##### Build System / Dependencies | ||
* **rollup:** remove unused external dependencies ([f76e104e](https://github.com/CodeTanzania/emis-api-states/commit/f76e104e66bcb28e27bc67923a3be1ac4afbbe44)) | ||
##### Chores | ||
* build library for release for 0.3.2 ([46a86f3c](https://github.com/CodeTanzania/emis-api-states/commit/46a86f3c6b77bd9098501431354fb4a98f24773a)) | ||
* **package.json:** update package version to 0.3.2 ([88df0fbc](https://github.com/CodeTanzania/emis-api-states/commit/88df0fbc93ae52bfc74a3cc03e6aa3078f7191c5)) | ||
* **dependencies:** use latest version of emis-api-client ([f64b8a58](https://github.com/CodeTanzania/emis-api-states/commit/f64b8a58158ef46e6363db7b766e805dbac3bc86)) | ||
##### Bug Fixes | ||
* **incident type:** remove the issue with incidentTypes ([96b0b5c0](https://github.com/CodeTanzania/emis-api-states/commit/96b0b5c0605d6ff73130636106b92fd413fee252)) | ||
#### 0.3.1 (2019-01-25) | ||
@@ -2,0 +18,0 @@ |
@@ -11,11 +11,7 @@ import forIn from 'lodash/forIn'; | ||
import { createSlice, configureStore } from 'redux-starter-kit'; | ||
import upperFirst from 'lodash/upperFirst'; | ||
import camelCase from 'lodash/camelCase'; | ||
import upperFirst from 'lodash/upperFirst'; | ||
import kebabCase from 'lodash/kebabCase'; | ||
import split from 'lodash/split'; | ||
import capitalize from 'lodash/capitalize'; | ||
import last from 'lodash/last'; | ||
import merge from 'lodash/merge'; | ||
import * as client from '@codetanzania/emis-api-client'; | ||
import toLower from 'lodash/toLower'; | ||
import lowerFirst from 'lodash/lowerFirst'; | ||
@@ -41,28 +37,2 @@ /** | ||
/** | ||
* @function | ||
* @name getNormalizeResourceName | ||
* | ||
* @param {string} resourceName - resource name to be normalized | ||
* @param {boolean} pluralizeLast - if last word or the resource name should | ||
* be plural | ||
* @returns {string} - normalize and first upper-cased resource name | ||
* @version 0.1.0 | ||
* @since 0.1.0 | ||
*/ | ||
function getNormalizeResourceName(resourceName) { | ||
var pluralizeLast = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
var words = split(kebabCase(resourceName), '-'); | ||
if (words.length > 1) { | ||
var lastWord = pluralizeLast ? pluralize(last(words)) : singularize(last(words)); | ||
words[words.length - 1] = lastWord; | ||
return upperFirst(camelCase(words.join('-'))); | ||
} | ||
return pluralizeLast ? capitalize(pluralize(resourceName)) : capitalize(singularize(resourceName)); | ||
} | ||
var defineProperty = function (obj, key, value) { | ||
@@ -107,4 +77,4 @@ if (key in obj) { | ||
var plural = getNormalizeResourceName(resourceName, true); | ||
var singular = getNormalizeResourceName(resourceName); | ||
var plural = upperFirst(pluralize(resourceName)); | ||
var singular = upperFirst(singularize(resourceName)); | ||
@@ -314,3 +284,3 @@ return _ref = {}, defineProperty(_ref, camelize('select', singular), function (state, action) { | ||
var singularName = upperFirst(singularize(resource)); | ||
var resourceName = toLower(singularName); | ||
var resourceName = lowerFirst(singularName); | ||
@@ -317,0 +287,0 @@ return _ref = {}, defineProperty(_ref, camelize('get', pluralName), function (param) { |
@@ -17,11 +17,7 @@ 'use strict'; | ||
var reduxStarterKit = require('redux-starter-kit'); | ||
var upperFirst = _interopDefault(require('lodash/upperFirst')); | ||
var camelCase = _interopDefault(require('lodash/camelCase')); | ||
var upperFirst = _interopDefault(require('lodash/upperFirst')); | ||
var kebabCase = _interopDefault(require('lodash/kebabCase')); | ||
var split = _interopDefault(require('lodash/split')); | ||
var capitalize = _interopDefault(require('lodash/capitalize')); | ||
var last = _interopDefault(require('lodash/last')); | ||
var merge = _interopDefault(require('lodash/merge')); | ||
var client = require('@codetanzania/emis-api-client'); | ||
var toLower = _interopDefault(require('lodash/toLower')); | ||
var lowerFirst = _interopDefault(require('lodash/lowerFirst')); | ||
@@ -47,28 +43,2 @@ /** | ||
/** | ||
* @function | ||
* @name getNormalizeResourceName | ||
* | ||
* @param {string} resourceName - resource name to be normalized | ||
* @param {boolean} pluralizeLast - if last word or the resource name should | ||
* be plural | ||
* @returns {string} - normalize and first upper-cased resource name | ||
* @version 0.1.0 | ||
* @since 0.1.0 | ||
*/ | ||
function getNormalizeResourceName(resourceName) { | ||
var pluralizeLast = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
var words = split(kebabCase(resourceName), '-'); | ||
if (words.length > 1) { | ||
var lastWord = pluralizeLast ? inflection.pluralize(last(words)) : inflection.singularize(last(words)); | ||
words[words.length - 1] = lastWord; | ||
return upperFirst(camelCase(words.join('-'))); | ||
} | ||
return pluralizeLast ? capitalize(inflection.pluralize(resourceName)) : capitalize(inflection.singularize(resourceName)); | ||
} | ||
var defineProperty = function (obj, key, value) { | ||
@@ -113,4 +83,4 @@ if (key in obj) { | ||
var plural = getNormalizeResourceName(resourceName, true); | ||
var singular = getNormalizeResourceName(resourceName); | ||
var plural = upperFirst(inflection.pluralize(resourceName)); | ||
var singular = upperFirst(inflection.singularize(resourceName)); | ||
@@ -320,3 +290,3 @@ return _ref = {}, defineProperty(_ref, camelize('select', singular), function (state, action) { | ||
var singularName = upperFirst(inflection.singularize(resource)); | ||
var resourceName = toLower(singularName); | ||
var resourceName = lowerFirst(singularName); | ||
@@ -323,0 +293,0 @@ return _ref = {}, defineProperty(_ref, camelize('get', pluralName), function (param) { |
{ | ||
"name": "@codetanzania/emis-api-states", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "EMIS Redux state management library", | ||
@@ -93,3 +93,3 @@ "main": "lib/index.js", | ||
"peerDependencies": { | ||
"@codetanzania/emis-api-client": ">=0.3.0", | ||
"@codetanzania/emis-api-client": ">=0.3.1", | ||
"axios": ">=0.18.0", | ||
@@ -96,0 +96,0 @@ "inflection": ">=1.12.0", |
@@ -6,4 +6,4 @@ import { singularize } from 'inflection'; | ||
import upperFirst from 'lodash/upperFirst'; | ||
import camelize from '../helpers'; | ||
import createThunkFor from './thunk'; | ||
import { camelize } from '../helpers'; | ||
@@ -10,0 +10,0 @@ /** |
@@ -0,4 +1,6 @@ | ||
import { pluralize, singularize } from 'inflection'; | ||
import isObject from 'lodash/isObject'; | ||
import upperFirst from 'lodash/upperFirst'; | ||
import { createSlice } from 'redux-starter-kit'; | ||
import { camelize, getNormalizeResourceName } from '../helpers'; | ||
import camelize from '../helpers'; | ||
@@ -17,4 +19,4 @@ /** | ||
export function getDefaultReducers(resourceName) { | ||
const plural = getNormalizeResourceName(resourceName, true); | ||
const singular = getNormalizeResourceName(resourceName); | ||
const plural = upperFirst(pluralize(resourceName)); | ||
const singular = upperFirst(singularize(resourceName)); | ||
@@ -21,0 +23,0 @@ return { |
import * as client from '@codetanzania/emis-api-client'; | ||
import { pluralize, singularize } from 'inflection'; | ||
import toLower from 'lodash/toLower'; | ||
import lowerFirst from 'lodash/lowerFirst'; | ||
import upperFirst from 'lodash/upperFirst'; | ||
import camelize from '../helpers'; | ||
import { actions } from '../store'; | ||
import { camelize } from '../helpers'; | ||
@@ -25,3 +25,3 @@ /** | ||
const singularName = upperFirst(singularize(resource)); | ||
const resourceName = toLower(singularName); | ||
const resourceName = lowerFirst(singularName); | ||
@@ -28,0 +28,0 @@ return { |
@@ -1,8 +0,2 @@ | ||
import { singularize, pluralize } from 'inflection'; | ||
import camelCase from 'lodash/camelCase'; | ||
import upperFirst from 'lodash/upperFirst'; | ||
import kebabCase from 'lodash/kebabCase'; | ||
import split from 'lodash/split'; | ||
import capitalize from 'lodash/capitalize'; | ||
import last from 'lodash/last'; | ||
@@ -20,32 +14,4 @@ /** | ||
*/ | ||
export function camelize(...words) { | ||
export default function camelize(...words) { | ||
return camelCase([...words].join(' ')); | ||
} | ||
/** | ||
* @function | ||
* @name getNormalizeResourceName | ||
* | ||
* @param {string} resourceName - resource name to be normalized | ||
* @param {boolean} pluralizeLast - if last word or the resource name should | ||
* be plural | ||
* @returns {string} - normalize and first upper-cased resource name | ||
* @version 0.1.0 | ||
* @since 0.1.0 | ||
*/ | ||
export function getNormalizeResourceName(resourceName, pluralizeLast = false) { | ||
const words = split(kebabCase(resourceName), '-'); | ||
if (words.length > 1) { | ||
const lastWord = pluralizeLast | ||
? pluralize(last(words)) | ||
: singularize(last(words)); | ||
words[words.length - 1] = lastWord; | ||
return upperFirst(camelCase(words.join('-'))); | ||
} | ||
return pluralizeLast | ||
? capitalize(pluralize(resourceName)) | ||
: capitalize(singularize(resourceName)); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86085
1948