How to use the ramda-adjunct.isNilOrEmpty function in ramda-adjunct

To help you get started, we’ve selected a few ramda-adjunct 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 teambit / bit / src / consumer / bit-json / abstract-bit-json.js View on Github external
getBackwardCompatibleEnv(type: EnvType): ?Compilers | ?Testers | ?string {
    const envObj = this.getEnvsByType(type);
    if (!envObj) return undefined;
    if (Object.keys(envObj).length !== 1) return envObj; // it has more than one id, it's >= v13
    const envId = Object.keys(envObj)[0];
    if (
      RA.isNilOrEmpty(envObj[envId].rawConfig) &&
      RA.isNilOrEmpty(envObj[envId].options) &&
      RA.isNilOrEmpty(envObj[envId].files)
    ) {
      return envId;
    }
    return envObj;
  }
github teambit / bit / src / consumer / config / abstract-config.ts View on Github external
static convertEnvToStringIfPossible(envObj: Envs | null | undefined): string | null | undefined | Envs {
    if (!envObj) return undefined;
    if (Object.keys(envObj).length !== 1) return envObj; // it has more than one id
    const envId = Object.keys(envObj)[0];
    if (
      RA.isNilOrEmpty(envObj[envId].rawConfig) &&
      RA.isNilOrEmpty(envObj[envId].options) &&
      RA.isNilOrEmpty(envObj[envId].files)
    ) {
      return envId;
    }
    return envObj;
  }
github Svehla / node-graphql-boilerplate / src / gql / models / Comment / subscriptions / newCommentSubscription.ts View on Github external
() => pubsub.asyncIterator(SubsTypes.NewComment), (payload, variables = {}, context) => {
        // TODO: can't add context in playground and test subscription without frontend
        // disable auth for dev env?
        if (isNilOrEmpty(context.user)) {
          return false
        }
        const globalReportId = variables.input && variables.input.reportId
        const reportId = Number(fromGlobalId(globalReportId).id)
        return payload.report_id === reportId
      }
    ),
github teambit / bit / src / consumer / bit-json / abstract-bit-json.js View on Github external
getBackwardCompatibleEnv(type: EnvType): ?Compilers | ?Testers | ?string {
    const envObj = this.getEnvsByType(type);
    if (!envObj) return undefined;
    if (Object.keys(envObj).length !== 1) return envObj; // it has more than one id, it's >= v13
    const envId = Object.keys(envObj)[0];
    if (
      RA.isNilOrEmpty(envObj[envId].rawConfig) &&
      RA.isNilOrEmpty(envObj[envId].options) &&
      RA.isNilOrEmpty(envObj[envId].files)
    ) {
      return envId;
    }
    return envObj;
  }
github teambit / bit / src / consumer / component-ops / component-writer.ts View on Github external
async _populateEnvFilesIfNeeded() {
    [this.component.compiler, this.component.tester].forEach(env => {
      if (!env) return;
      env.populateDataToPersist({
        configDir: this.writeToPath,
        consumer: this.consumer,
        deleteOldFiles: false,
        verbose: false,
        envType: env.envType
      });
      this.component.dataToPersist.merge(env.dataToPersist);
    });

    const areThereEnvFiles =
      (this.component.compiler && !RA.isNilOrEmpty(this.component.compiler.files)) ||
      (this.component.tester && !RA.isNilOrEmpty(this.component.tester.files));
    if (areThereEnvFiles && !this.writeConfig && !this.configDir && this.component.componentMap) {
      this.configDir = DEFAULT_EJECTED_ENVS_DIR_PATH;
      this.component.componentMap.setConfigDir(this.configDir);
    }
  }
github teambit / bit / src / consumer / component-ops / component-writer.ts View on Github external
async _populateEnvFilesIfNeeded() {
    [this.component.compiler, this.component.tester].forEach(env => {
      if (!env) return;
      env.populateDataToPersist({
        configDir: this.writeToPath,
        consumer: this.consumer,
        deleteOldFiles: false,
        verbose: false,
        envType: env.envType
      });
      this.component.dataToPersist.merge(env.dataToPersist);
    });

    const areThereEnvFiles =
      (this.component.compiler && !RA.isNilOrEmpty(this.component.compiler.files)) ||
      (this.component.tester && !RA.isNilOrEmpty(this.component.tester.files));
    if (areThereEnvFiles && !this.writeConfig && !this.configDir && this.component.componentMap) {
      this.configDir = DEFAULT_EJECTED_ENVS_DIR_PATH;
      this.component.componentMap.setConfigDir(this.configDir);
    }
  }
github Svehla / node-graphql-boilerplate / src / gql / models / User / UserQuery.ts View on Github external
resolve: (parentValues, args, { req: { user } }) => {
      if (isNilOrEmpty(user)) {
        return null
      } else {
        return user
      }
    },
  },
github Svehla / node-graphql-boilerplate / src / gql / models / Post / queries / Post.ts View on Github external
resolve: async (parent, { id }) => {
    const { id: convertedId } = fromGlobalId(id)
    const post = await models.Post.findOne({
      where: {
        id: convertedId
      }
    })

    return isNilOrEmpty(post) ? null : post
  },
}
github Svehla / node-graphql-boilerplate / src / gql / models / Node / nodeDefinitions.ts View on Github external
const nDefinitions = nodeDefinitions(async (globalId, { req: { user }}) => {
  const { type, id: unparsedId } = fromGlobalId(globalId)
  const id = Number(unparsedId)
  if (isNilOrEmpty(type) || isNilOrEmpty(id) || isNaN(id)) {
    throw new InvalidNodeIdError()
  }

  let foundNode = null
  switch (type) {
    case NodeGqlImplement.Post: {
      foundNode = await models.Post.findById(id)
      break
    }
    case NodeGqlImplement.Comment: {
      foundNode = await models.Comment.findById(id)
      break
    }
    case NodeGqlImplement.User: {
      checkPermissions({ onlyLogged: true }, user)
      foundNode = await models.User.findById(id)