UNPKG

gambit

Version:

A hyper-thin library to help building API driven redux apps

78 lines (57 loc) 4.06 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.keyIsntArray = exports.keyIsArray = exports.keyUndefined = exports.valueUndefined = exports.integerAsString = exports.badApiArgs = exports.badGrabReturn = exports.badGrab = exports.badComponent = exports.noFunctionAs = exports.badMethodFinder = exports.badActionBlocker = exports.badMadeId = exports.undefinedArgumentGiven = exports.badConstantName = exports.nonNamedArguments = undefined; var _keys = require('babel-runtime/core-js/object/keys'); var _keys2 = _interopRequireDefault(_keys); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /* eslint-disable max-len */ var nonNamedArguments = exports.nonNamedArguments = function nonNamedArguments(givenArgs) { return 'Arguments passed to an action creator must be named ({ foo: \'bar\'}), ' + givenArgs + ' given'; }; var badConstantName = exports.badConstantName = function badConstantName(constant) { return 'No such constant ' + constant; }; var undefinedArgumentGiven = exports.undefinedArgumentGiven = function undefinedArgumentGiven(constant, id) { return 'After building Action ID, undefined was found implying a required arg was undefined, ' + constant + ': ' + id; }; var badMadeId = exports.badMadeId = function badMadeId(madeId) { return 'ID must be a string or a function that returns a string for an action creator, ' + madeId + ' given'; }; var badActionBlocker = exports.badActionBlocker = function badActionBlocker(actionBlocker) { return 'actionBlockers must be functions when set, ' + actionBlocker + ' given'; }; var badMethodFinder = exports.badMethodFinder = function badMethodFinder(methodToCall) { return 'Return value of the api search method in createStagedAction must be a function, ' + methodToCall + ' given'; }; var noFunctionAs = exports.noFunctionAs = function noFunctionAs(as, key, containerName) { return containerName + '.value.as must be a function, ' + as + ' given for ' + key + ' in Container(' + containerName + ')'; }; var badComponent = exports.badComponent = function badComponent(fetch) { return 'You haven\'t loaded a component correctly, fetch has the follows keys ' + (0, _keys2.default)(fetch).join(','); }; var badGrab = exports.badGrab = function badGrab(name, key, grab) { return name + '.' + key + '.grab must return a function, ' + grab + ' given'; }; var badGrabReturn = exports.badGrabReturn = function badGrabReturn(name, key, val) { return name + '.' + key + '.grab returns ' + val + ', ensure you\'re returning the dispatch in the grab\'s action thunk.'; }; var badApiArgs = exports.badApiArgs = function badApiArgs(method) { return 'Argument passed to ' + method.name + ' must be an object with named properties'; }; var integerAsString = exports.integerAsString = function integerAsString(type, argument, key, allArgs) { return 'When ' + (type === 'set' ? 'setting' : 'getting') + ' a field on a reducer, if the field name can be an integer, it must be. You used "' + argument + '" in ' + (allArgs.length > 1 ? allArgs.join('.') : '') + ' ' + key + '.'; }; var valueUndefined = exports.valueUndefined = function valueUndefined(setKey, key) { return 'Setting ' + setKey.join('.') + ' as undefined is not permissable in strictMode for ' + key; }; var keyUndefined = exports.keyUndefined = function keyUndefined(setKey, key) { return 'Cannot use undefined as a key (full chain: ' + setKey.join('.') + ') on ' + key + ' whilst in strictMode'; }; var keyIsArray = exports.keyIsArray = function keyIsArray(setKey, key, type) { return 'Cannot use ' + (type === 'set' ? 'set' : 'get') + ' with an Array key for ' + key + '. Used ' + setKey.join('.') + ', please use ' + (type === 'set' ? 'setIn' : 'getIn'); }; var keyIsntArray = exports.keyIsntArray = function keyIsntArray(setKey, key, type) { return 'Cannot use ' + (type === 'set' ? 'setIn' : 'getIn') + ' with a none array key for ' + key + '. Used ' + setKey + ', please use ' + (type === 'set' ? 'set' : 'get'); };