3.0.0 • Published 8 years ago

@volox/social-post-wrapper v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

Social wrap

Wraps a post from a social network into a generic Post

Usage

var wrap = require( '@volox/social-post-wrapper' ).default;
var tweet = {...}; // From Twitter
var instagramMedia = {...}; // From Instagram

// Without options
var twPost = wrap( tweet, 'twitter' );
var igPost = wrap( instagramMedia, 'instagram' );
console.log( twPost );
console.log( igPost );


// With options
var twPost1 = wrap( tweet, 'twitter', {
  useField: false,
} );
var igPost1 = wrap( instagramMedia, 'instagram', {
  field: 'source',
} );
console.log( twPost1 );
console.log( igPost1 );

// Will output

Options

The wrapper accepts the following options:

NameDescriptionTypeRequiredDefault
useFieldAdd a field that specifies the source of the post (EG twitter, instagram ...)Booleanfalsetrue
fieldThe field where the provider will be savedStringfalse'provider'

Post format:

FieldDescriptionTypeAvailable
idThe id from the providerStringyes
textThe text of the postStringyes
dateThe creation date of the postDateyes
locationThe location of the post as a GeoJSON point featureGeoJON Pointif present
authorThe name of the authorStringyes
authorIdThe id of the autorStringyes
tagsThe list of tags for the postArrayif present
langThe language of the postStringif present
rawThe original posrt from the providerObjectyes

Example

{
  id: '6457897564564564564654',
  text: 'TEST TEST',
  date: '2015-06-08T15:23:53.596Z',
  location: {
    type: 'Point',
    coordinates: [ longitude, latitude ]
  },
  author: 'Volox',
  authorId: '428956',
  tags: [
    'test',
    'tag',
  ],
  lang: 'en',
  provider: 'twitter',
  raw: { ... } // the original post from the social network
}
3.0.0

8 years ago

2.1.0

8 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.2.0

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago