How to use i - 10 common examples

To help you get started, we’ve selected a few i 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 dylnslck / restle / lib / model / resource-array / index.js View on Github external
serialize(options = {}) {
    const { resources, count, model } = this;

    const i = inflect();
    const data = [];
    const included = [];
    const plural = i.pluralize(model.type);
    const namespace = undefined !== options.namespace
      ? `/${options.namespace}`
      : ``;

    const links = {
      self: `${namespace}/${plural}`,
    };

    // TODO: default limit
    if ('page' in options) {
      let limit = options.page.limit || 0;
      let offset = options.page.offset || 0;
      links.page = {};
github dylnslck / restle / lib / serializer / index.js View on Github external
serializeResourceObject(fields, type, doc, many) {
    if (!doc) {
      throw new Error('Cannot serialize an undefined object!');
    }

    // FIXME: create global inflect so not to call the constructor every time
    const i = inflect();
    const id = doc._id;

    if (!fields) {
      throw new Error('Trying to serialize before fields have been established.');
    }

    if (!id) {
      throw new Error('Cannot serialize document with undefined id.');
    }

    // TODO: create method for building a resource object URL
    const resourceObject = {
      data: {
        type: i.singularize(type),
        id: id,
      },
github dylnslck / restle / lib / serializer / index.js View on Github external
serializeResource(router, type, document) {
    const fields = router.fields;
    const i = inflect();
    let id = document._id;

    // build resource object
    let resource = this._resource = {
      links: {
        self: baseUrl(router.origin, router.port, router.namespace, type, id),
      },
      id: id,
      type: parseModelName(type),
    };

    // loop through the raw Mongo object
    _.forOwn(document, (value, field) => {
      let isFieldAttribute = hasAttribute(fields, type, field);
      let isFieldRelationship = hasRelationship(fields, type, field);
github frictionlessdata / datapackage-ui / datapackagist / src / scripts / components / ui / descriptoredit.js View on Github external
var config = require('../../config');
var csv = require('csv');
var getUri = require('get-uri');
var highlight = require('highlight-redux');
var jsonEditor = require('./jsoneditform');

// This import is just for extending json editor with custom editor
var resourceEditor = require('./resource-editor');

var jtsInfer = require('json-table-schema').infer;
var registry = require('./registry');
var request = require('superagent-bluebird-promise');
var _ = require('underscore');
var $ = require('jquery');
var Promise = require('bluebird');
var titleize = require('i')().titleize;


// Upload data file and populate .resource array with item
DataUploadView = backbone.BaseView.extend({
  addRow: function(name) {
    var descriptorEdit = window.APP.layout.descriptorEdit;


    descriptorEdit.layout.form.getEditor('root.resources').add({name: name, path: name});
    descriptorEdit.populateTitlesFromNames();
    return this;  
  },

  hideLoading: function() { window.APP.layout.splashScreen.activate(false); return this; },

  events: {
github winkjs / wink-nlp-utils / src / string-sentences.js View on Github external
//     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
//     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
//     DEALINGS IN THE SOFTWARE.

//
// Abbreviations with `.` but are never are EOS.
const abbrvNoEOS = Object.create( null );
abbrvNoEOS[ 'mr.' ] = true;
abbrvNoEOS[ 'mrs.' ] = true;
abbrvNoEOS[ 'ms.' ] = true;
abbrvNoEOS[ 'er.' ] = true;
abbrvNoEOS[ 'dr.' ] = true;
abbrvNoEOS[ 'miss.' ] = true;
abbrvNoEOS[ 'shri.' ] = true;
abbrvNoEOS[ 'smt.' ] = true;
abbrvNoEOS[ 'i.e.' ] = true;
abbrvNoEOS[ 'ie.' ] = true;
abbrvNoEOS[ 'e.g.' ] = true;
abbrvNoEOS[ 'eg.' ] = true;
abbrvNoEOS[ 'viz.' ] = true;
abbrvNoEOS[ 'pvt.' ] = true;
// et al.
abbrvNoEOS[ 'et.' ] = true;
abbrvNoEOS[ 'al.' ] = true;
// Mount Kailash!
abbrvNoEOS[ 'mt.' ] = true;
// Pages!
abbrvNoEOS[ 'pp.' ] = true;

const abbrvMayBeEOS = Object.create( null );
abbrvMayBeEOS[ 'inc.' ] = true;
abbrvMayBeEOS[ 'ltd.' ] = true;
github igdmapps / igdm / main / instagram.js View on Github external
return new Promise((resolve, reject) => {
    let followers = [];
    let following = [];
    const sessionStorage = session._cookiesStore.storage
    const accountId = (sessionStorage.idx['instagram.com'] || sessionStorage.idx['i.instagram.com'])['/'].ds_user_id.value

    const compare = () => {
      hashedFollowers = {}
      followers.forEach((user) => hashedFollowers[user.id] = true);

      let unfollowers = following.filter((user) => !hashedFollowers[user.id]);
      resolve(unfollowers);
    }

    const getUsers = (newUsers, allUsers, usersGetter, otherUsersGetter) => {
      newUsers.forEach((user) => allUsers.push(user))
      // moreAvailable maybe null. We are dodging that.
      if (usersGetter.moreAvailable === false && otherUsersGetter.moreAvailable === false){
        compare();
      } else if (usersGetter.moreAvailable !== false) {
        usersGetter.get()
github quailjs / quail / test / unit / testLibs.html View on Github external
test('groupCasesBySelector', function () {
      var _test = new libs.Test('fakeLinkTest', {
        'type': 'selector',
        'options': {
          'selector': 'i.unittest',
        }
      });
      _test.invoke();
      var casesBySelector = _test.groupCasesBySelector();
      equal(casesBySelector['i.unittest'].length, 10, 'Cases are grouped by selector');
    });
    asyncTest('groupCasesByHtml', function () {
github jairajs89 / zerver / test / static.js View on Github external
cache.get('/i.png', function (data) {
                assert.deepEqual(data.body, files['i.png']);
                next();
            });
        },
github npezza93 / archipelago / app / renderer / utils / form / core-fields.jsx View on Github external
const select = (property, value, schema, onChange) => {
  return 
}
github topfullstack / adminify / src / helper.js View on Github external
import Vue from 'vue'
import inflector from 'i'

const storage = window.localStorage
let helper = {}

/**
 * string processor
 */
helper.i = inflector()

/**
 * localStorage
 */
helper.ls = {
  set (key, value) {
    value = JSON.stringify(value)
    storage.setItem(key, value)
  },
  get (key, defaultValue) {
    let value = storage.getItem(key, value)
    if (value === null || value === 'undefined' || value === '') {
      value = defaultValue
    } else {
      value = JSON.parse(value)
    }

i

custom inflections for nodejs

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis