How to use the is_js.json 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 finos / cla-bot / src / index.js View on Github external
} catch (e) {
    logger.info(
      "Organisation configuration not found, resolving .clabot URL at project level"
    );
    orgConfig = await getReadmeUrl(webhook);
  }

  logger.info(
    `Obtaining .clabot configuration file from ${
      orgConfig.download_url.split("?")[0]
    }`
  );

  const config = await getFile(orgConfig);

  if (!is.json(config)) {
    throw new Error("The .clabot file is not valid JSON");
  }

  // merge with default config options
  const botConfig = Object.assign({}, defaultConfig, config);

  logger.info("Obtaining the list of commits for the pull request");
  const commits = await getCommits(pullRequestUrl);

  logger.info(
    `Total Commits: ${commits.length}, checking CLA status for committers`
  );

  // PRs include the head sha, for comments we have to determine this from the commit history
  let headSha;
  if (webhook.pull_request) {
github faressoft / flowa / index.js View on Github external
Flowa.prototype._setDefaultType = function(task) {

  var self = this;

  // Is not a compound task, nothing to do
  if (!is.json(task)) {
    return;
  }

  // The type is not defined
  if (typeof task.type == 'undefined') {
    task.type = this._defaultRunnerType;
  }

  // Foreach task
  _.forIn(task, function(task) {

    self._setDefaultType(task);
    
  });
  
};
github recursivefunk / good-env / index.js View on Github external
return items.every(item => {
        if (is.string(item)) {
          if (this.ok(item)) {
            return true
          } else {
            throw Error(`No environment configuration for var "${item}"`)
          }
        } else if (is.json(item)) {
          const key = Object.keys(item)[0]
          const type = item[key].type
          const validator = item[key].ok

          if (type && !validType(type)) {
            throw Error(`Invalid expected type "${type}"`)
          } else {
            const kit = getKit(type)
            const val = kit.getter(key)
            const result = kit.validator(val)
            if (!result) {
              throw Error(`Unexpected result for key="${key}". It may not exist or may not be a valid "${type}"`)
            }

            if (validator && is.function(validator)) {
              const valid = validator(val)
github qiscus / qiscus-sdk-web-core / src / utils / param-utils.ts View on Github external
export const isOptJson = (item: any) => {
  const msg = getMsg(item, 'need to be object or null')
  return compose(
    msg,
    some(is.null, is.undefined, is.json)
  )
}
export const isOptCallback = (item: any) => {
github recursivefunk / good-env / index.js View on Github external
prev[next] = getter(next, obj[next])
          return prev
        }, {})
      )

      const arrReducer = (keys, getter) => {
        const arr = items.map(key => getter(key))
        return arr.reduce((prev, next, index) => {
          prev[keys[index]] = arr[index]
          return prev
        }, {})
      }

      if (is.array(items)) {
        return arrReducer(items, this.get)
      } else if (is.json(items)) {
        return objReducer(items, this.get)
      } else {
        throw Error(`Invalid arg ${items}`)
      }
    },
github faressoft / flowa / index.js View on Github external
Flowa.prototype._isCompoundTask = function(taskName) {

  return is.json(this._tasks[taskName]);
  
};