How to use the is-what.isAnyObject function in is-what

To help you get started, we’ve selected a few is-what examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mesqueeb / vuex-easy-firestore / test / helpers / index.cjs.js View on Github external
function isIncrementHelper(payload) {
    // return payload instanceof Increment
    return (isWhat.isAnyObject(payload) &&
        !isWhat.isPlainObject(payload) &&
        // @ts-ignore
        payload.isIncrementHelper === true);
}
github mesqueeb / vuex-easy-firestore / test / helpers / utils / setDefaultValues.js View on Github external
function convertTimestamps(originVal, targetVal) {
    if (originVal === '%convertTimestamp%') {
        // firestore timestamps
        // @ts-ignore
        if (isWhat.isAnyObject(targetVal) && !isWhat.isPlainObject(targetVal) && isWhat.isFunction(targetVal.toDate)) {
            // @ts-ignore
            return targetVal.toDate();
        }
        // strings
        if (isWhat.isString(targetVal) && isWhat.isDate(new Date(targetVal))) {
            return new Date(targetVal);
        }
    }
    return targetVal;
}
/**
github mesqueeb / vuex-easy-firestore / test / helpers / index.cjs.js View on Github external
function isArrayHelper(value) {
    // this is bugged in vuex actions, I DONT KNOW WHY
    // return (
    //   value instanceof ArrayUnion ||
    //   value instanceof ArrayRemove
    // )
    return (isWhat.isAnyObject(value) &&
        !isWhat.isPlainObject(value) &&
        // @ts-ignore
        value.isArrayHelper === true);
}
github mesqueeb / vuex-easy-firestore / test / helpers / setDefaultValues.cjs.js View on Github external
function convertTimestamps(originVal, targetVal) {
    if (originVal === '%convertTimestamp%') {
        // firestore timestamps
        // @ts-ignore
        if (isWhat.isAnyObject(targetVal) && !isWhat.isObject(targetVal) && isWhat.isFunction(targetVal.toDate)) {
            // @ts-ignore
            return targetVal.toDate();
        }
        // strings
        if (isWhat.isString(targetVal) && isWhat.isDate(new Date(targetVal))) {
            return new Date(targetVal);
        }
    }
    return targetVal;
}
/**
github mesqueeb / vuex-easy-firestore / dist / index.esm.js View on Github external
function isIncrementHelper(payload) {
    // return payload instanceof Increment
    return (isAnyObject(payload) &&
        !isPlainObject(payload) &&
        // @ts-ignore
        payload.isIncrementHelper === true);
}
github mesqueeb / vuex-easy-firestore / dist / index.cjs.js View on Github external
function convertTimestamps(originVal, targetVal) {
    if (originVal === '%convertTimestamp%') {
        // firestore timestamps
        // @ts-ignore
        if (isWhat.isAnyObject(targetVal) && !isWhat.isPlainObject(targetVal) && isWhat.isFunction(targetVal.toDate)) {
            // @ts-ignore
            return targetVal.toDate();
        }
        // strings
        if (isWhat.isString(targetVal) && isWhat.isDate(new Date(targetVal))) {
            return new Date(targetVal);
        }
    }
    return targetVal;
}
/**
github mesqueeb / vuex-easy-firestore / dist / index.esm.js View on Github external
return params.map(function (param) {
        if (isAnyObject(param) && !isPlainObject(param)) {
            // @ts-ignore
            return String(param.constructor.name) + String(param.id);
        }
        return String(param);
    }).join();
}
github mesqueeb / vuex-easy-firestore / src / utils / apiHelpers.ts View on Github external
return params.map(param => {
    if (isAnyObject(param) && !isPlainObject(param)) {
      // @ts-ignore
      return String(param.constructor.name) + String(param.id)
    }
    return String(param)
  }).join()
}
github mesqueeb / vuex-easy-firestore / dist / index.cjs.js View on Github external
function isIncrementHelper(payload) {
    // return payload instanceof Increment
    return (isWhat.isAnyObject(payload) &&
        !isWhat.isPlainObject(payload) &&
        // @ts-ignore
        payload.isIncrementHelper === true);
}
github mesqueeb / vuex-easy-firestore / dist / index.esm.js View on Github external
function isArrayHelper(value) {
    // this is bugged in vuex actions, I DONT KNOW WHY
    // return (
    //   value instanceof ArrayUnion ||
    //   value instanceof ArrayRemove
    // )
    return (isAnyObject(value) &&
        !isPlainObject(value) &&
        // @ts-ignore
        value.isArrayHelper === true);
}

is-what

JS type check (TypeScript supported) functions like `isPlainObject() isArray()` etc. A simple & small integration.

MIT
Latest version published 10 days ago

Package Health Score

85 / 100
Full package analysis