How to use the @sindresorhus/is.emptyObject function in @sindresorhus/is

To help you get started, we’ve selected a few @sindresorhus/is 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 integreat-io / integreat / lib / service / authorizeScheme.js View on Github external
const getScheme = (schema, action) => {
  if (!schema || !schema.access || is.emptyObject(schema.access)) {
    return null
  }

  // Get access object - directly from schema or from the relevant action
  const access = getAccessObject(schema.access, action)

  // Return if string
  if (typeof access === 'string') {
    return access
  }

  // Return access prop if set
  if (access.allow !== undefined) {
    return access.allow
  }
github szmarczak / http2-wrapper / test / response.js View on Github external
test('headers', wrapper, async (t, server) => {
	const request = makeRequest(server.url);
	request.end();

	const response = await pEvent(request, 'response');
	await getStream(response);

	t.false(is.emptyObject(response.headers));
	t.false(is.emptyArray(response.rawHeaders));
});
github integreat-io / integreat / lib / mapping / index.js View on Github external
const prepareTypeQualifier = ({ attributes = {}, relationships = {}, type }) => (is.emptyObject(attributes) && is.emptyObject(relationships))
  ? [filter(compare({ path: 'type', match: type }))]
  : []
github charliewilco / downwrite / utils / resolvers.ts View on Github external
async createUser(
      _,
      { email, username, password }: IMutationUserVars,
      { dataSources: { users } }
    ) {
      const verifiedUser = await verifyUniqueUser({ email, username }, (id1, id2) =>
        users.findByCondition({
          $or: [{ email: id1 }, { username: id2 }]
        })
      );

      if (!is.emptyObject(verifiedUser)) {
        const salt = await bcrypt.genSalt(10);
        const hash = await bcrypt.hash(password, salt);
        const id = uuid();

        let user: IUser = await users.create(
          Object.assign(
            {},
            {
              email,
              username,
              id,
              password: hash,
              admin: false
            }
          )
        );