How to use the is_js.equal function in is_js

To help you get started, we’ve selected a few is_js 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 vabatta / omx-manager / lib / OmxInstance.js View on Github external
// Get the value of the key
    var value = args[key];
    // Validity check to push only string, number and boolean values command line arguments
    var validValue = is.string(value) || is.number(value) || is.boolean(value);
    // Validity check
    if (validValue && is.truthy(value)) {
      // Check for custom handling keys
      if (is.not.inArray(key, keysIgnored)) {
        // Push the key
        argsToSpawn.push(key);
        // Push value for string and number values
        if (is.string(value)) argsToSpawn.push(value);
        else if (is.number(value)) argsToSpawn.push(value.toString());
      }
      // Check if should handle loop
      else if (is.equal(key, '--loop')) {
        self._configurations.loop = true;
      }
    }
  });
github Albert-Gao / veasy / src / ruleHandlers / numberRules.js View on Github external
export const equal = (name, value, schema) => ({
  isValid: is.equal(value * 1, schema.equal * 1),
  errorText: `${name} should equal to ${schema.equal * 1}.`
});
github vabatta / omx-manager / lib / OmxManager.js View on Github external
OmxManager.prototype.setDbusController = function setDbusController(controller) {
  if (is.equal(controller, true)) this._dbusController = true;
  else this._dbusController = false;
};
github Albert-Gao / veasy / src / ruleHandlers / stringRules.js View on Github external
export const maxLength = (name, value, schema) => ({
  isValid: is.equal(value.length, schema.maxLength) || is.under(value.length, schema.maxLength),
  errorText: `${name}'s length should be equal or less than ${schema.maxLength}. Current: ${value.length}`
});
github Albert-Gao / veasy / src / numberHandlers.js View on Github external
export function equalHandler(value, schema) {
  const target = schema.equal * 1;
  const isValid = is.equal(value * 1, target);
  if (isValid) return;

  const errorText = `${NAME_PLACEHOLDER} should equal to ${target}.`;
  throwError(value, errorText);
}